Documentation ¶
Overview ¶
Package store implements the Identity Server store interfaces using the bun library.
Index ¶
- func Clear(ctx context.Context, db *bun.DB) error
- func Initialize(ctx context.Context, db *bun.DB, dbName string) error
- func Migrate(ctx context.Context, db *bun.DB) error
- func Open(ctx context.Context, dsn string) (*bun.DB, error)
- type APIKey
- type AccessToken
- type Account
- type Application
- type Attribute
- type AttributeSlice
- type AuthorizationCode
- type Client
- type ClientAuthorization
- type ContactInfo
- type ContactInfoSlice
- type ContactInfoValidation
- type DBMetadata
- type EUIBlock
- type EmbeddedAccount
- type EndDevice
- type EndDeviceLocation
- type EndDeviceLocationSlice
- type Gateway
- type GatewayAntenna
- type GatewayAntennaSlice
- type Invitation
- type Location
- type LoginToken
- type Membership
- type Model
- type Notification
- type NotificationReceiver
- type Organization
- type Picture
- type SoftDelete
- type Store
- func (s Store) Authorize(ctx context.Context, pb *ttnpb.OAuthClientAuthorization) (authorization *ttnpb.OAuthClientAuthorization, err error)
- func (s Store) BatchDeleteEndDevices(ctx context.Context, appIDs *ttnpb.ApplicationIdentifiers, deviceIDs []string) ([]*ttnpb.EndDeviceIdentifiers, error)
- func (s Store) BatchUpdateEndDeviceLastSeen(ctx context.Context, ...) error
- func (s Store) ConsumeLoginToken(ctx context.Context, token string) (*ttnpb.LoginToken, error)
- func (s Store) CountApplications(ctx context.Context) (uint64, error)
- func (s Store) CountClients(ctx context.Context) (uint64, error)
- func (s Store) CountEndDevices(ctx context.Context, ids *ttnpb.ApplicationIdentifiers) (uint64, error)
- func (s Store) CountGateways(ctx context.Context) (uint64, error)
- func (s Store) CountMemberships(ctx context.Context, accountID *ttnpb.OrganizationOrUserIdentifiers, ...) (uint64, error)
- func (s Store) CountOrganizations(ctx context.Context) (uint64, error)
- func (s Store) CountUsers(ctx context.Context) (uint64, error)
- func (s Store) CreateAPIKey(ctx context.Context, entityID *ttnpb.EntityIdentifiers, pb *ttnpb.APIKey) (*ttnpb.APIKey, error)
- func (s Store) CreateAccessToken(ctx context.Context, pb *ttnpb.OAuthAccessToken, previousID string) (*ttnpb.OAuthAccessToken, error)
- func (s Store) CreateApplication(ctx context.Context, pb *ttnpb.Application) (*ttnpb.Application, error)
- func (s Store) CreateAuthorizationCode(ctx context.Context, pb *ttnpb.OAuthAuthorizationCode) (*ttnpb.OAuthAuthorizationCode, error)
- func (s Store) CreateClient(ctx context.Context, pb *ttnpb.Client) (*ttnpb.Client, error)
- func (s Store) CreateEUIBlock(ctx context.Context, prefix types.EUI64Prefix, initCounter int64, ...) error
- func (s Store) CreateEndDevice(ctx context.Context, pb *ttnpb.EndDevice) (*ttnpb.EndDevice, error)
- func (s Store) CreateGateway(ctx context.Context, pb *ttnpb.Gateway) (*ttnpb.Gateway, error)
- func (s Store) CreateInvitation(ctx context.Context, pb *ttnpb.Invitation) (*ttnpb.Invitation, error)
- func (s Store) CreateLoginToken(ctx context.Context, pb *ttnpb.LoginToken) (*ttnpb.LoginToken, error)
- func (s Store) CreateNotification(ctx context.Context, pb *ttnpb.Notification, ...) (*ttnpb.Notification, error)
- func (s Store) CreateOrganization(ctx context.Context, pb *ttnpb.Organization) (*ttnpb.Organization, error)
- func (s Store) CreateSession(ctx context.Context, pb *ttnpb.UserSession) (*ttnpb.UserSession, error)
- func (s Store) CreateUser(ctx context.Context, pb *ttnpb.User) (*ttnpb.User, error)
- func (s Store) CreateValidation(ctx context.Context, pb *ttnpb.ContactInfoValidation) (*ttnpb.ContactInfoValidation, error)
- func (s Store) DeleteAPIKey(ctx context.Context, entityID *ttnpb.EntityIdentifiers, pb *ttnpb.APIKey) error
- func (s Store) DeleteAccessToken(ctx context.Context, id string) error
- func (s Store) DeleteAccountMembers(ctx context.Context, accountID *ttnpb.OrganizationOrUserIdentifiers) error
- func (s Store) DeleteAllUserSessions(ctx context.Context, userIDs *ttnpb.UserIdentifiers) error
- func (s Store) DeleteApplication(ctx context.Context, id *ttnpb.ApplicationIdentifiers) error
- func (s Store) DeleteAuthorization(ctx context.Context, userIDs *ttnpb.UserIdentifiers, ...) error
- func (s Store) DeleteAuthorizationCode(ctx context.Context, code string) error
- func (s Store) DeleteClient(ctx context.Context, id *ttnpb.ClientIdentifiers) error
- func (s Store) DeleteClientAuthorizations(ctx context.Context, clientIDs *ttnpb.ClientIdentifiers) error
- func (s Store) DeleteEndDevice(ctx context.Context, id *ttnpb.EndDeviceIdentifiers) error
- func (s Store) DeleteEntityAPIKeys(ctx context.Context, entityID *ttnpb.EntityIdentifiers) error
- func (s Store) DeleteEntityContactInfo(ctx context.Context, entityID ttnpb.IDStringer) error
- func (s Store) DeleteEntityMembers(ctx context.Context, entityID *ttnpb.EntityIdentifiers) error
- func (s Store) DeleteGateway(ctx context.Context, id *ttnpb.GatewayIdentifiers) error
- func (s Store) DeleteInvitation(ctx context.Context, email string) error
- func (s Store) DeleteMember(ctx context.Context, ids *ttnpb.OrganizationOrUserIdentifiers, ...) error
- func (s Store) DeleteOrganization(ctx context.Context, id *ttnpb.OrganizationIdentifiers) error
- func (s Store) DeleteSession(ctx context.Context, userIDs *ttnpb.UserIdentifiers, sessionID string) error
- func (s Store) DeleteUser(ctx context.Context, id *ttnpb.UserIdentifiers) error
- func (s Store) DeleteUserAuthorizations(ctx context.Context, userIDs *ttnpb.UserIdentifiers) error
- func (s Store) ExpireValidation(ctx context.Context, pb *ttnpb.ContactInfoValidation) error
- func (s Store) FindAPIKeys(ctx context.Context, entityID *ttnpb.EntityIdentifiers) ([]*ttnpb.APIKey, error)
- func (s Store) FindAccountMembershipChains(ctx context.Context, accountID *ttnpb.OrganizationOrUserIdentifiers, ...) ([]*store.MembershipChain, error)
- func (s Store) FindActiveLoginTokens(ctx context.Context, userIDs *ttnpb.UserIdentifiers) ([]*ttnpb.LoginToken, error)
- func (s Store) FindApplications(ctx context.Context, ids []*ttnpb.ApplicationIdentifiers, ...) ([]*ttnpb.Application, error)
- func (s Store) FindClients(ctx context.Context, ids []*ttnpb.ClientIdentifiers, fieldMask store.FieldMask) ([]*ttnpb.Client, error)
- func (s Store) FindEndDevices(ctx context.Context, ids []*ttnpb.EndDeviceIdentifiers, ...) ([]*ttnpb.EndDevice, error)
- func (s Store) FindGateways(ctx context.Context, ids []*ttnpb.GatewayIdentifiers, ...) ([]*ttnpb.Gateway, error)
- func (s Store) FindInvitations(ctx context.Context) ([]*ttnpb.Invitation, error)
- func (s Store) FindMembers(ctx context.Context, entityID *ttnpb.EntityIdentifiers) ([]*store.MemberByID, error)
- func (s Store) FindMemberships(ctx context.Context, accountID *ttnpb.OrganizationOrUserIdentifiers, ...) ([]*ttnpb.EntityIdentifiers, error)
- func (s Store) FindOrganizations(ctx context.Context, ids []*ttnpb.OrganizationIdentifiers, ...) ([]*ttnpb.Organization, error)
- func (s Store) FindSessions(ctx context.Context, userIDs *ttnpb.UserIdentifiers) ([]*ttnpb.UserSession, error)
- func (s Store) FindUsers(ctx context.Context, ids []*ttnpb.UserIdentifiers, fieldMask store.FieldMask) ([]*ttnpb.User, error)
- func (s Store) GetAPIKey(ctx context.Context, entityID *ttnpb.EntityIdentifiers, id string) (*ttnpb.APIKey, error)
- func (s Store) GetAPIKeyByID(ctx context.Context, id string) (*ttnpb.EntityIdentifiers, *ttnpb.APIKey, error)
- func (s Store) GetAccessToken(ctx context.Context, id string) (*ttnpb.OAuthAccessToken, error)
- func (s Store) GetApplication(ctx context.Context, id *ttnpb.ApplicationIdentifiers, ...) (*ttnpb.Application, error)
- func (s Store) GetAuthorization(ctx context.Context, userIDs *ttnpb.UserIdentifiers, ...) (*ttnpb.OAuthClientAuthorization, error)
- func (s Store) GetAuthorizationCode(ctx context.Context, code string) (*ttnpb.OAuthAuthorizationCode, error)
- func (s Store) GetClient(ctx context.Context, id *ttnpb.ClientIdentifiers, fieldMask store.FieldMask) (*ttnpb.Client, error)
- func (s Store) GetContactInfo(ctx context.Context, entityID ttnpb.IDStringer) ([]*ttnpb.ContactInfo, error)
- func (s Store) GetEndDevice(ctx context.Context, id *ttnpb.EndDeviceIdentifiers, fieldMask store.FieldMask) (*ttnpb.EndDevice, error)
- func (s Store) GetGateway(ctx context.Context, id *ttnpb.GatewayIdentifiers, fieldMask store.FieldMask) (*ttnpb.Gateway, error)
- func (s Store) GetInvitation(ctx context.Context, token string) (*ttnpb.Invitation, error)
- func (s Store) GetMember(ctx context.Context, accountID *ttnpb.OrganizationOrUserIdentifiers, ...) (*ttnpb.Rights, error)
- func (s Store) GetOrganization(ctx context.Context, id *ttnpb.OrganizationIdentifiers, ...) (*ttnpb.Organization, error)
- func (s Store) GetSession(ctx context.Context, userIDs *ttnpb.UserIdentifiers, sessionID string) (*ttnpb.UserSession, error)
- func (s Store) GetSessionByID(ctx context.Context, sessionID string) (*ttnpb.UserSession, error)
- func (s Store) GetUser(ctx context.Context, id *ttnpb.UserIdentifiers, fieldMask store.FieldMask) (*ttnpb.User, error)
- func (s Store) GetUserByPrimaryEmailAddress(ctx context.Context, primaryEmailAddress string, fieldMask store.FieldMask) (*ttnpb.User, error)
- func (s Store) GetValidation(ctx context.Context, pb *ttnpb.ContactInfoValidation) (*ttnpb.ContactInfoValidation, error)
- func (s Store) IssueDevEUIForApplication(ctx context.Context, id *ttnpb.ApplicationIdentifiers, applicationLimit int) (*types.EUI64, error)
- func (s Store) ListAccessTokens(ctx context.Context, userIDs *ttnpb.UserIdentifiers, ...) ([]*ttnpb.OAuthAccessToken, error)
- func (s Store) ListAdmins(ctx context.Context, fieldMask store.FieldMask) ([]*ttnpb.User, error)
- func (s Store) ListAuthorizations(ctx context.Context, userIDs *ttnpb.UserIdentifiers) ([]*ttnpb.OAuthClientAuthorization, error)
- func (s Store) ListEndDevices(ctx context.Context, ids *ttnpb.ApplicationIdentifiers, ...) ([]*ttnpb.EndDevice, error)
- func (s Store) ListNotifications(ctx context.Context, receiverIDs *ttnpb.UserIdentifiers, ...) ([]*ttnpb.Notification, error)
- func (s Store) PurgeApplication(ctx context.Context, id *ttnpb.ApplicationIdentifiers) error
- func (s Store) PurgeClient(ctx context.Context, id *ttnpb.ClientIdentifiers) error
- func (s Store) PurgeGateway(ctx context.Context, id *ttnpb.GatewayIdentifiers) error
- func (s Store) PurgeOrganization(ctx context.Context, id *ttnpb.OrganizationIdentifiers) error
- func (s Store) PurgeUser(ctx context.Context, id *ttnpb.UserIdentifiers) error
- func (s Store) RestoreApplication(ctx context.Context, id *ttnpb.ApplicationIdentifiers) error
- func (s Store) RestoreClient(ctx context.Context, id *ttnpb.ClientIdentifiers) error
- func (s Store) RestoreGateway(ctx context.Context, id *ttnpb.GatewayIdentifiers) error
- func (s Store) RestoreOrganization(ctx context.Context, id *ttnpb.OrganizationIdentifiers) error
- func (s Store) RestoreUser(ctx context.Context, id *ttnpb.UserIdentifiers) error
- func (s Store) SearchAccounts(ctx context.Context, req *ttnpb.SearchAccountsRequest) ([]*ttnpb.OrganizationOrUserIdentifiers, error)
- func (s Store) SearchApplications(ctx context.Context, accountID *ttnpb.OrganizationOrUserIdentifiers, ...) ([]*ttnpb.ApplicationIdentifiers, error)
- func (s Store) SearchClients(ctx context.Context, accountID *ttnpb.OrganizationOrUserIdentifiers, ...) ([]*ttnpb.ClientIdentifiers, error)
- func (s Store) SearchEndDevices(ctx context.Context, req *ttnpb.SearchEndDevicesRequest) ([]*ttnpb.EndDeviceIdentifiers, error)
- func (s Store) SearchGateways(ctx context.Context, accountID *ttnpb.OrganizationOrUserIdentifiers, ...) ([]*ttnpb.GatewayIdentifiers, error)
- func (s Store) SearchOrganizations(ctx context.Context, accountID *ttnpb.OrganizationOrUserIdentifiers, ...) ([]*ttnpb.OrganizationIdentifiers, error)
- func (s Store) SearchUsers(ctx context.Context, req *ttnpb.SearchUsersRequest) ([]*ttnpb.UserIdentifiers, error)
- func (s Store) SetContactInfo(ctx context.Context, entityID ttnpb.IDStringer, pbs []*ttnpb.ContactInfo) ([]*ttnpb.ContactInfo, error)
- func (s Store) SetInvitationAcceptedBy(ctx context.Context, token string, usrIDs *ttnpb.UserIdentifiers) error
- func (s Store) SetMember(ctx context.Context, accountID *ttnpb.OrganizationOrUserIdentifiers, ...) error
- func (s *Store) Transact(ctx context.Context, fc func(context.Context, store.Store) error) (err error)
- func (s Store) UpdateAPIKey(ctx context.Context, entityID *ttnpb.EntityIdentifiers, pb *ttnpb.APIKey, ...) (*ttnpb.APIKey, error)
- func (s Store) UpdateApplication(ctx context.Context, pb *ttnpb.Application, fieldMask store.FieldMask) (*ttnpb.Application, error)
- func (s Store) UpdateClient(ctx context.Context, pb *ttnpb.Client, fieldMask store.FieldMask) (*ttnpb.Client, error)
- func (s Store) UpdateEndDevice(ctx context.Context, pb *ttnpb.EndDevice, fieldMask store.FieldMask) (*ttnpb.EndDevice, error)
- func (s Store) UpdateGateway(ctx context.Context, pb *ttnpb.Gateway, fieldMask store.FieldMask) (*ttnpb.Gateway, error)
- func (s Store) UpdateNotificationStatus(ctx context.Context, receiverIDs *ttnpb.UserIdentifiers, ...) error
- func (s Store) UpdateOrganization(ctx context.Context, pb *ttnpb.Organization, fieldMask store.FieldMask) (*ttnpb.Organization, error)
- func (s Store) UpdateUser(ctx context.Context, pb *ttnpb.User, fieldMask store.FieldMask) (*ttnpb.User, error)
- func (s Store) ValidateContactInfo(ctx context.Context, pb *ttnpb.ContactInfoValidation) error
- type UUID
- type User
- type UserSession
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Clear ¶ added in v3.24.0
Clear database tables for all registered models. This should be used with caution.
func Initialize ¶ added in v3.24.0
Initialize initializes the database.
Types ¶
type APIKey ¶
type APIKey struct { bun.BaseModel `bun:"table:api_keys,alias:key"` Model APIKeyID string `bun:"api_key_id,nullzero"` Key string `bun:"key,nullzero"` Rights []int `bun:"rights,array,nullzero"` Name string `bun:"name,nullzero"` // EntityType is "application", "client", "end_device", "gateway", "organization" or "user". EntityType string `bun:"entity_type,notnull"` // EntityID is Application.ID, Client.ID, EndDevice.ID, Gateway.ID, Organization.ID or User.ID. EntityID string `bun:"entity_id,notnull"` ExpiresAt *time.Time `bun:"expires_at"` }
APIKey is the API key model in the database.
type AccessToken ¶
type AccessToken struct { bun.BaseModel `bun:"table:access_tokens,alias:oat"` Model Client *Client `bun:"rel:belongs-to,join:client_id=id"` ClientID string `bun:"client_id,notnull"` User *User `bun:"rel:belongs-to,join:user_id=id"` UserID string `bun:"user_id,notnull"` UserSession *UserSession `bun:"rel:belongs-to,join:user_session_id=id"` UserSessionID string `bun:"user_session_id,nullzero"` Rights []int `bun:"rights,array,nullzero"` TokenID string `bun:"token_id,notnull"` Previous *AccessToken `bun:"rel:belongs-to,join:previous_id=id"` PreviousID string `bun:"previous_id,nullzero"` AccessToken string `bun:"access_token,notnull"` RefreshToken string `bun:"refresh_token,notnull"` ExpiresAt *time.Time `bun:"expires_at"` }
AccessToken is the OAuth access token model in the database.
func (*AccessToken) BeforeAppendModel ¶
BeforeAppendModel is a hook that modifies the model on SELECT and UPDATE queries.
type Account ¶
type Account struct { bun.BaseModel `bun:"table:accounts,alias:acc"` Model SoftDelete UID string `bun:"uid,notnull"` AccountID string `bun:"account_id,notnull"` AccountType string `bun:"account_type,notnull"` // user or organization }
Account is the account model in the database.
func (*Account) BeforeAppendModel ¶
BeforeAppendModel is a hook that modifies the model on SELECT and UPDATE queries.
func (*Account) GetOrganizationOrUserIdentifiers ¶
func (m *Account) GetOrganizationOrUserIdentifiers() *ttnpb.OrganizationOrUserIdentifiers
GetOrganizationOrUserIdentifiers returns organization or user identifiers for the account.
type Application ¶
type Application struct { bun.BaseModel `bun:"table:applications,alias:app"` Model SoftDelete ApplicationID string `bun:"application_id,notnull"` Name string `bun:"name,nullzero"` Description string `bun:"description,nullzero"` Attributes []*Attribute `bun:"rel:has-many,join:type=entity_type,join:id=entity_id,polymorphic"` ContactInfo []*ContactInfo `bun:"rel:has-many,join:type=entity_type,join:id=entity_id,polymorphic"` AdministrativeContactID *string `bun:"administrative_contact_id,type:uuid"` AdministrativeContact *Account `bun:"rel:belongs-to,join:administrative_contact_id=id"` TechnicalContactID *string `bun:"technical_contact_id,type:uuid"` TechnicalContact *Account `bun:"rel:belongs-to,join:technical_contact_id=id"` NetworkServerAddress string `bun:"network_server_address,nullzero"` ApplicationServerAddress string `bun:"application_server_address,nullzero"` JoinServerAddress string `bun:"join_server_address,nullzero"` DevEUICounter int `bun:"dev_eui_counter,nullzero"` }
Application is the application model in the database.
func (*Application) BeforeAppendModel ¶
BeforeAppendModel is a hook that modifies the model on SELECT and UPDATE queries.
type Attribute ¶
type Attribute struct { bun.BaseModel `bun:"table:attributes,alias:attr"` UUID // EntityType is "application", "client", "end_device", "gateway", "organization" or "user". EntityType string `bun:"entity_type,notnull"` // EntityID is Application.ID, Client.ID, EndDevice.ID, Gateway.ID, Organization.ID or User.ID. EntityID string `bun:"entity_id,notnull"` Key string `bun:"key,notnull"` Value string `bun:"value,notnull"` }
Attribute is the attribute model in the database.
type AttributeSlice ¶
type AttributeSlice []*Attribute
AttributeSlice is a slice of Attributes.
func (AttributeSlice) Len ¶
func (a AttributeSlice) Len() int
func (AttributeSlice) Less ¶
func (a AttributeSlice) Less(i, j int) bool
func (AttributeSlice) Swap ¶
func (a AttributeSlice) Swap(i, j int)
type AuthorizationCode ¶
type AuthorizationCode struct { bun.BaseModel `bun:"table:authorization_codes,alias:oac"` Model Client *Client `bun:"rel:belongs-to,join:client_id=id"` ClientID string `bun:"client_id,notnull"` User *User `bun:"rel:belongs-to,join:user_id=id"` UserID string `bun:"user_id,notnull"` UserSession *UserSession `bun:"rel:belongs-to,join:user_session_id=id"` UserSessionID string `bun:"user_session_id,nullzero"` Rights []int `bun:"rights,array,nullzero"` Code string `bun:"code,notnull"` RedirectURI string `bun:"redirect_uri,nullzero"` State string `bun:"state,nullzero"` ExpiresAt *time.Time `bun:"expires_at"` }
AuthorizationCode is the OAuth authorization code model in the database.
func (*AuthorizationCode) BeforeAppendModel ¶
BeforeAppendModel is a hook that modifies the model on SELECT and UPDATE queries.
type Client ¶
type Client struct { bun.BaseModel `bun:"table:clients,alias:cli"` Model SoftDelete ClientID string `bun:"client_id,notnull"` Name string `bun:"name,nullzero"` Description string `bun:"description,nullzero"` Attributes []*Attribute `bun:"rel:has-many,join:type=entity_type,join:id=entity_id,polymorphic"` ContactInfo []*ContactInfo `bun:"rel:has-many,join:type=entity_type,join:id=entity_id,polymorphic"` AdministrativeContactID *string `bun:"administrative_contact_id,type:uuid"` AdministrativeContact *Account `bun:"rel:belongs-to,join:administrative_contact_id=id"` TechnicalContactID *string `bun:"technical_contact_id,type:uuid"` TechnicalContact *Account `bun:"rel:belongs-to,join:technical_contact_id=id"` ClientSecret string `bun:"client_secret,nullzero"` RedirectURIs []string `bun:"redirect_uris,array,nullzero"` LogoutRedirectURIs []string `bun:"logout_redirect_uris,array,nullzero"` State int `bun:"state,notnull"` StateDescription string `bun:"state_description,nullzero"` SkipAuthorization bool `bun:"skip_authorization,notnull"` Endorsed bool `bun:"endorsed,notnull"` Grants []int `bun:"grants,array,nullzero"` Rights []int `bun:"rights,array,nullzero"` }
Client is the client model in the database.
type ClientAuthorization ¶
type ClientAuthorization struct { bun.BaseModel `bun:"table:client_authorizations,alias:oca"` Model Client *Client `bun:"rel:belongs-to,join:client_id=id"` ClientID string `bun:"client_id,notnull"` User *User `bun:"rel:belongs-to,join:user_id=id"` UserID string `bun:"user_id,notnull"` Rights []int `bun:"rights,array,nullzero"` }
ClientAuthorization is the OAuth client authorization model in the database.
func (*ClientAuthorization) BeforeAppendModel ¶
BeforeAppendModel is a hook that modifies the model on SELECT and UPDATE queries.
type ContactInfo ¶
type ContactInfo struct { bun.BaseModel `bun:"table:contact_infos,alias:ci"` UUID // EntityType is "application", "client", "end_device", "gateway", "organization" or "user". EntityType string `bun:"entity_type,notnull"` // EntityID is Application.ID, Client.ID, EndDevice.ID, Gateway.ID, Organization.ID or User.ID. EntityID string `bun:"entity_id,notnull"` ContactType int `bun:"contact_type,notnull"` ContactMethod int `bun:"contact_method,notnull"` Value string `bun:"value,notnull"` Public bool `bun:"public"` ValidatedAt *time.Time `bun:"validated_at"` }
ContactInfo is the contact info model in the database.
type ContactInfoSlice ¶
type ContactInfoSlice []*ContactInfo
ContactInfoSlice is a slice of ContactInfo.
func (ContactInfoSlice) Len ¶
func (a ContactInfoSlice) Len() int
func (ContactInfoSlice) Less ¶
func (a ContactInfoSlice) Less(i, j int) bool
func (ContactInfoSlice) Swap ¶
func (a ContactInfoSlice) Swap(i, j int)
type ContactInfoValidation ¶
type ContactInfoValidation struct { bun.BaseModel `bun:"table:contact_info_validations,alias:civ"` Model Reference string `bun:"reference,nullzero"` Token string `bun:"token,nullzero"` // EntityType is "application", "client", "gateway", "organization" or "user". EntityType string `bun:"entity_type,notnull"` // EntityID is Application.ID, Client.ID, Gateway.ID, Organization.ID or User.ID. EntityID string `bun:"entity_id,notnull"` ContactMethod int `bun:"contact_method,notnull"` Value string `bun:"value,nullzero"` Used bool `bun:"used,nullzero"` ExpiresAt *time.Time `bun:"expires_at"` }
ContactInfoValidation is the contact info validation model in the database.
func (*ContactInfoValidation) BeforeAppendModel ¶
BeforeAppendModel is a hook that modifies the model on SELECT and UPDATE queries.
type DBMetadata ¶ added in v3.24.0
type DBMetadata struct { // Version is the database version. Version string // Type is the database type (PostgreSQL, CockroachDB). Type string }
DBMetadata wraps the database metadata needed to distinguish between PostgreSQL and CockroachDB.
type EUIBlock ¶
type EUIBlock struct { bun.BaseModel `bun:"table:eui_blocks,alias:euib"` Model // TODO: The database schema allows NULL for the fields below. We should fix the schema. // https://github.com/TheThingsNetwork/lorawan-stack/issues/5613 Type string `bun:"type,notnull"` StartEUI string `bun:"start_eui,notnull"` EndCounter int64 `bun:"end_counter,notnull"` CurrentCounter int64 `bun:"current_counter,notnull"` }
EUIBlock is the EUI block model in the database.
type EmbeddedAccount ¶
type EmbeddedAccount struct { ID string `bun:"id,notnull,scanonly"` CreatedAt time.Time `bun:"created_at,notnull,scanonly"` UpdatedAt time.Time `bun:"updated_at,notnull,scanonly"` DeletedAt *time.Time `bun:"deleted_at,scanonly"` UID string `bun:"uid,notnull,scanonly"` }
EmbeddedAccount contains the account fields that are embedded into User and Organization when loading them through the user_accounts and organization_accounts views.
type EndDevice ¶
type EndDevice struct { bun.BaseModel `bun:"table:end_devices,alias:dev"` Model ApplicationID string `bun:"application_id,notnull"` DeviceID string `bun:"device_id,notnull"` Name string `bun:"name,nullzero"` Description string `bun:"description,nullzero"` Attributes []*Attribute `bun:"rel:has-many,join:type=entity_type,join:id=entity_id,polymorphic:device"` JoinEUI *string `bun:"join_eui"` DevEUI *string `bun:"dev_eui"` BrandID string `bun:"brand_id,nullzero"` ModelID string `bun:"model_id,nullzero"` HardwareVersion string `bun:"hardware_version,nullzero"` FirmwareVersion string `bun:"firmware_version,nullzero"` BandID string `bun:"band_id,nullzero"` NetworkServerAddress string `bun:"network_server_address,nullzero"` ApplicationServerAddress string `bun:"application_server_address,nullzero"` JoinServerAddress string `bun:"join_server_address,nullzero"` SerialNumber string `bun:"serial_number,nullzero"` ServiceProfileID string `bun:"service_profile_id,nullzero"` VendorID uint32 `bun:"vendor_id,nullzero"` VendorProfileID uint32 `bun:"vendor_profile_id,nullzero"` Locations []*EndDeviceLocation `bun:"rel:has-many,join:id=end_device_id"` PictureID *string `bun:"picture_id"` Picture *Picture `bun:"rel:belongs-to,join:picture_id=id"` ActivatedAt *time.Time `bun:"activated_at"` LastSeenAt *time.Time `bun:"last_seen_at"` ClaimAuthenticationCodeSecret []byte `bun:"claim_authentication_code_secret"` ClaimAuthenticationCodeValidFrom *time.Time `bun:"claim_authentication_code_valid_from"` ClaimAuthenticationCodeValidTo *time.Time `bun:"claim_authentication_code_valid_to"` }
EndDevice is the end_device model in the database.
type EndDeviceLocation ¶
type EndDeviceLocation struct { bun.BaseModel `bun:"table:end_device_locations,alias:edloc"` Model EndDeviceID string `bun:"end_device_id,notnull"` EndDevice *EndDevice `bun:"rel:belongs-to,join:end_device_id=id"` Service string `bun:"service,nullzero"` Location Source int `bun:"source"` }
EndDeviceLocation is the end device location model in the database.
type EndDeviceLocationSlice ¶
type EndDeviceLocationSlice []*EndDeviceLocation
EndDeviceLocationSlice is a slice of EndDeviceLocation.
func (EndDeviceLocationSlice) Len ¶
func (a EndDeviceLocationSlice) Len() int
func (EndDeviceLocationSlice) Less ¶
func (a EndDeviceLocationSlice) Less(i, j int) bool
func (EndDeviceLocationSlice) Swap ¶
func (a EndDeviceLocationSlice) Swap(i, j int)
type Gateway ¶
type Gateway struct { bun.BaseModel `bun:"table:gateways,alias:gtw"` Model SoftDelete GatewayID string `bun:"gateway_id,notnull"` GatewayEUI *string `bun:"gateway_eui"` Name string `bun:"name,nullzero"` Description string `bun:"description,nullzero"` Attributes []*Attribute `bun:"rel:has-many,join:type=entity_type,join:id=entity_id,polymorphic"` ContactInfo []*ContactInfo `bun:"rel:has-many,join:type=entity_type,join:id=entity_id,polymorphic"` AdministrativeContactID *string `bun:"administrative_contact_id,type:uuid"` AdministrativeContact *Account `bun:"rel:belongs-to,join:administrative_contact_id=id"` TechnicalContactID *string `bun:"technical_contact_id,type:uuid"` TechnicalContact *Account `bun:"rel:belongs-to,join:technical_contact_id=id"` BrandID string `bun:"brand_id,nullzero"` ModelID string `bun:"model_id,nullzero"` HardwareVersion string `bun:"hardware_version,nullzero"` FirmwareVersion string `bun:"firmware_version,nullzero"` GatewayServerAddress string `bun:"gateway_server_address,nullzero"` AutoUpdate bool `bun:"auto_update,notnull"` UpdateChannel string `bun:"update_channel,nullzero"` // Frequency Plan IDs separated by spaces. FrequencyPlanID string `bun:"frequency_plan_id,nullzero"` StatusPublic bool `bun:"status_public,notnull"` LocationPublic bool `bun:"location_public,notnull"` ScheduleDownlinkLate bool `bun:"schedule_downlink_late,notnull"` EnforceDutyCycle bool `bun:"enforce_duty_cycle,notnull"` ScheduleAnytimeDelay int64 `bun:"schedule_anytime_delay,notnull"` DownlinkPathConstraint int `bun:"downlink_path_constraint,nullzero"` UpdateLocationFromStatus bool `bun:"update_location_from_status,notnull"` Antennas []*GatewayAntenna `bun:"rel:has-many,join:id=gateway_id"` LBSLNSSecret []byte `bun:"lbs_lns_secret,nullzero"` ClaimAuthenticationCodeSecret []byte `bun:"claim_authentication_code_secret"` ClaimAuthenticationCodeValidFrom *time.Time `bun:"claim_authentication_code_valid_from"` ClaimAuthenticationCodeValidTo *time.Time `bun:"claim_authentication_code_valid_to"` TargetCUPSURI string `bun:"target_cups_uri,nullzero"` TargetCUPSKey []byte `bun:"target_cups_key"` RequireAuthenticatedConnection bool `bun:"require_authenticated_connection,nullzero"` SupportsLRFHSS bool `bun:"supports_lrfhss,notnull"` DisablePacketBrokerForwarding bool `bun:"disable_packet_broker_forwarding,notnull"` }
Gateway is the gateway model in the database.
type GatewayAntenna ¶
type GatewayAntenna struct { bun.BaseModel `bun:"table:gateway_antennas,alias:ant"` Model GatewayID string `bun:"gateway_id,notnull"` Gateway *Gateway `bun:"rel:belongs-to,join:gateway_id=id"` Index int `bun:"index,notnull"` Gain float32 `bun:"gain,nullzero"` Location Placement int `bun:"placement,nullzero"` }
GatewayAntenna is the gateway antenna model in the database.
type GatewayAntennaSlice ¶
type GatewayAntennaSlice []*GatewayAntenna
GatewayAntennaSlice is a slice of GatewayAntenna.
func (GatewayAntennaSlice) Len ¶
func (a GatewayAntennaSlice) Len() int
func (GatewayAntennaSlice) Less ¶
func (a GatewayAntennaSlice) Less(i, j int) bool
func (GatewayAntennaSlice) Swap ¶
func (a GatewayAntennaSlice) Swap(i, j int)
type Invitation ¶
type Invitation struct { bun.BaseModel `bun:"table:invitations,alias:inv"` Model Email string `bun:"email,notnull"` Token string `bun:"token,notnull"` ExpiresAt *time.Time `bun:"expires_at"` AcceptedBy *User `bun:"rel:belongs-to,join:accepted_by_id=id"` AcceptedByID *string `bun:"accepted_by_id"` AcceptedAt *time.Time `bun:"accepted_at"` }
Invitation is the invitation model in the database.
func (*Invitation) BeforeAppendModel ¶
BeforeAppendModel is a hook that modifies the model on SELECT and UPDATE queries.
type Location ¶
type Location struct { Latitude float64 `bun:"latitude,nullzero"` Longitude float64 `bun:"longitude,nullzero"` Altitude int32 `bun:"altitude,nullzero"` Accuracy int32 `bun:"accuracy,nullzero"` }
Location can be embedded in other models to add location columns.
type LoginToken ¶
type LoginToken struct { bun.BaseModel `bun:"table:login_tokens,alias:lt"` Model User *User `bun:"rel:belongs-to,join:user_id=id"` UserID string `bun:"user_id"` Token string `bun:"token,notnull"` ExpiresAt *time.Time `bun:"expires_at"` Used bool `bun:"used,nullzero"` }
LoginToken is the login token model in the database.
func (*LoginToken) BeforeAppendModel ¶
BeforeAppendModel is a hook that modifies the model on SELECT and UPDATE queries.
type Membership ¶
type Membership struct { bun.BaseModel `bun:"table:memberships,alias:mem"` Model AccountID string `bun:"account_id,notnull"` Account *Account `bun:"rel:belongs-to,join:account_id=id"` Rights []int `bun:"rights,array,nullzero"` EntityID string `bun:"entity_id,notnull"` EntityType string `bun:"entity_type,notnull"` }
Membership is the membership model in the database.
func (*Membership) BeforeAppendModel ¶
BeforeAppendModel is a hook that modifies the model on SELECT and UPDATE queries.
type Model ¶
type Model struct { UUID CreatedAt time.Time `bun:"created_at,notnull"` UpdatedAt time.Time `bun:"updated_at,notnull"` }
Model is the base model for most of our types.
type Notification ¶
type Notification struct { bun.BaseModel `bun:"table:notifications,alias:not"` Model // EntityType is "application", "client", "end_device", "gateway", "organization" or "user". EntityType string `bun:"entity_type,notnull"` // EntityID is Application.ID, Client.ID, EndDevice.ID, Gateway.ID, Organization.ID or User.ID. EntityID string `bun:"entity_id,notnull"` // EntityUID is a copy of the human-readable entity ID, so that we can keep notifications for deleted entities. EntityUID string `bun:"entity_uid,notnull"` NotificationType string `bun:"notification_type,notnull"` Data json.RawMessage `bun:"data,nullzero"` SenderID *string `bun:"sender_id"` // SenderUID is a copy of the human-readable sender ID, so that we can keep notifications for deleted senders. SenderUID string `bun:"sender_uid,notnull"` Receivers []int `bun:"receivers,array,nullzero"` Email bool `bun:"email,notnull"` }
Notification is the notification model in the database.
func (*Notification) BeforeAppendModel ¶
BeforeAppendModel is a hook that modifies the model on SELECT and UPDATE queries.
type NotificationReceiver ¶
type NotificationReceiver struct { bun.BaseModel `bun:"table:notification_receivers,alias:rec"` Notification *Notification `bun:"rel:belongs-to,join:notification_id=id"` NotificationID string `bun:"notification_id,notnull"` Receiver *User `bun:"rel:belongs-to,join:receiver_id=id"` ReceiverID string `bun:"receiver_id,notnull"` Status int `bun:"status,notnull"` StatusUpdatedAt time.Time `bun:"status_updated_at,notnull"` }
NotificationReceiver is the notification receiver model in the database.
type Organization ¶
type Organization struct { bun.BaseModel `bun:"table:organizations,alias:org,select:organization_accounts"` Model SoftDelete Account EmbeddedAccount `bun:"embed:account_"` Name string `bun:"name,nullzero"` Description string `bun:"description,nullzero"` Attributes []*Attribute `bun:"rel:has-many,join:type=entity_type,join:id=entity_id,polymorphic"` ContactInfo []*ContactInfo `bun:"rel:has-many,join:type=entity_type,join:id=entity_id,polymorphic"` AdministrativeContactID *string `bun:"administrative_contact_id,type:uuid"` AdministrativeContact *Account `bun:"rel:belongs-to,join:administrative_contact_id=id"` TechnicalContactID *string `bun:"technical_contact_id,type:uuid"` TechnicalContact *Account `bun:"rel:belongs-to,join:technical_contact_id=id"` }
Organization is the organization model in the database.
func (*Organization) BeforeAppendModel ¶
BeforeAppendModel is a hook that modifies the model on SELECT and UPDATE queries.
type Picture ¶
type Picture struct { bun.BaseModel `bun:"table:pictures,alias:pic"` Model SoftDelete Data []byte `bun:"data,type:bytea"` }
Picture is the picture model in the database.
type SoftDelete ¶
SoftDelete can be embedded in models that should have soft delete functionality.
type Store ¶
Store is the combined store of all the individual stores.
func (Store) Authorize ¶
func (s Store) Authorize( ctx context.Context, pb *ttnpb.OAuthClientAuthorization, ) (authorization *ttnpb.OAuthClientAuthorization, err error)
func (Store) BatchDeleteEndDevices ¶ added in v3.27.0
func (s Store) BatchDeleteEndDevices( ctx context.Context, appIDs *ttnpb.ApplicationIdentifiers, deviceIDs []string, ) ([]*ttnpb.EndDeviceIdentifiers, error)
BatchDeleteEndDevices implements EndDeviceStore.
func (Store) BatchUpdateEndDeviceLastSeen ¶
func (s Store) BatchUpdateEndDeviceLastSeen( ctx context.Context, devsLastSeen []*ttnpb.BatchUpdateEndDeviceLastSeenRequest_EndDeviceLastSeenUpdate, ) error
func (Store) ConsumeLoginToken ¶
func (Store) CountApplications ¶
func (Store) CountEndDevices ¶
func (Store) CountMemberships ¶
func (Store) CountOrganizations ¶
func (Store) CreateAPIKey ¶
func (Store) CreateAccessToken ¶
func (s Store) CreateAccessToken( ctx context.Context, pb *ttnpb.OAuthAccessToken, previousID string, ) (*ttnpb.OAuthAccessToken, error)
func (Store) CreateApplication ¶
func (s Store) CreateApplication( ctx context.Context, pb *ttnpb.Application, ) (*ttnpb.Application, error)
func (Store) CreateAuthorizationCode ¶
func (s Store) CreateAuthorizationCode( ctx context.Context, pb *ttnpb.OAuthAuthorizationCode, ) (*ttnpb.OAuthAuthorizationCode, error)
func (Store) CreateClient ¶
func (Store) CreateEUIBlock ¶
func (Store) CreateEndDevice ¶
func (Store) CreateGateway ¶
func (Store) CreateInvitation ¶
func (s Store) CreateInvitation( ctx context.Context, pb *ttnpb.Invitation, ) (*ttnpb.Invitation, error)
func (Store) CreateLoginToken ¶
func (s Store) CreateLoginToken(ctx context.Context, pb *ttnpb.LoginToken) (*ttnpb.LoginToken, error)
func (Store) CreateNotification ¶
func (s Store) CreateNotification( ctx context.Context, pb *ttnpb.Notification, receiverIDs []*ttnpb.UserIdentifiers, ) (*ttnpb.Notification, error)
func (Store) CreateOrganization ¶
func (s Store) CreateOrganization( ctx context.Context, pb *ttnpb.Organization, ) (*ttnpb.Organization, error)
func (Store) CreateSession ¶
func (s Store) CreateSession( ctx context.Context, pb *ttnpb.UserSession, ) (*ttnpb.UserSession, error)
func (Store) CreateUser ¶
func (Store) CreateValidation ¶
func (s Store) CreateValidation( ctx context.Context, pb *ttnpb.ContactInfoValidation, ) (*ttnpb.ContactInfoValidation, error)
func (Store) DeleteAPIKey ¶ added in v3.26.1
func (Store) DeleteAccessToken ¶
func (Store) DeleteAccountMembers ¶
func (s Store) DeleteAccountMembers( ctx context.Context, accountID *ttnpb.OrganizationOrUserIdentifiers, ) error
func (Store) DeleteAllUserSessions ¶
func (s Store) DeleteAllUserSessions(ctx context.Context, userIDs *ttnpb.UserIdentifiers) error
func (Store) DeleteApplication ¶
func (s Store) DeleteApplication(ctx context.Context, id *ttnpb.ApplicationIdentifiers) error
func (Store) DeleteAuthorization ¶
func (s Store) DeleteAuthorization( ctx context.Context, userIDs *ttnpb.UserIdentifiers, clientIDs *ttnpb.ClientIdentifiers, ) error
func (Store) DeleteAuthorizationCode ¶
func (Store) DeleteClient ¶
func (s Store) DeleteClient(ctx context.Context, id *ttnpb.ClientIdentifiers) error
func (Store) DeleteClientAuthorizations ¶
func (s Store) DeleteClientAuthorizations(ctx context.Context, clientIDs *ttnpb.ClientIdentifiers) error
func (Store) DeleteEndDevice ¶
func (s Store) DeleteEndDevice(ctx context.Context, id *ttnpb.EndDeviceIdentifiers) error
func (Store) DeleteEntityAPIKeys ¶
func (s Store) DeleteEntityAPIKeys(ctx context.Context, entityID *ttnpb.EntityIdentifiers) error
func (Store) DeleteEntityContactInfo ¶
func (s Store) DeleteEntityContactInfo(ctx context.Context, entityID ttnpb.IDStringer) error
func (Store) DeleteEntityMembers ¶
func (s Store) DeleteEntityMembers( ctx context.Context, entityID *ttnpb.EntityIdentifiers, ) error
func (Store) DeleteGateway ¶
func (s Store) DeleteGateway(ctx context.Context, id *ttnpb.GatewayIdentifiers) error
func (Store) DeleteInvitation ¶
func (Store) DeleteMember ¶ added in v3.26.1
func (s Store) DeleteMember( ctx context.Context, ids *ttnpb.OrganizationOrUserIdentifiers, entityID *ttnpb.EntityIdentifiers, ) error
DeleteMember elminates the direct member rights attached to an entity.
func (Store) DeleteOrganization ¶
func (s Store) DeleteOrganization(ctx context.Context, id *ttnpb.OrganizationIdentifiers) error
func (Store) DeleteSession ¶
func (Store) DeleteUser ¶
func (s Store) DeleteUser(ctx context.Context, id *ttnpb.UserIdentifiers) error
func (Store) DeleteUserAuthorizations ¶
func (s Store) DeleteUserAuthorizations(ctx context.Context, userIDs *ttnpb.UserIdentifiers) error
func (Store) ExpireValidation ¶ added in v3.26.1
func (s Store) ExpireValidation(ctx context.Context, pb *ttnpb.ContactInfoValidation) error
func (Store) FindAPIKeys ¶
func (Store) FindAccountMembershipChains ¶
func (s Store) FindAccountMembershipChains( ctx context.Context, accountID *ttnpb.OrganizationOrUserIdentifiers, entityType string, entityIDs ...string, ) ([]*store.MembershipChain, error)
func (Store) FindActiveLoginTokens ¶
func (s Store) FindActiveLoginTokens( ctx context.Context, userIDs *ttnpb.UserIdentifiers, ) ([]*ttnpb.LoginToken, error)
func (Store) FindApplications ¶
func (s Store) FindApplications( ctx context.Context, ids []*ttnpb.ApplicationIdentifiers, fieldMask store.FieldMask, ) ([]*ttnpb.Application, error)
func (Store) FindClients ¶
func (Store) FindEndDevices ¶
func (Store) FindGateways ¶
func (Store) FindInvitations ¶
func (s Store) FindInvitations(ctx context.Context) ([]*ttnpb.Invitation, error)
func (Store) FindMembers ¶
func (s Store) FindMembers( ctx context.Context, entityID *ttnpb.EntityIdentifiers, ) ([]*store.MemberByID, error)
func (Store) FindMemberships ¶
func (s Store) FindMemberships( ctx context.Context, accountID *ttnpb.OrganizationOrUserIdentifiers, entityType string, includeIndirect bool, ) ([]*ttnpb.EntityIdentifiers, error)
func (Store) FindOrganizations ¶
func (s Store) FindOrganizations( ctx context.Context, ids []*ttnpb.OrganizationIdentifiers, fieldMask store.FieldMask, ) ([]*ttnpb.Organization, error)
func (Store) FindSessions ¶
func (s Store) FindSessions( ctx context.Context, userIDs *ttnpb.UserIdentifiers, ) ([]*ttnpb.UserSession, error)
func (Store) GetAPIKeyByID ¶
func (Store) GetAccessToken ¶
func (Store) GetApplication ¶
func (s Store) GetApplication( ctx context.Context, id *ttnpb.ApplicationIdentifiers, fieldMask store.FieldMask, ) (*ttnpb.Application, error)
func (Store) GetAuthorization ¶
func (s Store) GetAuthorization( ctx context.Context, userIDs *ttnpb.UserIdentifiers, clientIDs *ttnpb.ClientIdentifiers, ) (*ttnpb.OAuthClientAuthorization, error)
func (Store) GetAuthorizationCode ¶
func (Store) GetContactInfo ¶
func (s Store) GetContactInfo( ctx context.Context, entityID ttnpb.IDStringer, ) ([]*ttnpb.ContactInfo, error)
func (Store) GetEndDevice ¶
func (Store) GetGateway ¶
func (Store) GetInvitation ¶
func (Store) GetMember ¶
func (s Store) GetMember( ctx context.Context, accountID *ttnpb.OrganizationOrUserIdentifiers, entityID *ttnpb.EntityIdentifiers, ) (*ttnpb.Rights, error)
func (Store) GetOrganization ¶
func (s Store) GetOrganization( ctx context.Context, id *ttnpb.OrganizationIdentifiers, fieldMask store.FieldMask, ) (*ttnpb.Organization, error)
func (Store) GetSession ¶
func (s Store) GetSession( ctx context.Context, userIDs *ttnpb.UserIdentifiers, sessionID string, ) (*ttnpb.UserSession, error)
func (Store) GetSessionByID ¶
func (Store) GetUserByPrimaryEmailAddress ¶
func (Store) GetValidation ¶ added in v3.26.1
func (s Store) GetValidation( ctx context.Context, pb *ttnpb.ContactInfoValidation, ) (*ttnpb.ContactInfoValidation, error)
func (Store) IssueDevEUIForApplication ¶
func (Store) ListAccessTokens ¶
func (s Store) ListAccessTokens( ctx context.Context, userIDs *ttnpb.UserIdentifiers, clientIDs *ttnpb.ClientIdentifiers, ) ([]*ttnpb.OAuthAccessToken, error)
func (Store) ListAdmins ¶
func (Store) ListAuthorizations ¶
func (s Store) ListAuthorizations( ctx context.Context, userIDs *ttnpb.UserIdentifiers, ) ([]*ttnpb.OAuthClientAuthorization, error)
func (Store) ListEndDevices ¶
func (Store) ListNotifications ¶
func (s Store) ListNotifications( ctx context.Context, receiverIDs *ttnpb.UserIdentifiers, statuses []ttnpb.NotificationStatus, ) ([]*ttnpb.Notification, error)
func (Store) PurgeApplication ¶
func (s Store) PurgeApplication(ctx context.Context, id *ttnpb.ApplicationIdentifiers) error
func (Store) PurgeClient ¶
func (s Store) PurgeClient(ctx context.Context, id *ttnpb.ClientIdentifiers) error
func (Store) PurgeGateway ¶
func (s Store) PurgeGateway(ctx context.Context, id *ttnpb.GatewayIdentifiers) error
func (Store) PurgeOrganization ¶
func (s Store) PurgeOrganization(ctx context.Context, id *ttnpb.OrganizationIdentifiers) error
func (Store) PurgeUser ¶
func (s Store) PurgeUser(ctx context.Context, id *ttnpb.UserIdentifiers) error
func (Store) RestoreApplication ¶
func (s Store) RestoreApplication(ctx context.Context, id *ttnpb.ApplicationIdentifiers) error
func (Store) RestoreClient ¶
func (s Store) RestoreClient(ctx context.Context, id *ttnpb.ClientIdentifiers) error
func (Store) RestoreGateway ¶
func (s Store) RestoreGateway(ctx context.Context, id *ttnpb.GatewayIdentifiers) error
func (Store) RestoreOrganization ¶
func (s Store) RestoreOrganization(ctx context.Context, id *ttnpb.OrganizationIdentifiers) error
func (Store) RestoreUser ¶
func (s Store) RestoreUser(ctx context.Context, id *ttnpb.UserIdentifiers) error
func (Store) SearchAccounts ¶ added in v3.21.1
func (s Store) SearchAccounts( ctx context.Context, req *ttnpb.SearchAccountsRequest, ) ([]*ttnpb.OrganizationOrUserIdentifiers, error)
func (Store) SearchApplications ¶
func (s Store) SearchApplications( ctx context.Context, accountID *ttnpb.OrganizationOrUserIdentifiers, req *ttnpb.SearchApplicationsRequest, ) ([]*ttnpb.ApplicationIdentifiers, error)
func (Store) SearchClients ¶
func (s Store) SearchClients( ctx context.Context, accountID *ttnpb.OrganizationOrUserIdentifiers, req *ttnpb.SearchClientsRequest, ) ([]*ttnpb.ClientIdentifiers, error)
func (Store) SearchEndDevices ¶
func (s Store) SearchEndDevices( ctx context.Context, req *ttnpb.SearchEndDevicesRequest, ) ([]*ttnpb.EndDeviceIdentifiers, error)
func (Store) SearchGateways ¶
func (s Store) SearchGateways( ctx context.Context, accountID *ttnpb.OrganizationOrUserIdentifiers, req *ttnpb.SearchGatewaysRequest, ) ([]*ttnpb.GatewayIdentifiers, error)
func (Store) SearchOrganizations ¶
func (s Store) SearchOrganizations( ctx context.Context, accountID *ttnpb.OrganizationOrUserIdentifiers, req *ttnpb.SearchOrganizationsRequest, ) ([]*ttnpb.OrganizationIdentifiers, error)
func (Store) SearchUsers ¶
func (s Store) SearchUsers( ctx context.Context, req *ttnpb.SearchUsersRequest, ) ([]*ttnpb.UserIdentifiers, error)
func (Store) SetContactInfo ¶
func (s Store) SetContactInfo( ctx context.Context, entityID ttnpb.IDStringer, pbs []*ttnpb.ContactInfo, ) ([]*ttnpb.ContactInfo, error)
func (Store) SetInvitationAcceptedBy ¶
func (Store) SetMember ¶
func (s Store) SetMember( ctx context.Context, accountID *ttnpb.OrganizationOrUserIdentifiers, entityID *ttnpb.EntityIdentifiers, rights *ttnpb.Rights, ) error
func (*Store) Transact ¶
func (s *Store) Transact(ctx context.Context, fc func(context.Context, store.Store) error) (err error)
Transact implements the store.TransactionalStore interface.
func (Store) UpdateAPIKey ¶
func (Store) UpdateApplication ¶
func (s Store) UpdateApplication( ctx context.Context, pb *ttnpb.Application, fieldMask store.FieldMask, ) (*ttnpb.Application, error)
func (Store) UpdateClient ¶
func (Store) UpdateEndDevice ¶
func (Store) UpdateGateway ¶
func (Store) UpdateNotificationStatus ¶
func (s Store) UpdateNotificationStatus( ctx context.Context, receiverIDs *ttnpb.UserIdentifiers, notificationIDs []string, status ttnpb.NotificationStatus, ) error
func (Store) UpdateOrganization ¶
func (s Store) UpdateOrganization( ctx context.Context, pb *ttnpb.Organization, fieldMask store.FieldMask, ) (*ttnpb.Organization, error)
func (Store) UpdateUser ¶
func (Store) ValidateContactInfo ¶ added in v3.26.1
func (s Store) ValidateContactInfo(ctx context.Context, pb *ttnpb.ContactInfoValidation) error
type UUID ¶
type UUID struct {
ID string `bun:"id,type:uuid,pk,notnull,default:gen_random_uuid()"`
}
UUID can be embedded in models that should have a UUID field.
type User ¶
type User struct { bun.BaseModel `bun:"table:users,alias:usr,select:user_accounts"` Model SoftDelete Account EmbeddedAccount `bun:"embed:account_"` Name string `bun:"name,nullzero"` Description string `bun:"description,nullzero"` Attributes []*Attribute `bun:"rel:has-many,join:type=entity_type,join:id=entity_id,polymorphic"` ContactInfo []*ContactInfo `bun:"rel:has-many,join:type=entity_type,join:id=entity_id,polymorphic"` PrimaryEmailAddress string `bun:"primary_email_address,notnull"` PrimaryEmailAddressValidatedAt *time.Time `bun:"primary_email_address_validated_at"` Password string `bun:"password,notnull"` PasswordUpdatedAt time.Time `bun:"password_updated_at,notnull"` RequirePasswordUpdate bool `bun:"require_password_update,notnull"` State int `bun:"state,notnull"` StateDescription string `bun:"state_description,nullzero"` Admin bool `bun:"admin,notnull"` TemporaryPassword string `bun:"temporary_password,nullzero"` TemporaryPasswordCreatedAt *time.Time `bun:"temporary_password_created_at"` TemporaryPasswordExpiresAt *time.Time `bun:"temporary_password_expires_at"` ProfilePictureID *string `bun:"profile_picture_id"` ProfilePicture *Picture `bun:"rel:belongs-to,join:profile_picture_id=id"` }
User is the user model in the database.
type UserSession ¶
type UserSession struct { bun.BaseModel `bun:"table:user_sessions,alias:sess"` Model User *User `bun:"rel:belongs-to,join:user_id=id"` UserID string `bun:"user_id,notnull"` SessionSecret string `bun:"session_secret,nullzero"` ExpiresAt *time.Time `bun:"expires_at"` }
UserSession is the user session model in the database.
func (*UserSession) BeforeAppendModel ¶
BeforeAppendModel is a hook that modifies the model on SELECT and UPDATE queries.
Source Files ¶
- account_store.go
- api_key_store.go
- application_store.go
- attribute_store.go
- client_store.go
- contact_info_store.go
- end_device_location_store.go
- end_device_store.go
- entity_search.go
- entity_store.go
- eui_store.go
- gateway_antenna_store.go
- gateway_store.go
- invitation_store.go
- location.go
- login_token_store.go
- membership_store.go
- migrate.go
- model.go
- notification_store.go
- oauth_store.go
- organization_store.go
- picture.go
- registry.go
- scope.go
- scope.ttn.go
- store.go
- user_session_store.go
- user_store.go
- util.go