Documentation ¶
Index ¶
- func MigrateAll(db *gorm.DB) error
- func OauthAccessTokenPreload(db *gorm.DB) *gorm.DB
- func OauthAccessTokenPreloadWithPrefix(db *gorm.DB, prefix string) *gorm.DB
- func OauthAuthorizationCodePreload(db *gorm.DB) *gorm.DB
- func OauthAuthorizationCodePreloadWithPrefix(db *gorm.DB, prefix string) *gorm.DB
- func OauthRefreshTokenPreload(db *gorm.DB) *gorm.DB
- func OauthRefreshTokenPreloadWithPrefix(db *gorm.DB, prefix string) *gorm.DB
- type EmailTokenModel
- type MyGormModel
- type OauthAccessToken
- type OauthAuthorizationCode
- type OauthClient
- type OauthRefreshToken
- type OauthRole
- type OauthScope
- type OauthUser
- type TimestampModel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OauthAccessTokenPreload ¶
OauthAccessTokenPreload sets up Gorm preloads for an access token object
func OauthAccessTokenPreloadWithPrefix ¶
OauthAccessTokenPreloadWithPrefix sets up Gorm preloads for an access token object, and prefixes with prefix for nested objects
func OauthAuthorizationCodePreload ¶
OauthAuthorizationCodePreload sets up Gorm preloads for an auth code object
func OauthAuthorizationCodePreloadWithPrefix ¶
OauthAuthorizationCodePreloadWithPrefix sets up Gorm preloads for an auth code object, and prefixes with prefix for nested objects
func OauthRefreshTokenPreload ¶
OauthRefreshTokenPreload sets up Gorm preloads for a refresh token object
Types ¶
type EmailTokenModel ¶
type EmailTokenModel struct { MyGormModel Reference string `sql:"type:varchar(40);unique;not null"` EmailSent bool `sql:"index;not null"` EmailSentAt *time.Time ExpiresAt time.Time `sql:"index;not null"` }
EmailTokenModel is an abstract model which can be used for objects from which we derive redirect emails (email confirmation, password reset and such)
type MyGormModel ¶
type MyGormModel struct { ID string `gorm:"primary_key"` CreatedAt time.Time UpdatedAt time.Time DeletedAt *time.Time }
MyGormModel mimixks GormModel but uses uuid's for ID, generated in go
type OauthAccessToken ¶
type OauthAccessToken struct { MyGormModel ClientID sql.NullString `sql:"index;not null"` UserID sql.NullString `sql:"index"` Client *OauthClient User *OauthUser Token string `sql:"type:varchar(40);unique;not null"` ExpiresAt time.Time `sql:"not null"` Scope string `sql:"type:varchar(200);not null"` }
OauthAccessToken ...
func NewOauthAccessToken ¶
func NewOauthAccessToken(client *OauthClient, user *OauthUser, expiresIn int, scope string) *OauthAccessToken
NewOauthAccessToken creates new OauthAccessToken instance
func (*OauthAccessToken) TableName ¶
func (at *OauthAccessToken) TableName() string
TableName specifies table name
type OauthAuthorizationCode ¶
type OauthAuthorizationCode struct { MyGormModel ClientID sql.NullString `sql:"index;not null"` UserID sql.NullString `sql:"index;not null"` Client *OauthClient User *OauthUser Code string `sql:"type:varchar(40);unique;not null"` RedirectURI sql.NullString `sql:"type:varchar(200)"` ExpiresAt time.Time `sql:"not null"` Scope string `sql:"type:varchar(200);not null"` }
OauthAuthorizationCode ...
func NewOauthAuthorizationCode ¶
func NewOauthAuthorizationCode(client *OauthClient, user *OauthUser, expiresIn int, redirectURI, scope string) *OauthAuthorizationCode
NewOauthAuthorizationCode creates new OauthAuthorizationCode instance
func (*OauthAuthorizationCode) TableName ¶
func (ac *OauthAuthorizationCode) TableName() string
TableName specifies table name
type OauthClient ¶
type OauthClient struct { MyGormModel Key string `sql:"type:varchar(254);unique;not null"` Secret string `sql:"type:varchar(60);not null"` RedirectURI sql.NullString `sql:"type:varchar(200)"` }
OauthClient ...
func (*OauthClient) TableName ¶
func (c *OauthClient) TableName() string
TableName specifies table name
type OauthRefreshToken ¶
type OauthRefreshToken struct { MyGormModel ClientID sql.NullString `sql:"index;not null"` UserID sql.NullString `sql:"index"` Client *OauthClient User *OauthUser Token string `sql:"type:varchar(40);unique;not null"` ExpiresAt time.Time `sql:"not null"` Scope string `sql:"type:varchar(200);not null"` }
OauthRefreshToken ...
func NewOauthRefreshToken ¶
func NewOauthRefreshToken(client *OauthClient, user *OauthUser, expiresIn int, scope string) *OauthRefreshToken
NewOauthRefreshToken creates new OauthRefreshToken instance
func (*OauthRefreshToken) TableName ¶
func (rt *OauthRefreshToken) TableName() string
TableName specifies table name
type OauthRole ¶
type OauthRole struct { TimestampModel ID string `gorm:"primary_key" sql:"type:varchar(20)"` Name string `sql:"type:varchar(50);unique;not null"` }
OauthRole is a one of roles user can have (currently superuser or user)
type OauthScope ¶
type OauthScope struct { MyGormModel Scope string `sql:"type:varchar(200);unique;not null"` Description sql.NullString IsDefault bool `sql:"default:false"` }
OauthScope ...
func (*OauthScope) TableName ¶
func (s *OauthScope) TableName() string
TableName specifies table name
type OauthUser ¶
type OauthUser struct { MyGormModel RoleID sql.NullString `sql:"type:varchar(20);index;not null"` Role *OauthRole Username string `sql:"type:varchar(254);unique;not null"` Password sql.NullString `sql:"type:varchar(60)"` MetaUserID string `sql:"index"` }
OauthUser ...