Documentation ¶
Overview ¶
Package store implements the Identity Server store interfaces using GORM.
Index ¶
- Variables
- func Check(db *gorm.DB) error
- func Clear(db *gorm.DB) error
- func GetAPIKeyStore(db *gorm.DB) store.APIKeyStore
- func GetApplicationStore(db *gorm.DB) store.ApplicationStore
- func GetClientStore(db *gorm.DB) store.ClientStore
- func GetContactInfoStore(db *gorm.DB) store.ContactInfoStore
- func GetEUIStore(db *gorm.DB) store.EUIStore
- func GetEndDeviceStore(db *gorm.DB) store.EndDeviceStore
- func GetEntitySearch(db *gorm.DB) store.EntitySearch
- func GetGatewayStore(db *gorm.DB) store.GatewayStore
- func GetInvitationStore(db *gorm.DB) store.InvitationStore
- func GetLoginTokenStore(db *gorm.DB) store.LoginTokenStore
- func GetMembershipStore(db *gorm.DB) store.MembershipStore
- func GetNotificationStore(db *gorm.DB) store.NotificationStore
- func GetOAuthStore(db *gorm.DB) store.OAuthStore
- func GetOrganizationStore(db *gorm.DB) store.OrganizationStore
- func GetUserSessionStore(db *gorm.DB) store.UserSessionStore
- func GetUserStore(db *gorm.DB) store.UserStore
- func Initialize(db *gorm.DB) error
- func Migrate(ctx context.Context, db *gorm.DB) error
- func Open(ctx context.Context, dsn string) (*gorm.DB, error)
- func SetLogger(db *gorm.DB, log log.Interface)
- func Transact(ctx context.Context, db *gorm.DB, f func(db *gorm.DB) error) (err error)
- type APIKey
- type AccessToken
- type Account
- type Application
- type Attribute
- type AuthorizationCode
- type Client
- type ClientAuthorization
- type CombinedStore
- func (s *CombinedStore) Authorize(ctx context.Context, authorization *ttnpb.OAuthClientAuthorization) (*ttnpb.OAuthClientAuthorization, error)
- func (s *CombinedStore) BatchUpdateEndDeviceLastSeen(ctx context.Context, ...) error
- func (s *CombinedStore) ConsumeLoginToken(ctx context.Context, token string) (*ttnpb.LoginToken, error)
- func (s *CombinedStore) CountEndDevices(ctx context.Context, ids *ttnpb.ApplicationIdentifiers) (total uint64, err error)
- func (s *CombinedStore) CreateAPIKey(ctx context.Context, entityID *ttnpb.EntityIdentifiers, key *ttnpb.APIKey) (*ttnpb.APIKey, error)
- func (s *CombinedStore) CreateAccessToken(ctx context.Context, token *ttnpb.OAuthAccessToken, previousID string) (*ttnpb.OAuthAccessToken, error)
- func (s *CombinedStore) CreateApplication(ctx context.Context, app *ttnpb.Application) (*ttnpb.Application, error)
- func (s *CombinedStore) CreateAuthorizationCode(ctx context.Context, code *ttnpb.OAuthAuthorizationCode) (*ttnpb.OAuthAuthorizationCode, error)
- func (s *CombinedStore) CreateClient(ctx context.Context, cli *ttnpb.Client) (*ttnpb.Client, error)
- func (s *CombinedStore) CreateEUIBlock(ctx context.Context, prefix types.EUI64Prefix, initCounter int64, ...) error
- func (s *CombinedStore) CreateEndDevice(ctx context.Context, dev *ttnpb.EndDevice) (*ttnpb.EndDevice, error)
- func (s *CombinedStore) CreateGateway(ctx context.Context, gtw *ttnpb.Gateway) (*ttnpb.Gateway, error)
- func (s *CombinedStore) CreateInvitation(ctx context.Context, invitation *ttnpb.Invitation) (*ttnpb.Invitation, error)
- func (s *CombinedStore) CreateLoginToken(ctx context.Context, loginToken *ttnpb.LoginToken) (*ttnpb.LoginToken, error)
- func (s *CombinedStore) CreateNotification(ctx context.Context, pb *ttnpb.Notification, ...) (*ttnpb.Notification, error)
- func (s *CombinedStore) CreateOrganization(ctx context.Context, org *ttnpb.Organization) (*ttnpb.Organization, error)
- func (s *CombinedStore) CreateSession(ctx context.Context, sess *ttnpb.UserSession) (*ttnpb.UserSession, error)
- func (s *CombinedStore) CreateUser(ctx context.Context, usr *ttnpb.User) (*ttnpb.User, error)
- func (s *CombinedStore) CreateValidation(ctx context.Context, validation *ttnpb.ContactInfoValidation) (*ttnpb.ContactInfoValidation, error)
- func (s *CombinedStore) DeleteAccessToken(ctx context.Context, id string) error
- func (s *CombinedStore) DeleteAccountMembers(ctx context.Context, id *ttnpb.OrganizationOrUserIdentifiers) error
- func (s *CombinedStore) DeleteAllUserSessions(ctx context.Context, userIDs *ttnpb.UserIdentifiers) error
- func (s *CombinedStore) DeleteApplication(ctx context.Context, id *ttnpb.ApplicationIdentifiers) error
- func (s *CombinedStore) DeleteAuthorization(ctx context.Context, userIDs *ttnpb.UserIdentifiers, ...) error
- func (s *CombinedStore) DeleteAuthorizationCode(ctx context.Context, code string) error
- func (s *CombinedStore) DeleteClient(ctx context.Context, id *ttnpb.ClientIdentifiers) error
- func (s *CombinedStore) DeleteClientAuthorizations(ctx context.Context, clientIDs *ttnpb.ClientIdentifiers) error
- func (s *CombinedStore) DeleteEndDevice(ctx context.Context, id *ttnpb.EndDeviceIdentifiers) error
- func (s *CombinedStore) DeleteEntityAPIKeys(ctx context.Context, entityID *ttnpb.EntityIdentifiers) error
- func (s *CombinedStore) DeleteEntityContactInfo(ctx context.Context, entityID ttnpb.IDStringer) error
- func (s *CombinedStore) DeleteEntityMembers(ctx context.Context, entityID *ttnpb.EntityIdentifiers) error
- func (s *CombinedStore) DeleteGateway(ctx context.Context, id *ttnpb.GatewayIdentifiers) error
- func (s *CombinedStore) DeleteInvitation(ctx context.Context, email string) error
- func (s *CombinedStore) DeleteOrganization(ctx context.Context, id *ttnpb.OrganizationIdentifiers) (err error)
- func (s *CombinedStore) DeleteSession(ctx context.Context, userIDs *ttnpb.UserIdentifiers, sessionID string) error
- func (s *CombinedStore) DeleteUser(ctx context.Context, id *ttnpb.UserIdentifiers) (err error)
- func (s *CombinedStore) DeleteUserAuthorizations(ctx context.Context, userIDs *ttnpb.UserIdentifiers) error
- func (s *CombinedStore) FindAPIKeys(ctx context.Context, entityID *ttnpb.EntityIdentifiers) ([]*ttnpb.APIKey, error)
- func (s *CombinedStore) FindAccountMembershipChains(ctx context.Context, accountID *ttnpb.OrganizationOrUserIdentifiers, ...) ([]*store.MembershipChain, error)
- func (s *CombinedStore) FindActiveLoginTokens(ctx context.Context, userIDs *ttnpb.UserIdentifiers) ([]*ttnpb.LoginToken, error)
- func (s *CombinedStore) FindApplications(ctx context.Context, ids []*ttnpb.ApplicationIdentifiers, ...) ([]*ttnpb.Application, error)
- func (s *CombinedStore) FindClients(ctx context.Context, ids []*ttnpb.ClientIdentifiers, fieldMask store.FieldMask) ([]*ttnpb.Client, error)
- func (s *CombinedStore) FindEndDevices(ctx context.Context, ids []*ttnpb.EndDeviceIdentifiers, ...) ([]*ttnpb.EndDevice, error)
- func (s *CombinedStore) FindGateways(ctx context.Context, ids []*ttnpb.GatewayIdentifiers, ...) ([]*ttnpb.Gateway, error)
- func (s *CombinedStore) FindInvitations(ctx context.Context) ([]*ttnpb.Invitation, error)
- func (s *CombinedStore) FindMembers(ctx context.Context, entityID *ttnpb.EntityIdentifiers) (map[*ttnpb.OrganizationOrUserIdentifiers]*ttnpb.Rights, error)
- func (s *CombinedStore) FindMemberships(ctx context.Context, accountID *ttnpb.OrganizationOrUserIdentifiers, ...) ([]*ttnpb.EntityIdentifiers, error)
- func (s *CombinedStore) FindOrganizations(ctx context.Context, ids []*ttnpb.OrganizationIdentifiers, ...) ([]*ttnpb.Organization, error)
- func (s *CombinedStore) FindSessions(ctx context.Context, userIDs *ttnpb.UserIdentifiers) ([]*ttnpb.UserSession, error)
- func (s *CombinedStore) FindUsers(ctx context.Context, ids []*ttnpb.UserIdentifiers, fieldMask store.FieldMask) ([]*ttnpb.User, error)
- func (s *CombinedStore) GetAPIKey(ctx context.Context, entityID *ttnpb.EntityIdentifiers, id string) (*ttnpb.APIKey, error)
- func (s *CombinedStore) GetAPIKeyByID(ctx context.Context, id string) (*ttnpb.EntityIdentifiers, *ttnpb.APIKey, error)
- func (s *CombinedStore) GetAccessToken(ctx context.Context, id string) (*ttnpb.OAuthAccessToken, error)
- func (s *CombinedStore) GetApplication(ctx context.Context, id *ttnpb.ApplicationIdentifiers, ...) (*ttnpb.Application, error)
- func (s *CombinedStore) GetAuthorization(ctx context.Context, userIDs *ttnpb.UserIdentifiers, ...) (*ttnpb.OAuthClientAuthorization, error)
- func (s *CombinedStore) GetAuthorizationCode(ctx context.Context, code string) (*ttnpb.OAuthAuthorizationCode, error)
- func (s *CombinedStore) GetClient(ctx context.Context, id *ttnpb.ClientIdentifiers, fieldMask store.FieldMask) (*ttnpb.Client, error)
- func (s *CombinedStore) GetContactInfo(ctx context.Context, entityID ttnpb.IDStringer) ([]*ttnpb.ContactInfo, error)
- func (s *CombinedStore) GetEndDevice(ctx context.Context, id *ttnpb.EndDeviceIdentifiers, fieldMask store.FieldMask) (*ttnpb.EndDevice, error)
- func (s *CombinedStore) GetGateway(ctx context.Context, id *ttnpb.GatewayIdentifiers, fieldMask store.FieldMask) (*ttnpb.Gateway, error)
- func (s *CombinedStore) GetInvitation(ctx context.Context, token string) (*ttnpb.Invitation, error)
- func (s *CombinedStore) GetMember(ctx context.Context, id *ttnpb.OrganizationOrUserIdentifiers, ...) (*ttnpb.Rights, error)
- func (s *CombinedStore) GetOrganization(ctx context.Context, id *ttnpb.OrganizationIdentifiers, ...) (*ttnpb.Organization, error)
- func (s *CombinedStore) GetSession(ctx context.Context, userIDs *ttnpb.UserIdentifiers, sessionID string) (*ttnpb.UserSession, error)
- func (s *CombinedStore) GetSessionByID(ctx context.Context, sessionID string) (*ttnpb.UserSession, error)
- func (s *CombinedStore) GetUser(ctx context.Context, id *ttnpb.UserIdentifiers, fieldMask store.FieldMask) (*ttnpb.User, error)
- func (s *CombinedStore) GetUserByPrimaryEmailAddress(ctx context.Context, email string, fieldMask store.FieldMask) (*ttnpb.User, error)
- func (s *CombinedStore) IssueDevEUIForApplication(ctx context.Context, ids *ttnpb.ApplicationIdentifiers, applicationLimit int) (*types.EUI64, error)
- func (s *CombinedStore) ListAccessTokens(ctx context.Context, userIDs *ttnpb.UserIdentifiers, ...) ([]*ttnpb.OAuthAccessToken, error)
- func (s *CombinedStore) ListAdmins(ctx context.Context, fieldMask store.FieldMask) ([]*ttnpb.User, error)
- func (s *CombinedStore) ListAuthorizations(ctx context.Context, userIDs *ttnpb.UserIdentifiers) ([]*ttnpb.OAuthClientAuthorization, error)
- func (s *CombinedStore) ListEndDevices(ctx context.Context, ids *ttnpb.ApplicationIdentifiers, ...) ([]*ttnpb.EndDevice, error)
- func (s *CombinedStore) ListNotifications(ctx context.Context, receiverIDs *ttnpb.UserIdentifiers, ...) ([]*ttnpb.Notification, error)
- func (s *CombinedStore) PurgeApplication(ctx context.Context, id *ttnpb.ApplicationIdentifiers) error
- func (s *CombinedStore) PurgeClient(ctx context.Context, id *ttnpb.ClientIdentifiers) error
- func (s *CombinedStore) PurgeGateway(ctx context.Context, id *ttnpb.GatewayIdentifiers) error
- func (s *CombinedStore) PurgeOrganization(ctx context.Context, id *ttnpb.OrganizationIdentifiers) (err error)
- func (s *CombinedStore) PurgeUser(ctx context.Context, id *ttnpb.UserIdentifiers) (err error)
- func (s *CombinedStore) RestoreApplication(ctx context.Context, id *ttnpb.ApplicationIdentifiers) error
- func (s *CombinedStore) RestoreClient(ctx context.Context, id *ttnpb.ClientIdentifiers) error
- func (s *CombinedStore) RestoreGateway(ctx context.Context, id *ttnpb.GatewayIdentifiers) error
- func (s *CombinedStore) RestoreOrganization(ctx context.Context, id *ttnpb.OrganizationIdentifiers) (err error)
- func (s *CombinedStore) RestoreUser(ctx context.Context, id *ttnpb.UserIdentifiers) (err error)
- func (s *CombinedStore) SearchApplications(ctx context.Context, member *ttnpb.OrganizationOrUserIdentifiers, ...) ([]*ttnpb.ApplicationIdentifiers, error)
- func (s *CombinedStore) SearchClients(ctx context.Context, member *ttnpb.OrganizationOrUserIdentifiers, ...) ([]*ttnpb.ClientIdentifiers, error)
- func (s *CombinedStore) SearchEndDevices(ctx context.Context, req *ttnpb.SearchEndDevicesRequest) ([]*ttnpb.EndDeviceIdentifiers, error)
- func (s *CombinedStore) SearchGateways(ctx context.Context, member *ttnpb.OrganizationOrUserIdentifiers, ...) ([]*ttnpb.GatewayIdentifiers, error)
- func (s *CombinedStore) SearchOrganizations(ctx context.Context, member *ttnpb.OrganizationOrUserIdentifiers, ...) ([]*ttnpb.OrganizationIdentifiers, error)
- func (s *CombinedStore) SearchUsers(ctx context.Context, req *ttnpb.SearchUsersRequest) ([]*ttnpb.UserIdentifiers, error)
- func (s *CombinedStore) SetContactInfo(ctx context.Context, entityID ttnpb.IDStringer, pb []*ttnpb.ContactInfo) ([]*ttnpb.ContactInfo, error)
- func (s *CombinedStore) SetInvitationAcceptedBy(ctx context.Context, token string, acceptedByID *ttnpb.UserIdentifiers) error
- func (s *CombinedStore) SetMember(ctx context.Context, id *ttnpb.OrganizationOrUserIdentifiers, ...) error
- func (s *CombinedStore) Transact(ctx context.Context, fc func(context.Context, store.Store) error) (err error)
- func (s *CombinedStore) UpdateAPIKey(ctx context.Context, entityID *ttnpb.EntityIdentifiers, key *ttnpb.APIKey, ...) (*ttnpb.APIKey, error)
- func (s *CombinedStore) UpdateApplication(ctx context.Context, app *ttnpb.Application, fieldMask store.FieldMask) (updated *ttnpb.Application, err error)
- func (s *CombinedStore) UpdateClient(ctx context.Context, cli *ttnpb.Client, fieldMask store.FieldMask) (updated *ttnpb.Client, err error)
- func (s *CombinedStore) UpdateEndDevice(ctx context.Context, dev *ttnpb.EndDevice, fieldMask store.FieldMask) (updated *ttnpb.EndDevice, err error)
- func (s *CombinedStore) UpdateGateway(ctx context.Context, gtw *ttnpb.Gateway, fieldMask store.FieldMask) (updated *ttnpb.Gateway, err error)
- func (s *CombinedStore) UpdateNotificationStatus(ctx context.Context, receiverIDs *ttnpb.UserIdentifiers, ...) error
- func (s *CombinedStore) UpdateOrganization(ctx context.Context, org *ttnpb.Organization, fieldMask store.FieldMask) (updated *ttnpb.Organization, err error)
- func (s *CombinedStore) UpdateUser(ctx context.Context, usr *ttnpb.User, fieldMask store.FieldMask) (updated *ttnpb.User, err error)
- func (s *CombinedStore) Validate(ctx context.Context, validation *ttnpb.ContactInfoValidation) error
- type ContactInfo
- type ContactInfoValidation
- type EUI64
- type EUIBlock
- type EndDevice
- type EndDeviceLocation
- type Gateway
- type GatewayAntenna
- type Grants
- type Invitation
- type Location
- type LoginToken
- type Membership
- type Model
- type Notification
- type NotificationReceiver
- type Organization
- type Picture
- type Rights
- type SoftDelete
- type User
- type UserSession
Constants ¶
This section is empty.
Variables ¶
var ErrTransactionRecovered = errors.DefineInternal("transaction_recovered", "Internal Server Error")
ErrTransactionRecovered is returned when a panic is caught from a SQL transaction.
Functions ¶
func GetAPIKeyStore ¶
func GetAPIKeyStore(db *gorm.DB) store.APIKeyStore
GetAPIKeyStore returns an APIKeyStore on the given db (or transaction).
func GetApplicationStore ¶
func GetApplicationStore(db *gorm.DB) store.ApplicationStore
GetApplicationStore returns an ApplicationStore on the given db (or transaction).
func GetClientStore ¶
func GetClientStore(db *gorm.DB) store.ClientStore
GetClientStore returns an ClientStore on the given db (or transaction).
func GetContactInfoStore ¶
func GetContactInfoStore(db *gorm.DB) store.ContactInfoStore
GetContactInfoStore returns an ContactInfoStore on the given db (or transaction).
func GetEUIStore ¶
GetEUIStore returns an EUIStore on the given db (or transaction).
func GetEndDeviceStore ¶
func GetEndDeviceStore(db *gorm.DB) store.EndDeviceStore
GetEndDeviceStore returns an EndDeviceStore on the given db (or transaction).
func GetEntitySearch ¶
func GetEntitySearch(db *gorm.DB) store.EntitySearch
GetEntitySearch returns an EntitySearch on the given db (or transaction).
func GetGatewayStore ¶
func GetGatewayStore(db *gorm.DB) store.GatewayStore
GetGatewayStore returns an GatewayStore on the given db (or transaction).
func GetInvitationStore ¶
func GetInvitationStore(db *gorm.DB) store.InvitationStore
GetInvitationStore returns an InvitationStore on the given db (or transaction).
func GetLoginTokenStore ¶
func GetLoginTokenStore(db *gorm.DB) store.LoginTokenStore
GetLoginTokenStore returns an LoginTokenStore on the given db (or transaction).
func GetMembershipStore ¶
func GetMembershipStore(db *gorm.DB) store.MembershipStore
GetMembershipStore returns an MembershipStore on the given db (or transaction).
func GetNotificationStore ¶ added in v3.19.0
func GetNotificationStore(db *gorm.DB) store.NotificationStore
GetNotificationStore returns an NotificationStore on the given db (or transaction).
func GetOAuthStore ¶
func GetOAuthStore(db *gorm.DB) store.OAuthStore
GetOAuthStore returns an OAuthStore on the given db (or transaction).
func GetOrganizationStore ¶
func GetOrganizationStore(db *gorm.DB) store.OrganizationStore
GetOrganizationStore returns an OrganizationStore on the given db (or transaction).
func GetUserSessionStore ¶
func GetUserSessionStore(db *gorm.DB) store.UserSessionStore
GetUserSessionStore returns an UserSessionStore on the given db (or transaction).
func GetUserStore ¶
GetUserStore returns an UserStore on the given db (or transaction).
Types ¶
type APIKey ¶
type APIKey struct { Model APIKeyID string `gorm:"type:VARCHAR;unique_index:api_key_id_index"` Key string `gorm:"type:VARCHAR"` Rights Rights `gorm:"type:INT ARRAY"` Name string `gorm:"type:VARCHAR"` EntityID string `gorm:"type:UUID;index:api_key_entity_index;not null"` EntityType string `gorm:"type:VARCHAR(32);index:api_key_entity_index;not null"` ExpiresAt *time.Time }
APIKey model.
type AccessToken ¶
type AccessToken struct { Model Client *Client ClientID string `gorm:"type:UUID;index;not null"` User *User UserID string `gorm:"type:UUID;index;not null"` UserSessionID *string `gorm:"type:UUID;index"` Rights Rights `gorm:"type:INT ARRAY"` TokenID string `gorm:"type:VARCHAR;unique_index:access_token_id_index;not null"` Previous *AccessToken `gorm:"foreignkey:PreviousID;association_foreignkey:TokenID"` PreviousID string `gorm:"type:VARCHAR;index:access_token_previous_index"` AccessToken string `gorm:"type:VARCHAR;not null"` RefreshToken string `gorm:"type:VARCHAR;not null"` ExpiresAt *time.Time }
AccessToken model.
type Account ¶
type Account struct { Model SoftDelete UID string `gorm:"type:VARCHAR(36);unique_index:account_uid_index"` AccountID string `gorm:"type:UUID;index:account_id_index;not null"` AccountType string `gorm:"type:VARCHAR(32);index:account_id_index;not null"` // user or organization Memberships []*Membership }
Account model.
func (Account) OrganizationOrUserIdentifiers ¶
func (a Account) OrganizationOrUserIdentifiers() *ttnpb.OrganizationOrUserIdentifiers
OrganizationOrUserIdentifiers for the account, depending on its type.
type Application ¶
type Application struct { Model SoftDelete // BEGIN common fields ApplicationID string `gorm:"unique_index:application_id_index;type:VARCHAR(36);not null"` Name string `gorm:"type:VARCHAR"` Description string `gorm:"type:TEXT"` Attributes []Attribute `gorm:"polymorphic:Entity;polymorphic_value:application"` APIKeys []APIKey `gorm:"polymorphic:Entity;polymorphic_value:application"` Memberships []Membership `gorm:"polymorphic:Entity;polymorphic_value:application"` AdministrativeContactID *string `gorm:"type:UUID;index"` AdministrativeContact *Account `gorm:"save_associations:false"` TechnicalContactID *string `gorm:"type:UUID;index"` TechnicalContact *Account `gorm:"save_associations:false"` NetworkServerAddress string `gorm:"type:VARCHAR"` ApplicationServerAddress string `gorm:"type:VARCHAR"` JoinServerAddress string `gorm:"type:VARCHAR"` DevEUICounter int `gorm:"<-:create;type:INT;default:'0';column:dev_eui_counter"` }
Application model.
type Attribute ¶
type Attribute struct { ID string `gorm:"type:UUID;primary_key;default:gen_random_uuid()"` EntityID string `gorm:"type:UUID;index:attribute_entity_index;not null"` EntityType string `gorm:"type:VARCHAR(32);index:attribute_entity_index;not null"` Key string `gorm:"type:VARCHAR"` Value string `gorm:"type:VARCHAR"` }
Attribute model.
type AuthorizationCode ¶
type AuthorizationCode struct { Model Client *Client ClientID string `gorm:"type:UUID;index;not null"` User *User UserID string `gorm:"type:UUID;index;not null"` UserSessionID *string `gorm:"type:UUID;index"` Rights Rights `gorm:"type:INT ARRAY"` Code string `gorm:"type:VARCHAR;unique_index:authorization_code_code_index;not null"` RedirectURI string `gorm:"type:VARCHAR;column:redirect_uri"` State string `gorm:"type:VARCHAR"` ExpiresAt *time.Time }
AuthorizationCode model.
type Client ¶
type Client struct { Model SoftDelete // BEGIN common fields ClientID string `gorm:"unique_index:client_id_index;type:VARCHAR(36);not null"` Name string `gorm:"type:VARCHAR"` Description string `gorm:"type:TEXT"` Attributes []Attribute `gorm:"polymorphic:Entity;polymorphic_value:client"` Memberships []Membership `gorm:"polymorphic:Entity;polymorphic_value:client"` AdministrativeContactID *string `gorm:"type:UUID;index"` AdministrativeContact *Account `gorm:"save_associations:false"` TechnicalContactID *string `gorm:"type:UUID;index"` TechnicalContact *Account `gorm:"save_associations:false"` ClientSecret string `gorm:"type:VARCHAR"` RedirectURIs pq.StringArray `gorm:"type:VARCHAR ARRAY;column:redirect_uris"` LogoutRedirectURIs pq.StringArray `gorm:"type:VARCHAR ARRAY;column:logout_redirect_uris"` State int `gorm:"not null"` StateDescription string `gorm:"type:VARCHAR"` SkipAuthorization bool `gorm:"not null"` Endorsed bool `gorm:"not null"` Grants Grants `gorm:"type:INT ARRAY"` Rights Rights `gorm:"type:INT ARRAY"` }
Client model.
type ClientAuthorization ¶
type ClientAuthorization struct { Model Client *Client ClientID string `gorm:"type:UUID;index;not null"` User *User UserID string `gorm:"type:UUID;index;not null"` Rights Rights `gorm:"type:INT ARRAY"` }
ClientAuthorization model. Is also embedded by other OAuth models.
type CombinedStore ¶ added in v3.18.1
CombinedStore combines all stores to implement the store.TransactionalStore interface.
func NewCombinedStore ¶ added in v3.18.1
func NewCombinedStore(db *gorm.DB) *CombinedStore
NewCombinedStore returns a new store that implements store.TransactionalStore.
func (*CombinedStore) Authorize ¶ added in v3.18.1
func (s *CombinedStore) Authorize( ctx context.Context, authorization *ttnpb.OAuthClientAuthorization, ) (*ttnpb.OAuthClientAuthorization, error)
func (*CombinedStore) BatchUpdateEndDeviceLastSeen ¶ added in v3.19.0
func (s *CombinedStore) BatchUpdateEndDeviceLastSeen( ctx context.Context, devsLastSeen []*ttnpb.BatchUpdateEndDeviceLastSeenRequest_EndDeviceLastSeenUpdate, ) error
func (*CombinedStore) ConsumeLoginToken ¶ added in v3.18.1
func (*CombinedStore) CountEndDevices ¶ added in v3.18.1
func (*CombinedStore) CreateAPIKey ¶ added in v3.18.1
func (*CombinedStore) CreateAccessToken ¶ added in v3.18.1
func (s *CombinedStore) CreateAccessToken( ctx context.Context, token *ttnpb.OAuthAccessToken, previousID string, ) (*ttnpb.OAuthAccessToken, error)
func (*CombinedStore) CreateApplication ¶ added in v3.18.1
func (s *CombinedStore) CreateApplication(ctx context.Context, app *ttnpb.Application) (*ttnpb.Application, error)
func (*CombinedStore) CreateAuthorizationCode ¶ added in v3.18.1
func (s *CombinedStore) CreateAuthorizationCode( ctx context.Context, code *ttnpb.OAuthAuthorizationCode, ) (*ttnpb.OAuthAuthorizationCode, error)
func (*CombinedStore) CreateClient ¶ added in v3.18.1
func (*CombinedStore) CreateEUIBlock ¶ added in v3.18.1
func (s *CombinedStore) CreateEUIBlock( ctx context.Context, prefix types.EUI64Prefix, initCounter int64, euiType string, ) error
CreateUIBlock creates the block of appropriate type in IS db.
func (*CombinedStore) CreateEndDevice ¶ added in v3.18.1
func (*CombinedStore) CreateGateway ¶ added in v3.18.1
func (*CombinedStore) CreateInvitation ¶ added in v3.18.1
func (s *CombinedStore) CreateInvitation( ctx context.Context, invitation *ttnpb.Invitation, ) (*ttnpb.Invitation, error)
func (*CombinedStore) CreateLoginToken ¶ added in v3.18.1
func (s *CombinedStore) CreateLoginToken( ctx context.Context, loginToken *ttnpb.LoginToken, ) (*ttnpb.LoginToken, error)
func (*CombinedStore) CreateNotification ¶ added in v3.19.0
func (s *CombinedStore) CreateNotification( ctx context.Context, pb *ttnpb.Notification, receiverIDs []*ttnpb.UserIdentifiers, ) (*ttnpb.Notification, error)
func (*CombinedStore) CreateOrganization ¶ added in v3.18.1
func (s *CombinedStore) CreateOrganization( ctx context.Context, org *ttnpb.Organization, ) (*ttnpb.Organization, error)
func (*CombinedStore) CreateSession ¶ added in v3.18.1
func (s *CombinedStore) CreateSession(ctx context.Context, sess *ttnpb.UserSession) (*ttnpb.UserSession, error)
func (*CombinedStore) CreateUser ¶ added in v3.18.1
func (*CombinedStore) CreateValidation ¶ added in v3.18.1
func (s *CombinedStore) CreateValidation( ctx context.Context, validation *ttnpb.ContactInfoValidation, ) (*ttnpb.ContactInfoValidation, error)
func (*CombinedStore) DeleteAccessToken ¶ added in v3.18.1
func (*CombinedStore) DeleteAccountMembers ¶ added in v3.18.1
func (s *CombinedStore) DeleteAccountMembers(ctx context.Context, id *ttnpb.OrganizationOrUserIdentifiers) error
func (*CombinedStore) DeleteAllUserSessions ¶ added in v3.18.1
func (s *CombinedStore) DeleteAllUserSessions(ctx context.Context, userIDs *ttnpb.UserIdentifiers) error
func (*CombinedStore) DeleteApplication ¶ added in v3.18.1
func (s *CombinedStore) DeleteApplication(ctx context.Context, id *ttnpb.ApplicationIdentifiers) error
func (*CombinedStore) DeleteAuthorization ¶ added in v3.18.1
func (s *CombinedStore) DeleteAuthorization( ctx context.Context, userIDs *ttnpb.UserIdentifiers, clientIDs *ttnpb.ClientIdentifiers, ) error
func (*CombinedStore) DeleteAuthorizationCode ¶ added in v3.18.1
func (*CombinedStore) DeleteClient ¶ added in v3.18.1
func (s *CombinedStore) DeleteClient(ctx context.Context, id *ttnpb.ClientIdentifiers) error
func (*CombinedStore) DeleteClientAuthorizations ¶ added in v3.18.1
func (s *CombinedStore) DeleteClientAuthorizations(ctx context.Context, clientIDs *ttnpb.ClientIdentifiers) error
func (*CombinedStore) DeleteEndDevice ¶ added in v3.18.1
func (s *CombinedStore) DeleteEndDevice(ctx context.Context, id *ttnpb.EndDeviceIdentifiers) error
func (*CombinedStore) DeleteEntityAPIKeys ¶ added in v3.18.1
func (s *CombinedStore) DeleteEntityAPIKeys(ctx context.Context, entityID *ttnpb.EntityIdentifiers) error
func (*CombinedStore) DeleteEntityContactInfo ¶ added in v3.18.1
func (s *CombinedStore) DeleteEntityContactInfo(ctx context.Context, entityID ttnpb.IDStringer) error
func (*CombinedStore) DeleteEntityMembers ¶ added in v3.18.1
func (s *CombinedStore) DeleteEntityMembers(ctx context.Context, entityID *ttnpb.EntityIdentifiers) error
func (*CombinedStore) DeleteGateway ¶ added in v3.18.1
func (s *CombinedStore) DeleteGateway(ctx context.Context, id *ttnpb.GatewayIdentifiers) error
func (*CombinedStore) DeleteInvitation ¶ added in v3.18.1
func (*CombinedStore) DeleteOrganization ¶ added in v3.18.1
func (s *CombinedStore) DeleteOrganization(ctx context.Context, id *ttnpb.OrganizationIdentifiers) (err error)
func (*CombinedStore) DeleteSession ¶ added in v3.18.1
func (*CombinedStore) DeleteUser ¶ added in v3.18.1
func (s *CombinedStore) DeleteUser(ctx context.Context, id *ttnpb.UserIdentifiers) (err error)
func (*CombinedStore) DeleteUserAuthorizations ¶ added in v3.18.1
func (s *CombinedStore) DeleteUserAuthorizations(ctx context.Context, userIDs *ttnpb.UserIdentifiers) error
func (*CombinedStore) FindAPIKeys ¶ added in v3.18.1
func (*CombinedStore) FindAccountMembershipChains ¶ added in v3.18.1
func (s *CombinedStore) FindAccountMembershipChains( ctx context.Context, accountID *ttnpb.OrganizationOrUserIdentifiers, entityType string, entityIDs ...string, ) ([]*store.MembershipChain, error)
func (*CombinedStore) FindActiveLoginTokens ¶ added in v3.18.1
func (s *CombinedStore) FindActiveLoginTokens( ctx context.Context, userIDs *ttnpb.UserIdentifiers, ) ([]*ttnpb.LoginToken, error)
func (*CombinedStore) FindApplications ¶ added in v3.18.1
func (s *CombinedStore) FindApplications( ctx context.Context, ids []*ttnpb.ApplicationIdentifiers, fieldMask store.FieldMask, ) ([]*ttnpb.Application, error)
func (*CombinedStore) FindClients ¶ added in v3.18.1
func (*CombinedStore) FindEndDevices ¶ added in v3.18.1
func (*CombinedStore) FindGateways ¶ added in v3.18.1
func (*CombinedStore) FindInvitations ¶ added in v3.18.1
func (s *CombinedStore) FindInvitations(ctx context.Context) ([]*ttnpb.Invitation, error)
func (*CombinedStore) FindMembers ¶ added in v3.18.1
func (s *CombinedStore) FindMembers( ctx context.Context, entityID *ttnpb.EntityIdentifiers, ) (map[*ttnpb.OrganizationOrUserIdentifiers]*ttnpb.Rights, error)
func (*CombinedStore) FindMemberships ¶ added in v3.18.1
func (s *CombinedStore) FindMemberships( ctx context.Context, accountID *ttnpb.OrganizationOrUserIdentifiers, entityType string, includeIndirect bool, ) ([]*ttnpb.EntityIdentifiers, error)
func (*CombinedStore) FindOrganizations ¶ added in v3.18.1
func (s *CombinedStore) FindOrganizations( ctx context.Context, ids []*ttnpb.OrganizationIdentifiers, fieldMask store.FieldMask, ) ([]*ttnpb.Organization, error)
func (*CombinedStore) FindSessions ¶ added in v3.18.1
func (s *CombinedStore) FindSessions( ctx context.Context, userIDs *ttnpb.UserIdentifiers, ) ([]*ttnpb.UserSession, error)
func (*CombinedStore) GetAPIKeyByID ¶ added in v3.19.2
func (*CombinedStore) GetAccessToken ¶ added in v3.18.1
func (*CombinedStore) GetApplication ¶ added in v3.18.1
func (s *CombinedStore) GetApplication( ctx context.Context, id *ttnpb.ApplicationIdentifiers, fieldMask store.FieldMask, ) (*ttnpb.Application, error)
func (*CombinedStore) GetAuthorization ¶ added in v3.18.1
func (s *CombinedStore) GetAuthorization( ctx context.Context, userIDs *ttnpb.UserIdentifiers, clientIDs *ttnpb.ClientIdentifiers, ) (*ttnpb.OAuthClientAuthorization, error)
func (*CombinedStore) GetAuthorizationCode ¶ added in v3.18.1
func (*CombinedStore) GetContactInfo ¶ added in v3.18.1
func (s *CombinedStore) GetContactInfo( ctx context.Context, entityID ttnpb.IDStringer, ) ([]*ttnpb.ContactInfo, error)
func (*CombinedStore) GetEndDevice ¶ added in v3.18.1
func (*CombinedStore) GetGateway ¶ added in v3.18.1
func (*CombinedStore) GetInvitation ¶ added in v3.18.1
func (*CombinedStore) GetMember ¶ added in v3.18.1
func (s *CombinedStore) GetMember( ctx context.Context, id *ttnpb.OrganizationOrUserIdentifiers, entityID *ttnpb.EntityIdentifiers, ) (*ttnpb.Rights, error)
func (*CombinedStore) GetOrganization ¶ added in v3.18.1
func (s *CombinedStore) GetOrganization( ctx context.Context, id *ttnpb.OrganizationIdentifiers, fieldMask store.FieldMask, ) (*ttnpb.Organization, error)
func (*CombinedStore) GetSession ¶ added in v3.18.1
func (s *CombinedStore) GetSession( ctx context.Context, userIDs *ttnpb.UserIdentifiers, sessionID string, ) (*ttnpb.UserSession, error)
func (*CombinedStore) GetSessionByID ¶ added in v3.18.1
func (*CombinedStore) GetUserByPrimaryEmailAddress ¶ added in v3.18.1
func (*CombinedStore) IssueDevEUIForApplication ¶ added in v3.18.1
func (s *CombinedStore) IssueDevEUIForApplication( ctx context.Context, ids *ttnpb.ApplicationIdentifiers, applicationLimit int, ) (*types.EUI64, error)
IssueDevEUIForApplication issues DevEUI address from the configured DevEUI block.
func (*CombinedStore) ListAccessTokens ¶ added in v3.18.1
func (s *CombinedStore) ListAccessTokens( ctx context.Context, userIDs *ttnpb.UserIdentifiers, clientIDs *ttnpb.ClientIdentifiers, ) ([]*ttnpb.OAuthAccessToken, error)
func (*CombinedStore) ListAdmins ¶ added in v3.18.1
func (*CombinedStore) ListAuthorizations ¶ added in v3.18.1
func (s *CombinedStore) ListAuthorizations( ctx context.Context, userIDs *ttnpb.UserIdentifiers, ) ([]*ttnpb.OAuthClientAuthorization, error)
func (*CombinedStore) ListEndDevices ¶ added in v3.18.1
func (*CombinedStore) ListNotifications ¶ added in v3.19.0
func (s *CombinedStore) ListNotifications( ctx context.Context, receiverIDs *ttnpb.UserIdentifiers, statuses []ttnpb.NotificationStatus, ) ([]*ttnpb.Notification, error)
func (*CombinedStore) PurgeApplication ¶ added in v3.18.1
func (s *CombinedStore) PurgeApplication(ctx context.Context, id *ttnpb.ApplicationIdentifiers) error
func (*CombinedStore) PurgeClient ¶ added in v3.18.1
func (s *CombinedStore) PurgeClient(ctx context.Context, id *ttnpb.ClientIdentifiers) error
func (*CombinedStore) PurgeGateway ¶ added in v3.18.1
func (s *CombinedStore) PurgeGateway(ctx context.Context, id *ttnpb.GatewayIdentifiers) error
func (*CombinedStore) PurgeOrganization ¶ added in v3.18.1
func (s *CombinedStore) PurgeOrganization(ctx context.Context, id *ttnpb.OrganizationIdentifiers) (err error)
func (*CombinedStore) PurgeUser ¶ added in v3.18.1
func (s *CombinedStore) PurgeUser(ctx context.Context, id *ttnpb.UserIdentifiers) (err error)
func (*CombinedStore) RestoreApplication ¶ added in v3.18.1
func (s *CombinedStore) RestoreApplication(ctx context.Context, id *ttnpb.ApplicationIdentifiers) error
func (*CombinedStore) RestoreClient ¶ added in v3.18.1
func (s *CombinedStore) RestoreClient(ctx context.Context, id *ttnpb.ClientIdentifiers) error
func (*CombinedStore) RestoreGateway ¶ added in v3.18.1
func (s *CombinedStore) RestoreGateway(ctx context.Context, id *ttnpb.GatewayIdentifiers) error
func (*CombinedStore) RestoreOrganization ¶ added in v3.18.1
func (s *CombinedStore) RestoreOrganization(ctx context.Context, id *ttnpb.OrganizationIdentifiers) (err error)
func (*CombinedStore) RestoreUser ¶ added in v3.18.1
func (s *CombinedStore) RestoreUser(ctx context.Context, id *ttnpb.UserIdentifiers) (err error)
func (*CombinedStore) SearchApplications ¶ added in v3.18.1
func (s *CombinedStore) SearchApplications( ctx context.Context, member *ttnpb.OrganizationOrUserIdentifiers, req *ttnpb.SearchApplicationsRequest, ) ([]*ttnpb.ApplicationIdentifiers, error)
func (*CombinedStore) SearchClients ¶ added in v3.18.1
func (s *CombinedStore) SearchClients( ctx context.Context, member *ttnpb.OrganizationOrUserIdentifiers, req *ttnpb.SearchClientsRequest, ) ([]*ttnpb.ClientIdentifiers, error)
func (*CombinedStore) SearchEndDevices ¶ added in v3.18.1
func (s *CombinedStore) SearchEndDevices( ctx context.Context, req *ttnpb.SearchEndDevicesRequest, ) ([]*ttnpb.EndDeviceIdentifiers, error)
func (*CombinedStore) SearchGateways ¶ added in v3.18.1
func (s *CombinedStore) SearchGateways( ctx context.Context, member *ttnpb.OrganizationOrUserIdentifiers, req *ttnpb.SearchGatewaysRequest, ) ([]*ttnpb.GatewayIdentifiers, error)
func (*CombinedStore) SearchOrganizations ¶ added in v3.18.1
func (s *CombinedStore) SearchOrganizations( ctx context.Context, member *ttnpb.OrganizationOrUserIdentifiers, req *ttnpb.SearchOrganizationsRequest, ) ([]*ttnpb.OrganizationIdentifiers, error)
func (*CombinedStore) SearchUsers ¶ added in v3.18.1
func (s *CombinedStore) SearchUsers( ctx context.Context, req *ttnpb.SearchUsersRequest, ) ([]*ttnpb.UserIdentifiers, error)
func (*CombinedStore) SetContactInfo ¶ added in v3.18.1
func (s *CombinedStore) SetContactInfo( ctx context.Context, entityID ttnpb.IDStringer, pb []*ttnpb.ContactInfo, ) ([]*ttnpb.ContactInfo, error)
func (*CombinedStore) SetInvitationAcceptedBy ¶ added in v3.18.1
func (*CombinedStore) SetMember ¶ added in v3.18.1
func (s *CombinedStore) SetMember( ctx context.Context, id *ttnpb.OrganizationOrUserIdentifiers, entityID *ttnpb.EntityIdentifiers, rights *ttnpb.Rights, ) error
func (*CombinedStore) Transact ¶ added in v3.18.1
func (s *CombinedStore) Transact(ctx context.Context, fc func(context.Context, store.Store) error) (err error)
Transact implements the store.TransactionalStore interface.
func (*CombinedStore) UpdateAPIKey ¶ added in v3.18.1
func (*CombinedStore) UpdateApplication ¶ added in v3.18.1
func (s *CombinedStore) UpdateApplication( ctx context.Context, app *ttnpb.Application, fieldMask store.FieldMask, ) (updated *ttnpb.Application, err error)
func (*CombinedStore) UpdateClient ¶ added in v3.18.1
func (*CombinedStore) UpdateEndDevice ¶ added in v3.18.1
func (*CombinedStore) UpdateGateway ¶ added in v3.18.1
func (*CombinedStore) UpdateNotificationStatus ¶ added in v3.19.0
func (s *CombinedStore) UpdateNotificationStatus( ctx context.Context, receiverIDs *ttnpb.UserIdentifiers, notificationIDs []string, status ttnpb.NotificationStatus, ) error
func (*CombinedStore) UpdateOrganization ¶ added in v3.18.1
func (s *CombinedStore) UpdateOrganization( ctx context.Context, org *ttnpb.Organization, fieldMask store.FieldMask, ) (updated *ttnpb.Organization, err error)
func (*CombinedStore) UpdateUser ¶ added in v3.18.1
type ContactInfo ¶
type ContactInfo struct { ID string `gorm:"type:UUID;primary_key;default:gen_random_uuid()"` ContactType int `gorm:"not null"` ContactMethod int `gorm:"not null"` Value string `gorm:"type:VARCHAR"` Public bool ValidatedAt *time.Time EntityID string `gorm:"type:UUID;index:contact_info_entity_index;not null"` EntityType string `gorm:"type:VARCHAR(32);index:contact_info_entity_index;not null"` }
ContactInfo model.
type ContactInfoValidation ¶
type ContactInfoValidation struct { Model Reference string `gorm:"type:VARCHAR;index:contact_info_validation_id_index"` Token string `gorm:"type:VARCHAR;index:contact_info_validation_id_index"` EntityID string `gorm:"type:UUID;index:contact_info_validation_entity_index;not null"` EntityType string `gorm:"type:VARCHAR(32);index:contact_info_validation_entity_index;not null"` ContactMethod int `gorm:"not null"` Value string `gorm:"type:VARCHAR"` Used bool ExpiresAt *time.Time }
ContactInfoValidation model.
type EUI64 ¶
EUI64 adds methods on a types.EUI64 so that it can be stored in an SQL database.
type EUIBlock ¶
type EUIBlock struct { Model Type string `gorm:"type:VARCHAR(10);"` StartEUI EUI64 `gorm:"type:VARCHAR(16);column:start_eui"` MaxCounter int64 `gorm:"type:BIGINT;column:end_counter"` CurrentCounter int64 `gorm:"type:BIGINT;column:current_counter"` }
EUIBlock is the model for a block of EUIs.
type EndDevice ¶
type EndDevice struct { Model ApplicationID string `gorm:"unique_index:end_device_id_index;type:VARCHAR(36);not null;index:end_device_application_index"` //nolint:lll Application *Application // BEGIN common fields DeviceID string `gorm:"unique_index:end_device_id_index;type:VARCHAR(36);not null"` Name string `gorm:"type:VARCHAR"` Description string `gorm:"type:TEXT"` Attributes []Attribute `gorm:"polymorphic:Entity;polymorphic_value:device"` JoinEUI *EUI64 `gorm:"unique_index:end_device_eui_index;index:end_device_join_eui_index;type:VARCHAR(16);column:join_eui"` //nolint:lll DevEUI *EUI64 `gorm:"unique_index:end_device_eui_index;index:end_device_dev_eui_index;type:VARCHAR(16);column:dev_eui"` //nolint:lll BrandID string `gorm:"type:VARCHAR"` ModelID string `gorm:"type:VARCHAR"` HardwareVersion string `gorm:"type:VARCHAR"` FirmwareVersion string `gorm:"type:VARCHAR"` BandID string `gorm:"type:VARCHAR"` NetworkServerAddress string `gorm:"type:VARCHAR"` ApplicationServerAddress string `gorm:"type:VARCHAR"` JoinServerAddress string `gorm:"type:VARCHAR"` ServiceProfileID string `gorm:"type:VARCHAR"` Locations []EndDeviceLocation Picture *Picture PictureID *string `gorm:"type:UUID;index:end_device_picture_index"` ActivatedAt *time.Time `gorm:"default:null"` LastSeenAt *time.Time `gorm:"default:null"` }
EndDevice model.
type EndDeviceLocation ¶
type EndDeviceLocation struct { Model EndDeviceID string `gorm:"type:UUID;unique_index:end_device_location_id_index;index:end_device_device_index;not null"` Service string `gorm:"unique_index:end_device_location_id_index"` Location Source int `gorm:"not null"` }
EndDeviceLocation model.
type Gateway ¶
type Gateway struct { Model SoftDelete GatewayEUI *EUI64 `gorm:"unique_index:gateway_eui_index;type:VARCHAR(16);column:gateway_eui"` // BEGIN common fields GatewayID string `gorm:"unique_index:gateway_id_index;type:VARCHAR(36);not null"` Name string `gorm:"type:VARCHAR"` Description string `gorm:"type:TEXT"` Attributes []Attribute `gorm:"polymorphic:Entity;polymorphic_value:gateway"` APIKeys []APIKey `gorm:"polymorphic:Entity;polymorphic_value:gateway"` Memberships []Membership `gorm:"polymorphic:Entity;polymorphic_value:gateway"` AdministrativeContactID *string `gorm:"type:UUID;index"` AdministrativeContact *Account `gorm:"save_associations:false"` TechnicalContactID *string `gorm:"type:UUID;index"` TechnicalContact *Account `gorm:"save_associations:false"` BrandID string `gorm:"type:VARCHAR"` ModelID string `gorm:"type:VARCHAR"` HardwareVersion string `gorm:"type:VARCHAR"` FirmwareVersion string `gorm:"type:VARCHAR"` GatewayServerAddress string `gorm:"type:VARCHAR"` AutoUpdate bool `gorm:"not null"` UpdateChannel string `gorm:"type:VARCHAR"` // Frequency Plan IDs separated by spaces. FrequencyPlanID string `gorm:"type:VARCHAR"` StatusPublic bool `gorm:"not null"` LocationPublic bool `gorm:"not null"` ScheduleDownlinkLate bool `gorm:"not null"` EnforceDutyCycle bool `gorm:"not null"` ScheduleAnytimeDelay int64 `gorm:"default:0 not null"` DownlinkPathConstraint int UpdateLocationFromStatus bool `gorm:"default:false not null"` Antennas []GatewayAntenna LBSLNSSecret []byte `gorm:"type:BYTEA;column:lbs_lns_secret"` ClaimAuthenticationCodeSecret []byte `gorm:"type:BYTEA"` ClaimAuthenticationCodeValidFrom *time.Time ClaimAuthenticationCodeValidTo *time.Time TargetCUPSURI string `gorm:"type:VARCHAR"` TargetCUPSKey []byte `gorm:"type:BYTEA"` RequireAuthenticatedConnection bool SupportsLRFHSS bool `gorm:"default:false not null"` DisablePacketBrokerForwarding bool `gorm:"default:false not null"` }
Gateway model.
type GatewayAntenna ¶
type GatewayAntenna struct { Model Gateway *Gateway GatewayID string `gorm:"type:UUID;unique_index:gateway_antenna_id_index;index:gateway_antenna_gateway_index;not null"` Index int `gorm:"unique_index:gateway_antenna_id_index;not null"` Attributes []Attribute `gorm:"polymorphic:Entity;polymorphic_value:gateway"` Gain float32 Location Placement int }
GatewayAntenna model.
type Grants ¶
Grants adds methods on a []ttnpb.GrantType so that it can be stored in an SQL database.
type Invitation ¶
type Invitation struct { Model Email string `gorm:"type:VARCHAR;unique_index:invitation_email_index;not null"` Token string `gorm:"type:VARCHAR;unique_index:invitation_token_index;not null"` ExpiresAt *time.Time AcceptedBy *User AcceptedByID *string `gorm:"type:UUID"` AcceptedAt *time.Time }
Invitation model.
type LoginToken ¶
type LoginToken struct { Model User *User UserID string `gorm:"type:UUID"` Token string `gorm:"type:VARCHAR;unique_index:login_token_index;not null"` ExpiresAt *time.Time Used bool }
LoginToken model.
type Membership ¶
type Membership struct { Model Account *Account AccountID string `gorm:"type:UUID;index:membership_account_index;not null"` Rights Rights `gorm:"type:INT ARRAY"` EntityID string `gorm:"type:UUID;index:membership_entity_index;not null"` EntityType string `gorm:"type:VARCHAR(32);index:membership_entity_index;not null"` }
Membership model.
type Model ¶
type Model struct { ID string `gorm:"type:UUID;primary_key;default:gen_random_uuid()"` CreatedAt time.Time `gorm:"not null"` UpdatedAt time.Time `gorm:"not null"` // contains filtered or unexported fields }
Model is the base of database models.
func (Model) PrimaryKey ¶
PrimaryKey returns the primary key of the model.
func (*Model) SetContext ¶
SetContext needs to be called before creating models.
type Notification ¶ added in v3.19.0
type Notification struct { Model EntityID string `gorm:"type:UUID;index:notification_entity_index;not null"` EntityType string `gorm:"type:VARCHAR(32);index:notification_entity_index;not null"` // EntityUID is a copy of the human-readable entity ID, so that we can keep notifications for deleted entities. EntityUID string `gorm:"type:VARCHAR(36);not null"` NotificationType string `gorm:"not null"` Data postgres.Jsonb `gorm:"type:JSONB"` SenderID *string `gorm:"type:UUID;index:notification_sender_index"` // SenderUID is a copy of the human-readable sender ID, so that we can keep notifications for deleted senders. SenderUID string `gorm:"type:VARCHAR(36);not null"` Receivers pq.Int32Array `gorm:"type:INT ARRAY"` Email bool `gorm:"not null"` }
Notification model.
type NotificationReceiver ¶ added in v3.19.0
type NotificationReceiver struct { Notification *Notification NotificationID string `gorm:"type:UUID;unique_index:notification_receiver_index;index:notification_receiver_notification_id_index;not null"` //nolint:lll Receiver *User ReceiverID string `gorm:"type:UUID;unique_index:notification_receiver_index;index:notification_receiver_user_index;not null"` //nolint:lll Status int32 `gorm:"not null"` StatusUpdatedAt time.Time `gorm:"not null"` }
NotificationReceiver model.
type Organization ¶
type Organization struct { Model SoftDelete Account Account `gorm:"polymorphic:Account;polymorphic_value:organization"` // BEGIN common fields Name string `gorm:"type:VARCHAR"` Description string `gorm:"type:TEXT"` Attributes []Attribute `gorm:"polymorphic:Entity;polymorphic_value:organization"` APIKeys []APIKey `gorm:"polymorphic:Entity;polymorphic_value:organization"` Memberships []Membership `gorm:"polymorphic:Entity;polymorphic_value:organization"` AdministrativeContactID *string `gorm:"type:UUID;index"` AdministrativeContact *Account `gorm:"save_associations:false"` TechnicalContactID *string `gorm:"type:UUID;index"` TechnicalContact *Account `gorm:"save_associations:false"` }
Organization model.
func (*Organization) SetContext ¶
func (org *Organization) SetContext(ctx context.Context)
SetContext sets the context on the organization model and the embedded account model.
type Picture ¶
type Picture struct { Model SoftDelete // Filter on deleted_at not being NULL to clean up storage bucket. Data []byte `gorm:"type:BYTEA"` }
Picture model.
type Rights ¶
Rights adds methods on a ttnpb.Rights so that it can be stored in an SQL database.
type SoftDelete ¶
SoftDelete makes a Delete operation set a DeletedAt instead of actually deleting the model.
type User ¶
type User struct { Model SoftDelete Account Account `gorm:"polymorphic:Account;polymorphic_value:user"` // BEGIN common fields Name string `gorm:"type:VARCHAR"` Description string `gorm:"type:TEXT"` Attributes []Attribute `gorm:"polymorphic:Entity;polymorphic_value:user"` APIKeys []APIKey `gorm:"polymorphic:Entity;polymorphic_value:user"` Sessions []*UserSession PrimaryEmailAddress string `gorm:"type:VARCHAR;not null;unique_index"` PrimaryEmailAddressValidatedAt *time.Time // should be cleared when email changes Password string `gorm:"type:VARCHAR;not null"` // this is the hash PasswordUpdatedAt time.Time `gorm:"not null"` RequirePasswordUpdate bool `gorm:"not null"` State int `gorm:"not null"` StateDescription string `gorm:"type:VARCHAR"` Admin bool `gorm:"not null"` TemporaryPassword string `gorm:"type:VARCHAR"` TemporaryPasswordCreatedAt *time.Time TemporaryPasswordExpiresAt *time.Time ProfilePicture *Picture ProfilePictureID *string `gorm:"type:UUID;index:user_profile_picture_index"` }
User model.
func (*User) SetContext ¶
SetContext sets the context on both the Model and Account.
Source Files ¶
- account.go
- api_key.go
- api_key_store.go
- application.go
- application_store.go
- attribute.go
- attribute_store.go
- client.go
- client_store.go
- contact_info.go
- contact_info_store.go
- contact_info_validation.go
- end_device.go
- end_device_location.go
- end_device_location_store.go
- end_device_store.go
- entity_search.go
- eui_block.go
- eui_block_store.go
- fieldmask_paths.go
- gateway.go
- gateway_antenna.go
- gateway_antenna_store.go
- gateway_store.go
- hooks.go
- invitation.go
- invitation_store.go
- login_token.go
- login_token_store.go
- membership.go
- membership_store.go
- model.go
- model_context.go
- notification.go
- notification_store.go
- oauth.go
- oauth_store.go
- organization.go
- organization_store.go
- picture.go
- registry.go
- scope.go
- soft_delete.go
- store.go
- types.go
- user.go
- user_session.go
- user_session_store.go
- user_store.go