Documentation ¶
Index ¶
- type AccountData
- type AccountDataBase
- type AccountKey
- type AccountRecord
- type AccountsOfUser
- func (ua *AccountsOfUser) AddAccount(userAccount AccountKey) (changed bool)
- func (ua *AccountsOfUser) GetAccount(provider, app string) (userAccount *AccountKey, err error)
- func (ua *AccountsOfUser) GetAccounts(platform string) (userAccounts []AccountKey, err error)
- func (ua *AccountsOfUser) GetFbAccount(app string) (userAccount *AccountKey, err error)deprecated
- func (ua *AccountsOfUser) GetFbAccounts() (userAccounts []AccountKey, err error)deprecated
- func (ua *AccountsOfUser) GetFbmAccount(fbPageID string) (userAccount *AccountKey, err error)deprecated
- func (ua *AccountsOfUser) GetGoogleAccount() (userAccount *AccountKey, err error)deprecated
- func (ua *AccountsOfUser) GetTelegramAccounts() (telegramAccounts []AccountKey, er error)deprecated
- func (ua *AccountsOfUser) GetTelegramUserIDs() (telegramUserIDs []int64)
- func (ua *AccountsOfUser) HasAccount(provider, app string) bool
- func (ua *AccountsOfUser) HasGoogleAccount() booldeprecated
- func (ua *AccountsOfUser) HasTelegramAccount() booldeprecated
- func (ua *AccountsOfUser) RemoveAccount(userAccount AccountKey) (changed bool)
- func (ua *AccountsOfUser) SetBotUserID(platform, botID, botUserID string)
- type BaseUserData
- type BaseUserFields
- type BelongsToUser
- type EmailData
- type LastLogin
- type OwnedByUserWithID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountData ¶
type AccountData interface { BelongsToUser GetEmailLowerCase() string GetEmailConfirmed() bool SetLastLogin(time time.Time) GetNames() person.NameFields }
AccountData stores info about user account with auth provider
type AccountDataBase ¶
type AccountDataBase struct { AccountKey OwnedByUserWithID person.NameFields LastLogin EmailData Domains []string `json:"domains" dalgo:"domains" firestore:"domains"` // E.g. website domain names used to authenticate user 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 ¶
func (a *AccountDataBase) GetNames() person.NameFields
func (*AccountDataBase) SetLastLogin ¶
func (a *AccountDataBase) SetLastLogin(time time.Time)
type AccountKey ¶ added in v0.10.0
type AccountKey struct { // Global ID of AccountKey Provider string `json:"provider" dalgo:"provider" firestore:"dalgo"` // E.g. Email, Google, Facebook, etc. App string `json:"app" dalgo:"app" firestore:"app"` // E.g. app ID, bot ID, etc. ID string `json:"id" dalgo:"id" firestore:"id"` // An ID of a user at auth provider. E.g. email address, some ID, etc. }
AccountKey stores info about user account with auth provider
func ParseUserAccount ¶
func ParseUserAccount(s string) (ua AccountKey, err error)
func (AccountKey) String ¶ added in v0.10.0
func (ua AccountKey) String() string
type AccountRecord ¶
type AccountRecord interface { Key() AccountKey Data() AccountData }
type AccountsOfUser ¶
type AccountsOfUser struct {
Accounts []string `datastore:",noindex"`
}
func (*AccountsOfUser) AddAccount ¶
func (ua *AccountsOfUser) AddAccount(userAccount AccountKey) (changed bool)
func (*AccountsOfUser) GetAccount ¶
func (ua *AccountsOfUser) GetAccount(provider, app string) (userAccount *AccountKey, err error)
GetAccount returns the first account of the given provider and app.
func (*AccountsOfUser) GetAccounts ¶
func (ua *AccountsOfUser) GetAccounts(platform string) (userAccounts []AccountKey, err error)
func (*AccountsOfUser) GetFbAccount
deprecated
func (ua *AccountsOfUser) GetFbAccount(app string) (userAccount *AccountKey, err error)
Deprecated: use GetAccount instead
func (*AccountsOfUser) GetFbAccounts
deprecated
func (ua *AccountsOfUser) GetFbAccounts() (userAccounts []AccountKey, err error)
Deprecated: use GetAccounts instead
func (*AccountsOfUser) GetFbmAccount
deprecated
func (ua *AccountsOfUser) GetFbmAccount(fbPageID string) (userAccount *AccountKey, err error)
Deprecated: use GetAccount instead
func (*AccountsOfUser) GetGoogleAccount
deprecated
func (ua *AccountsOfUser) GetGoogleAccount() (userAccount *AccountKey, err error)
Deprecated: use GetAccounts instead
func (*AccountsOfUser) GetTelegramAccounts
deprecated
func (ua *AccountsOfUser) GetTelegramAccounts() (telegramAccounts []AccountKey, er error)
Deprecated: use GetAccounts instead
func (*AccountsOfUser) GetTelegramUserIDs ¶
func (ua *AccountsOfUser) GetTelegramUserIDs() (telegramUserIDs []int64)
func (*AccountsOfUser) HasAccount ¶
func (ua *AccountsOfUser) HasAccount(provider, app string) bool
func (*AccountsOfUser) HasGoogleAccount
deprecated
func (ua *AccountsOfUser) HasGoogleAccount() bool
Deprecated: use HasAccount instead
func (*AccountsOfUser) HasTelegramAccount
deprecated
func (ua *AccountsOfUser) HasTelegramAccount() bool
Deprecated: use HasAccount instead
func (*AccountsOfUser) RemoveAccount ¶
func (ua *AccountsOfUser) RemoveAccount(userAccount AccountKey) (changed bool)
RemoveAccount removes account from the list of account IDs.
func (*AccountsOfUser) SetBotUserID ¶
func (ua *AccountsOfUser) SetBotUserID(platform, botID, botUserID string)
type BaseUserData ¶
type BaseUserData interface { person.NamesHolder with.PreferredLocaleHolder with.CreatedTimeGetter with.UpdatedTimeGetter with.UpdateTimeSetter }
BaseUserData defines base app user interface to standardize how plugins & frameworks can work with a custom app user record. The easiest way to implement this interface is to embed BaseUserFields struct into your app user record struct.
type BaseUserFields ¶
type BaseUserFields struct { person.NameFields with.CreatedFields with.UpdatedFields with.PreferredLocaleField AccountsOfUser // TODO: Reconsider if this should be part of base implementation, if yes extend BaseUserData interface }
BaseUserFields provides a base implementation of BaseUserData interface.
func (BaseUserFields) Validate ¶ added in v0.11.0
func (v BaseUserFields) Validate() error
type BelongsToUser ¶
type BelongsToUser interface { GetAppUserID() (appUserID string) SetAppUserID(appUserID string) with.CreatedTimeGetter with.UpdatedTimeGetter with.UpdateTimeSetter }
BelongsToUser should be implemented by any struct that belongs to a single user
type EmailData ¶
type EmailData struct { //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 ¶
func (*EmailData) GetEmailConfirmed ¶
func (*EmailData) GetEmailLowerCase ¶
func (*EmailData) GetEmailRaw ¶
func (*EmailData) SetEmailConfirmed ¶
type LastLogin ¶
type LastLogin struct {
DtLastLogin time.Time `json:"dtLastLogin" dalgo:"dtLastLogin" datastore:"dtLastLogin"`
}
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 OwnedByUserWithID ¶
type OwnedByUserWithID struct { AppUserID string // intentionally indexed & do NOT omitempty (so we can find records with empty AppUserID) with.CreatedFields with.UpdatedFields }
OwnedByUserWithID is a struct that implements BelongsToUser & BelongsToUserWithIntID
func NewOwnedByUserWithID ¶
func NewOwnedByUserWithID(id string, created time.Time) OwnedByUserWithID
NewOwnedByUserWithID creates a new OwnedByUserWithID, takes user ID and time of creation
func (*OwnedByUserWithID) GetAppUserID ¶
func (ownedByUser *OwnedByUserWithID) GetAppUserID() string
func (*OwnedByUserWithID) SetAppUserID ¶
func (ownedByUser *OwnedByUserWithID) SetAppUserID(appUserID string)
func (*OwnedByUserWithID) SetAppUserIntID ¶
func (ownedByUser *OwnedByUserWithID) SetAppUserIntID(appUserID int64)
func (*OwnedByUserWithID) Validate ¶
func (ownedByUser *OwnedByUserWithID) Validate() error