Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthCode ¶
type AuthCode struct {
Code string
ClientID string
UserID string
RedirectURI string
Scope string
Nonce string
ExpiresAt time.Time
CodeChallenge string // PKCE
CodeChallengeMethod string // "S256" or "plain"
}
map structs
type Client ¶
type Client struct {
bun.BaseModel `bun:"table:clients_info,alias:ci"`
ID string `bun:"id,pk,unique,type:varchar(255)" json:"id"`
UserID string `bun:"user_id,unique,notnull,type:varchar(255)" json:"user_id"`
ClientSecret string `bun:"client_secret,notnull,type:varchar(255)" json:"client_secret,omitempty"`
PublicKeyEndpoint string `bun:"public_key,type:text" json:"public_key"`
RedirectURIs StringList `bun:"redirect_uris,type:text" json:"redirect_uris"`
Scopes StringList `bun:"scopes,type:text" json:"scopes"`
Timestamps
User *User `bun:"rel:belongs-to,join:user_id=id" json:"-"`
}
type DBToken ¶
type DBToken struct {
bun.BaseModel `bun:"table:tokens,alias:t"`
ID string `bun:"id,pk,unique,type:varchar(255)"`
IdentityID string `bun:"identity_id,notnull,type:varchar(255)"`
UserID string `bun:"user_id,type:varchar(255)"`
AccessToken string `bun:"access_token,notnull"`
RefreshToken string `bun:"refresh_token"`
TokenType string `bun:"token_type"`
TokenUse string `bun:"token_use,type:varchar(32)"`
ExpiresIn int `bun:"expires_in"`
Scope string `bun:"scope"`
Nonce string `bun:"nonce"`
ClientID string `bun:"client_id"`
ExpiresAt time.Time `bun:"expires_at"`
Timestamps
Identity *UserIdentity `bun:"rel:belongs-to,join:identity_id=id"`
}
type PasswordReset ¶
type PasswordReset struct {
bun.BaseModel `bun:"table:password_resets,alias:pr"`
ID string `bun:"id,pk,unique,type:varchar(255)"`
UserID string `bun:"user_id,notnull,type:varchar(255)"`
Email string `bun:"email,notnull"`
CodeHash string `bun:"code_hash,notnull"`
ExpiresAt time.Time `bun:"expires_at,notnull"`
Used bool `bun:"used,notnull,default:false"`
Timestamps
}
type StringList ¶
type StringList []string
custom-types
func (*StringList) Scan ¶
func (sl *StringList) Scan(value interface{}) error
type Timestamps ¶
type Timestamps struct {
CreatedAt time.Time `bun:"created_at,nullzero,notnull,default:current_timestamp" json:"created_at"`
UpdatedAt time.Time `bun:"updated_at,nullzero,notnull,default:current_timestamp" json:"updated_at"`
}
func (*Timestamps) BeforeAppendModel ¶
type User ¶
type User struct {
bun.BaseModel `bun:"table:users,alias:u"`
ID string `bun:"id,pk,unique,type:varchar(255)" json:"id"`
Email string `bun:"email,unique,notnull" json:"email"`
PasswordHash string `bun:"password_hash" json:"-"`
Role string `bun:"role,notnull,default:'user'" json:"role"`
Audience string `bun:"audience,notnull,default:'mesh'" json:"aud"`
EmailConfirmed bool `bun:"email_confirmed,notnull,default:false" json:"email_confirmed"`
Name string `bun:"name,unique" json:"username"`
GivenName string `bun:"given_name" json:"name"`
Picture string `bun:"picture" json:"avatar_url"`
Timestamps
Identities []*UserIdentity `bun:"rel:has-many,join:id=user_id"`
}
bun table structs
type UserIdentity ¶
type UserIdentity struct {
bun.BaseModel `bun:"table:user_identities,alias:ui"`
ID string `bun:"id,pk,unique,type:varchar(255)" json:"ui_id"`
UserID string `bun:"user_id,notnull,type:varchar(255)"`
Sub string `bun:"sub,notnull,unique:sub_provider_idx" json:"sub"`
Provider string `bun:"provider,notnull,unique:sub_provider_idx" json:"provider"`
Timestamps
User *User `bun:"rel:belongs-to,join:user_id=id"`
Tokens []*DBToken `bun:"rel:has-many,join:id=identity_id"`
}
Click to show internal directories.
Click to hide internal directories.