Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidUserID = errors.New("invalid user ID") ErrInvalidProvider = errors.New("invalid provider") ErrInvalidProviderAccountID = errors.New("invalid provider account ID") )
View Source
var ( ErrInvalidToken = errors.New("invalid token") ErrInvalidExpiresAt = errors.New("invalid expires at") )
View Source
var ( ErrInvalidUserName = errors.New("invalid user name") ErrInvalidRole = errors.New("invalid role") )
Functions ¶
This section is empty.
Types ¶
type APIAccount ¶
type APIAccount struct { ID int `json:"id"` UserID int `json:"user_id"` Provider string `json:"provider"` ProviderAccountID string `json:"provider_account_id"` AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` ExpiresAt time.Time `json:"expires_at"` Scope string `json:"scope"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
func (*APIAccount) ToAccount ¶
func (a *APIAccount) ToAccount() *Account
type APISession ¶
type APISession struct { ID int `json:"id"` Token string `json:"token"` UserID int `json:"user_id"` IPAddress string `json:"ip_address"` ExpiresAt time.Time `json:"expires_at"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
func (*APISession) ToSession ¶
func (s *APISession) ToSession() *Session
type APIUser ¶
type Account ¶
type Account struct { ID int `json:"id"` UserID int `json:"user_id"` Provider string `json:"provider"` ProviderAccountID string `json:"provider_account_id"` AccessToken sql.NullString `json:"access_token"` RefreshToken sql.NullString `json:"refresh_token"` ExpiresAt sql.NullTime `json:"expires_at"` Scope sql.NullString `json:"scope"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
func NewAccount ¶
func (*Account) ToAPIAccount ¶
func (a *Account) ToAPIAccount() *APIAccount
func (*Account) UpdateTokens ¶
type Session ¶
type Session struct { ID int `json:"id"` Token string `json:"token"` UserID int `json:"user_id"` IPAddress sql.NullString `json:"ip_address"` ExpiresAt time.Time `json:"expires_at"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
func NewSession ¶
func (*Session) IsRefreshNeeded ¶
func (*Session) ToAPISession ¶
func (s *Session) ToAPISession() *APISession
type User ¶
type User struct { ID int `json:"id"` Name string `json:"name"` DisplayName sql.NullString `json:"display_name"` Email sql.NullString `json:"email"` Avatar sql.NullString `json:"avatar"` Role Role `json:"role"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
Click to show internal directories.
Click to hide internal directories.