Documentation ¶
Index ¶
- func NewCreateSession(db database.Database) auth.CreateSessionRepository
- func NewDeleteSession(db database.Database) auth.DeleteSessionRepository
- func NewGetLoggedUser(db database.Database) auth.GetLoggedUsr
- func NewGetSingleSession(db database.Database) auth.GetSingleSessionRepository
- func NewUpdateSession(db database.Database) auth.UpdateSessionRepository
- type SessionModel
- type UserModel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCreateSession ¶
func NewCreateSession(db database.Database) auth.CreateSessionRepository
NewCreateSession return a auth.CreateSessionRepository implementation
func NewDeleteSession ¶
func NewDeleteSession(db database.Database) auth.DeleteSessionRepository
NewDeleteSession will return auth.DeleteSessionRepository
func NewGetLoggedUser ¶
func NewGetLoggedUser(db database.Database) auth.GetLoggedUsr
func NewGetSingleSession ¶
func NewGetSingleSession(db database.Database) auth.GetSingleSessionRepository
NewGetSginelSession returns an auth.GetSingleSessionRepository implementation
func NewUpdateSession ¶
func NewUpdateSession(db database.Database) auth.UpdateSessionRepository
NewUpdateSession returns an auth.UpdateSessionRepository implementation
Types ¶
type SessionModel ¶
type SessionModel struct { SessID string `gorm:"primary_key;column:session_id;type:uuid;default:uuid_generate_v4();index:idx_sess_id"` UserID string `gorm:"column:usr_id;type:uuid;unique;index:idx_usr_id;not null"` Expiration time.Time `gorm:"column:expiration;type:timestamp with time zone;not null"` AccessToken string `gorm:"column:access_token;type:text;not null"` RefreshToken string `gorm:"column:refresh_token;type:text;not null"` }
SessionModel represents how a session is stored in the database
func (*SessionModel) AsDomain ¶
func (sm *SessionModel) AsDomain() auth.Session
AsDomain will return a SessionModel as auth.Session
func (*SessionModel) BeforeCreate ¶
func (sm *SessionModel) BeforeCreate(*gorm.DB) error
BeforeCreate is a hook to set the expiration field
Read more about GORM hooks:
func (*SessionModel) TableName ¶
func (sm *SessionModel) TableName() string
TableName overrides the table name used by SessionModel to `sessions`
Read more about GORM conventions:
type UserModel ¶
type UserModel struct { ID string `gorm:"primary_key;column:usr_id;type:uuid;default:uuid_generate_v4();index:idx_usr_id"` Email string `gorm:"column:usr_email;unique;type:varchar(255);"` Type string `gorm:"column:usr_scope;type:varchar(64);default:student"` CreatedAt time.Time `gorm:"column:usr_created_at;type:timestamp with time zone;default:now()"` UpdatedAt time.Time `gorm:"column:usr_updated_at;type:timestamp with time zone;default:now()"` }
UserModel represents how a student is stored in the database.
Click to show internal directories.
Click to hide internal directories.