Versions in this module Expand all Collapse all v3 v3.7.3 Apr 29, 2020 Changes in this version + var ErrTransactionRecovered = errors.DefineInternal("transaction_recovered", "Internal Server Error") + func AutoMigrate(db *gorm.DB) *gorm.DB + func Check(db *gorm.DB) error + func Clear(db *gorm.DB) error + func Initialize(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) + func WithOrder(ctx context.Context, spec string) context.Context + func WithPagination(ctx context.Context, limit, page uint32, total *uint64) context.Context + type APIKey struct + APIKeyID string + EntityID string + EntityType string + Key string + Name string + Rights Rights + type APIKeyStore interface + CreateAPIKey func(ctx context.Context, entityID ttnpb.Identifiers, key *ttnpb.APIKey) error + FindAPIKeys func(ctx context.Context, entityID ttnpb.Identifiers) ([]*ttnpb.APIKey, error) + GetAPIKey func(ctx context.Context, id string) (ttnpb.Identifiers, *ttnpb.APIKey, error) + UpdateAPIKey func(ctx context.Context, entityID ttnpb.Identifiers, key *ttnpb.APIKey) (*ttnpb.APIKey, error) + func GetAPIKeyStore(db *gorm.DB) APIKeyStore + type AccessToken struct + AccessToken string + Client *Client + ClientID string + ExpiresAt time.Time + Previous *AccessToken + PreviousID string + RefreshToken string + Rights Rights + TokenID string + User *User + UserID string + UserSessionID *string + type Account struct + AccountID string + AccountType string + Memberships []*Membership + UID string + func (a Account) OrganizationOrUserIdentifiers() *ttnpb.OrganizationOrUserIdentifiers + type Application struct + APIKeys []APIKey + ApplicationID string + Attributes []Attribute + Description string + Memberships []Membership + Name string + type ApplicationStore interface + CreateApplication func(ctx context.Context, app *ttnpb.Application) (*ttnpb.Application, error) + DeleteApplication func(ctx context.Context, id *ttnpb.ApplicationIdentifiers) error + FindApplications func(ctx context.Context, ids []*ttnpb.ApplicationIdentifiers, ...) ([]*ttnpb.Application, error) + GetApplication func(ctx context.Context, id *ttnpb.ApplicationIdentifiers, ...) (*ttnpb.Application, error) + UpdateApplication func(ctx context.Context, app *ttnpb.Application, fieldMask *types.FieldMask) (*ttnpb.Application, error) + func GetApplicationStore(db *gorm.DB) ApplicationStore + type Attribute struct + EntityID string + EntityType string + ID string + Key string + Value string + type AuthorizationCode struct + Client *Client + ClientID string + Code string + ExpiresAt time.Time + RedirectURI string + Rights Rights + State string + User *User + UserID string + UserSessionID *string + type Client struct + Attributes []Attribute + ClientID string + ClientSecret string + Description string + Endorsed bool + Grants Grants + LogoutRedirectURIs pq.StringArray + Memberships []Membership + Name string + RedirectURIs pq.StringArray + Rights Rights + SkipAuthorization bool + State int + type ClientAuthorization struct + Client *Client + ClientID string + Rights Rights + User *User + UserID string + type ClientStore interface + CreateClient func(ctx context.Context, cli *ttnpb.Client) (*ttnpb.Client, error) + DeleteClient func(ctx context.Context, id *ttnpb.ClientIdentifiers) error + FindClients func(ctx context.Context, ids []*ttnpb.ClientIdentifiers, ...) ([]*ttnpb.Client, error) + GetClient func(ctx context.Context, id *ttnpb.ClientIdentifiers, fieldMask *types.FieldMask) (*ttnpb.Client, error) + UpdateClient func(ctx context.Context, cli *ttnpb.Client, fieldMask *types.FieldMask) (*ttnpb.Client, error) + func GetClientStore(db *gorm.DB) ClientStore + type ContactInfo struct + ContactMethod int + ContactType int + EntityID string + EntityType string + ID string + Public bool + ValidatedAt *time.Time + Value string + type ContactInfoStore interface + CreateValidation func(ctx context.Context, validation *ttnpb.ContactInfoValidation) (*ttnpb.ContactInfoValidation, error) + GetContactInfo func(ctx context.Context, entityID ttnpb.Identifiers) ([]*ttnpb.ContactInfo, error) + SetContactInfo func(ctx context.Context, entityID ttnpb.Identifiers, ...) ([]*ttnpb.ContactInfo, error) + Validate func(ctx context.Context, validation *ttnpb.ContactInfoValidation) error + func GetContactInfoStore(db *gorm.DB) ContactInfoStore + type ContactInfoValidation struct + ContactMethod int + EntityID string + EntityType string + ExpiresAt time.Time + Reference string + Token string + Value string + type EUI64 types.EUI64 + func (eui *EUI64) Scan(src interface{}) (err error) + func (eui EUI64) Value() (driver.Value, error) + type EndDevice struct + Application *Application + ApplicationID string + ApplicationServerAddress string + Attributes []Attribute + BrandID string + Description string + DevEUI *EUI64 + DeviceID string + FirmwareVersion string + HardwareVersion string + JoinEUI *EUI64 + JoinServerAddress string + Locations []EndDeviceLocation + ModelID string + Name string + NetworkServerAddress string + Picture *Picture + PictureID *string + ServiceProfileID string + type EndDeviceLocation struct + EndDeviceID string + Service string + Source int + type EndDeviceStore interface + CountEndDevices func(ctx context.Context, ids *ttnpb.ApplicationIdentifiers) (uint64, error) + CreateEndDevice func(ctx context.Context, dev *ttnpb.EndDevice) (*ttnpb.EndDevice, error) + DeleteEndDevice func(ctx context.Context, id *ttnpb.EndDeviceIdentifiers) error + FindEndDevices func(ctx context.Context, ids []*ttnpb.EndDeviceIdentifiers, ...) ([]*ttnpb.EndDevice, error) + GetEndDevice func(ctx context.Context, id *ttnpb.EndDeviceIdentifiers, ...) (*ttnpb.EndDevice, error) + ListEndDevices func(ctx context.Context, ids *ttnpb.ApplicationIdentifiers, ...) ([]*ttnpb.EndDevice, error) + UpdateEndDevice func(ctx context.Context, dev *ttnpb.EndDevice, fieldMask *types.FieldMask) (*ttnpb.EndDevice, error) + func GetEndDeviceStore(db *gorm.DB) EndDeviceStore + type EntitySearch interface + FindEndDevices func(ctx context.Context, req *ttnpb.SearchEndDevicesRequest) ([]*ttnpb.EndDeviceIdentifiers, error) + FindEntities func(ctx context.Context, member *ttnpb.OrganizationOrUserIdentifiers, ...) ([]ttnpb.Identifiers, error) + func GetEntitySearch(db *gorm.DB) EntitySearch + type Gateway struct + APIKeys []APIKey + Antennas []GatewayAntenna + Attributes []Attribute + AutoUpdate bool + BrandID string + Description string + DownlinkPathConstraint int + EnforceDutyCycle bool + FirmwareVersion string + FrequencyPlanID string + GatewayEUI *EUI64 + GatewayID string + GatewayServerAddress string + HardwareVersion string + LocationPublic bool + Memberships []Membership + ModelID string + Name string + ScheduleAnytimeDelay int64 + ScheduleDownlinkLate bool + StatusPublic bool + UpdateChannel string + UpdateLocationFromStatus bool + func (gtw *Gateway) AfterDelete(db *gorm.DB) error + type GatewayAntenna struct + Attributes []Attribute + Gain float32 + Gateway *Gateway + GatewayID string + Index int + type GatewayStore interface + CreateGateway func(ctx context.Context, gtw *ttnpb.Gateway) (*ttnpb.Gateway, error) + DeleteGateway func(ctx context.Context, id *ttnpb.GatewayIdentifiers) error + FindGateways func(ctx context.Context, ids []*ttnpb.GatewayIdentifiers, ...) ([]*ttnpb.Gateway, error) + GetGateway func(ctx context.Context, id *ttnpb.GatewayIdentifiers, fieldMask *types.FieldMask) (*ttnpb.Gateway, error) + UpdateGateway func(ctx context.Context, gtw *ttnpb.Gateway, fieldMask *types.FieldMask) (*ttnpb.Gateway, error) + func GetGatewayStore(db *gorm.DB) GatewayStore + type Grants []ttnpb.GrantType + func (g *Grants) Scan(src interface{}) error + func (g Grants) Value() (driver.Value, error) + type IndirectMembership struct + OrganizationRights *ttnpb.Rights + RightsOnOrganization *ttnpb.Rights + type Invitation struct + AcceptedAt *time.Time + AcceptedBy *User + AcceptedByID *string + Email string + ExpiresAt time.Time + Token string + type InvitationStore interface + CreateInvitation func(ctx context.Context, invitation *ttnpb.Invitation) (*ttnpb.Invitation, error) + DeleteInvitation func(ctx context.Context, email string) error + FindInvitations func(ctx context.Context) ([]*ttnpb.Invitation, error) + GetInvitation func(ctx context.Context, token string) (*ttnpb.Invitation, error) + SetInvitationAcceptedBy func(ctx context.Context, token string, accepter *ttnpb.UserIdentifiers) error + func GetInvitationStore(db *gorm.DB) InvitationStore + type Location struct + Accuracy int32 + Altitude int32 + Latitude float64 + Longitude float64 + type Membership struct + Account *Account + AccountID string + EntityID string + EntityType string + Rights Rights + type MembershipStore interface + FindIndirectMemberships func(ctx context.Context, userID *ttnpb.UserIdentifiers, entityID ttnpb.Identifiers) ([]IndirectMembership, error) + FindMembers func(ctx context.Context, entityID ttnpb.Identifiers) (map[*ttnpb.OrganizationOrUserIdentifiers]*ttnpb.Rights, error) + FindMemberships func(ctx context.Context, id *ttnpb.OrganizationOrUserIdentifiers, ...) ([]ttnpb.Identifiers, error) + GetMember func(ctx context.Context, id *ttnpb.OrganizationOrUserIdentifiers, ...) (*ttnpb.Rights, error) + SetMember func(ctx context.Context, id *ttnpb.OrganizationOrUserIdentifiers, ...) error + func GetMembershipCache(store MembershipStore, redis *redis.Client, ttl time.Duration) MembershipStore + func GetMembershipStore(db *gorm.DB) MembershipStore + type Migration struct + Name string + type MigrationStore interface + CreateMigration func(ctx context.Context, migration *Migration) error + DeleteMigration func(ctx context.Context, id string) error + FindMigrations func(ctx context.Context) ([]*Migration, error) + GetMigration func(ctx context.Context, id string) (*Migration, error) + func GetMigrationStore(db *gorm.DB) MigrationStore + type Model struct + CreatedAt time.Time + ID string + UpdatedAt time.Time + func (m *Model) SetContext(ctx context.Context) + func (m Model) PrimaryKey() string + type OAuthStore interface + Authorize func(ctx context.Context, req *ttnpb.OAuthClientAuthorization) (authorization *ttnpb.OAuthClientAuthorization, err error) + CreateAccessToken func(ctx context.Context, token *ttnpb.OAuthAccessToken, previousID string) error + CreateAuthorizationCode func(ctx context.Context, code *ttnpb.OAuthAuthorizationCode) error + DeleteAccessToken func(ctx context.Context, id string) error + DeleteAuthorization func(ctx context.Context, userIDs *ttnpb.UserIdentifiers, ...) error + DeleteAuthorizationCode func(ctx context.Context, code string) error + GetAccessToken func(ctx context.Context, id string) (*ttnpb.OAuthAccessToken, error) + GetAuthorization func(ctx context.Context, userIDs *ttnpb.UserIdentifiers, ...) (*ttnpb.OAuthClientAuthorization, error) + GetAuthorizationCode func(ctx context.Context, code string) (*ttnpb.OAuthAuthorizationCode, error) + ListAccessTokens func(ctx context.Context, userIDs *ttnpb.UserIdentifiers, ...) ([]*ttnpb.OAuthAccessToken, error) + ListAuthorizations func(ctx context.Context, userIDs *ttnpb.UserIdentifiers) ([]*ttnpb.OAuthClientAuthorization, error) + func GetOAuthStore(db *gorm.DB) OAuthStore + type Organization struct + APIKeys []APIKey + Account Account + Attributes []Attribute + Description string + Memberships []Membership + Name string + func (org *Organization) AfterDelete(db *gorm.DB) error + func (org *Organization) SetContext(ctx context.Context) + type OrganizationStore interface + CreateOrganization func(ctx context.Context, org *ttnpb.Organization) (*ttnpb.Organization, error) + DeleteOrganization func(ctx context.Context, id *ttnpb.OrganizationIdentifiers) error + FindOrganizations func(ctx context.Context, ids []*ttnpb.OrganizationIdentifiers, ...) ([]*ttnpb.Organization, error) + GetOrganization func(ctx context.Context, id *ttnpb.OrganizationIdentifiers, ...) (*ttnpb.Organization, error) + UpdateOrganization func(ctx context.Context, org *ttnpb.Organization, fieldMask *types.FieldMask) (*ttnpb.Organization, error) + func GetOrganizationStore(db *gorm.DB) OrganizationStore + type Picture struct + Data []byte + type Populator struct + APIKeys map[*ttnpb.EntityIdentifiers][]*ttnpb.APIKey + Applications []*ttnpb.Application + Clients []*ttnpb.Client + Gateways []*ttnpb.Gateway + Memberships map[*ttnpb.EntityIdentifiers][]*ttnpb.Collaborator + Organizations []*ttnpb.Organization + Users []*ttnpb.User + func NewPopulator(size int, seed int64) *Populator + func (p *Populator) Populate(ctx context.Context, db *gorm.DB) (err error) + type Rights ttnpb.Rights + func (r *Rights) Scan(src interface{}) error + func (r Rights) Value() (driver.Value, error) + type SoftDelete struct + DeletedAt *time.Time + type User struct + APIKeys []APIKey + Account Account + Admin bool + Attributes []Attribute + Description string + Name string + Password string + PasswordUpdatedAt time.Time + PrimaryEmailAddress string + PrimaryEmailAddressValidatedAt *time.Time + ProfilePicture *Picture + ProfilePictureID *string + RequirePasswordUpdate bool + Sessions []*UserSession + State int + TemporaryPassword string + TemporaryPasswordCreatedAt *time.Time + TemporaryPasswordExpiresAt *time.Time + func (usr *User) AfterDelete(db *gorm.DB) error + func (usr *User) SetContext(ctx context.Context) + type UserSession struct + ExpiresAt *time.Time + User *User + UserID string + type UserSessionStore interface + CreateSession func(ctx context.Context, sess *ttnpb.UserSession) (*ttnpb.UserSession, error) + DeleteSession func(ctx context.Context, userIDs *ttnpb.UserIdentifiers, sessionID string) error + FindSessions func(ctx context.Context, userIDs *ttnpb.UserIdentifiers) ([]*ttnpb.UserSession, error) + GetSession func(ctx context.Context, userIDs *ttnpb.UserIdentifiers, sessionID string) (*ttnpb.UserSession, error) + UpdateSession func(ctx context.Context, sess *ttnpb.UserSession) (*ttnpb.UserSession, error) + func GetUserSessionStore(db *gorm.DB) UserSessionStore + type UserStore interface + CreateUser func(ctx context.Context, usr *ttnpb.User) (*ttnpb.User, error) + DeleteUser func(ctx context.Context, id *ttnpb.UserIdentifiers) error + FindUsers func(ctx context.Context, ids []*ttnpb.UserIdentifiers, fieldMask *types.FieldMask) ([]*ttnpb.User, error) + GetUser func(ctx context.Context, id *ttnpb.UserIdentifiers, fieldMask *types.FieldMask) (*ttnpb.User, error) + UpdateUser func(ctx context.Context, usr *ttnpb.User, fieldMask *types.FieldMask) (*ttnpb.User, error) + func GetUserStore(db *gorm.DB) UserStore