Documentation
¶
Index ¶
- type Account
- type AccountData
- type AccountDataBase
- type AccountRecord
- type AccountsOfUser
- func (ua *AccountsOfUser) AddAccount(userAccount Account) (changed bool)
- func (ua *AccountsOfUser) GetAccount(provider, app string) (userAccount *Account, err error)
- func (ua *AccountsOfUser) GetAccounts(platform string) (userAccounts []Account, err error)
- func (ua *AccountsOfUser) GetFbAccount(app string) (userAccount *Account, err error)
- func (ua *AccountsOfUser) GetFbAccounts() (userAccounts []Account, err error)
- func (ua *AccountsOfUser) GetFbmAccount(fbPageID string) (userAccount *Account, err error)
- func (ua *AccountsOfUser) GetGoogleAccount() (userAccount *Account, err error)
- func (ua *AccountsOfUser) GetTelegramAccounts() (telegramAccounts []Account)
- func (ua *AccountsOfUser) GetTelegramUserIDs() (telegramUserIDs []int64)
- func (ua *AccountsOfUser) HasAccount(provider, app string) bool
- func (ua *AccountsOfUser) HasGoogleAccount() bool
- func (ua *AccountsOfUser) HasTelegramAccount() bool
- func (ua *AccountsOfUser) RemoveAccount(userAccount Account) (changed bool)
- func (ua *AccountsOfUser) SetBotUserID(platform, botID, botUserID string)
- type BelongsToUser
- type BelongsToUserWithIntID
- type EmailData
- type LastLogin
- type Names
- type OwnedByUserWithID
- func (ownedByUser *OwnedByUserWithID) GetAppUserID() string
- func (ownedByUser *OwnedByUserWithID) GetAppUserIntID() int64
- func (ownedByUser *OwnedByUserWithID) GetCreatedTime() time.Time
- func (ownedByUser *OwnedByUserWithID) GetUpdatedTime() time.Time
- func (ownedByUser *OwnedByUserWithID) SetAppUserID(appUserID string)
- func (ownedByUser *OwnedByUserWithID) SetAppUserIntID(appUserID int64)
- func (ownedByUser *OwnedByUserWithID) SetCreatedTime(v time.Time)
- func (ownedByUser *OwnedByUserWithID) SetUpdatedTime(v time.Time)
- func (ownedByUser *OwnedByUserWithID) Validate() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct {
// Global ID of Account
Provider string // E.g. Email, Google, Facebook, etc.
App string
ID string // An ID of a user at auth provider. E.g. email address, some ID, etc.
}
Account stores info about user account with auth provider
func ParseUserAccount ¶
type AccountData ¶ added in v0.0.4
type AccountData interface {
BelongsToUser
GetEmailLowerCase() string
GetEmailConfirmed() bool
SetLastLogin(time time.Time)
GetNames() Names
}
AccountData stores info about user account with auth provider
type AccountDataBase ¶ added in v0.5.0
type AccountDataBase struct {
Account
OwnedByUserWithID
Names
LastLogin
EmailData
Admin bool
// ClientID is an OAuth2 client ID
ClientID string
FederatedIdentity string `dalgo:",noindex" datastore:",noindex"`
FederatedProvider string `dalgo:",noindex" datastore:",noindex"`
}
func (*AccountDataBase) GetNames ¶ added in v0.5.0
func (a *AccountDataBase) GetNames() Names
func (*AccountDataBase) SetLastLogin ¶ added in v0.5.0
func (a *AccountDataBase) SetLastLogin(time time.Time)
type AccountRecord ¶
type AccountRecord interface {
Key() Account
Data() AccountData
}
type AccountsOfUser ¶
type AccountsOfUser struct {
// Member of TgUserEntity class
Accounts []string `datastore:",noindex"`
}
func (*AccountsOfUser) AddAccount ¶
func (ua *AccountsOfUser) AddAccount(userAccount Account) (changed bool)
func (*AccountsOfUser) GetAccount ¶
func (ua *AccountsOfUser) GetAccount(provider, app string) (userAccount *Account, err error)
GetAccount returns the first account of the given provider and app.
func (*AccountsOfUser) GetAccounts ¶
func (ua *AccountsOfUser) GetAccounts(platform string) (userAccounts []Account, err error)
func (*AccountsOfUser) GetFbAccount ¶
func (ua *AccountsOfUser) GetFbAccount(app string) (userAccount *Account, err error)
func (*AccountsOfUser) GetFbAccounts ¶
func (ua *AccountsOfUser) GetFbAccounts() (userAccounts []Account, err error)
func (*AccountsOfUser) GetFbmAccount ¶
func (ua *AccountsOfUser) GetFbmAccount(fbPageID string) (userAccount *Account, err error)
func (*AccountsOfUser) GetGoogleAccount ¶
func (ua *AccountsOfUser) GetGoogleAccount() (userAccount *Account, err error)
func (*AccountsOfUser) GetTelegramAccounts ¶
func (ua *AccountsOfUser) GetTelegramAccounts() (telegramAccounts []Account)
func (*AccountsOfUser) GetTelegramUserIDs ¶
func (ua *AccountsOfUser) GetTelegramUserIDs() (telegramUserIDs []int64)
func (*AccountsOfUser) HasAccount ¶
func (ua *AccountsOfUser) HasAccount(provider, app string) bool
func (*AccountsOfUser) HasGoogleAccount ¶
func (ua *AccountsOfUser) HasGoogleAccount() bool
func (*AccountsOfUser) HasTelegramAccount ¶
func (ua *AccountsOfUser) HasTelegramAccount() bool
func (*AccountsOfUser) RemoveAccount ¶
func (ua *AccountsOfUser) RemoveAccount(userAccount Account) (changed bool)
RemoveAccount removes account from the list of account IDs.
func (*AccountsOfUser) SetBotUserID ¶
func (ua *AccountsOfUser) SetBotUserID(platform, botID, botUserID string)
type BelongsToUser ¶
type BelongsToUser interface {
GetAppUserID() (appUserID string)
SetAppUserID(appUserID string)
GetCreatedTime() time.Time
GetUpdatedTime() time.Time
SetUpdatedTime(time.Time)
}
BelongsToUser should be implemented by any struct that belongs to a single user
type BelongsToUserWithIntID ¶
type BelongsToUserWithIntID interface {
BelongsToUser
GetAppUserIntID() (appUserID int64)
SetAppUserIntID(appUserID int64)
}
BelongsToUserWithIntID is deprecated. Remove once OwnedByUserWithID.AppUserIntID is removed.
type EmailData ¶ added in v0.5.5
type EmailData struct {
// Deprecated: use EmailRaw & EmailLowerCase instead
Email string `dalgo:",noindex" datastore:",noindex"` // TODO: remove once old records migrated to new format that uses EmailRaw & EmailLowerCase
EmailRaw string `dalgo:",noindex" datastore:",noindex"`
EmailLowerCase string
EmailConfirmed bool
}
EmailData stores info about email
func NewEmailData ¶ added in v0.5.5
func (*EmailData) GetEmailConfirmed ¶ added in v0.5.5
func (*EmailData) GetEmailLowerCase ¶ added in v0.5.5
func (*EmailData) GetEmailRaw ¶ added in v0.5.5
func (*EmailData) SetEmailConfirmed ¶ added in v0.5.5
type LastLogin ¶
LastLogin is a struct that contains the last login time of a user.
func (*LastLogin) SetLastLogin ¶
SetLastLogin sets the last login time of a user.
type Names ¶
type OwnedByUserWithID ¶ added in v0.3.1
type OwnedByUserWithID struct {
AppUserID string // intentionally indexed & do NOT omitempty (so we can find records with empty AppUserID)
// AppUserIntID is a strongly typed integer ID of a user
// Deprecated: use AppUserID instead. Remove BelongsToUserWithIntID once AppUserIntID is removed.
AppUserIntID int64
DtCreated time.Time `json:",omitempty" datastore:",omitempty" firestore:",omitempty"`
DtUpdated time.Time `json:",omitempty" datastore:",omitempty" firestore:",omitempty"`
}
OwnedByUserWithID is a struct that implements BelongsToUser & BelongsToUserWithIntID
func NewOwnedByUserWithID ¶ added in v0.4.1
func NewOwnedByUserWithID(id string, created time.Time) OwnedByUserWithID
NewOwnedByUserWithID creates a new OwnedByUserWithID, takes user ID and time of creation
func (*OwnedByUserWithID) GetAppUserID ¶ added in v0.3.1
func (ownedByUser *OwnedByUserWithID) GetAppUserID() string
func (*OwnedByUserWithID) GetAppUserIntID ¶ added in v0.3.1
func (ownedByUser *OwnedByUserWithID) GetAppUserIntID() int64
func (*OwnedByUserWithID) GetCreatedTime ¶ added in v0.5.0
func (ownedByUser *OwnedByUserWithID) GetCreatedTime() time.Time
func (*OwnedByUserWithID) GetUpdatedTime ¶ added in v0.5.0
func (ownedByUser *OwnedByUserWithID) GetUpdatedTime() time.Time
func (*OwnedByUserWithID) SetAppUserID ¶ added in v0.3.1
func (ownedByUser *OwnedByUserWithID) SetAppUserID(appUserID string)
func (*OwnedByUserWithID) SetAppUserIntID ¶ added in v0.3.1
func (ownedByUser *OwnedByUserWithID) SetAppUserIntID(appUserID int64)
func (*OwnedByUserWithID) SetCreatedTime ¶ added in v0.3.1
func (ownedByUser *OwnedByUserWithID) SetCreatedTime(v time.Time)
func (*OwnedByUserWithID) SetUpdatedTime ¶ added in v0.3.1
func (ownedByUser *OwnedByUserWithID) SetUpdatedTime(v time.Time)
func (*OwnedByUserWithID) Validate ¶ added in v0.3.1
func (ownedByUser *OwnedByUserWithID) Validate() error