Documentation ¶
Index ¶
Constants ¶
View Source
const (
ActivateEmailTemplatePath = "./views/activate.mailer.tmpl"
)
Variables ¶
View Source
var ErrSessionNotFound = errors.New("not found")
Functions ¶
This section is empty.
Types ¶
type Base ¶
type Base struct { CreatedAt time.Time UpdatedAt time.Time DeletedAt gorm.DeletedAt `gorm:"index"` }
Base 基础模型,公共模型
type Permission ¶
type Permission struct { ID uint `gorm:"primaryKey"` Code string `gorm:"type:varchar(64);uniqueIndex;not null"` Name string `gorm:"type:varchar(64);not null"` Description *string `gorm:"type:varchar(256)"` *Base }
Permission 权限表结构
func (Permission) ToDto ¶
func (p Permission) ToDto() *dto.PermissionResponse
type Role ¶
type Role struct { ID uint `gorm:"primaryKey"` Code string `gorm:"type:varchar(64);uniqueIndex;not null"` Name string `gorm:"type:varchar(64);not null"` Description string `gorm:"type:varchar(256)"` Permissions []*Permission `gorm:"many2many:role_permissions"` *Base }
Role 角色表结构
func (*Role) ToDto ¶
func (r *Role) ToDto() *dto.RoleResponse
type Session ¶
type Session struct { // token id TID string `redis:"tid" json:"tid"` // 用户 id UID uint `redis:"uid" json:"uid"` RefreshToken string `redis:"refresh_token" json:"refresh_token"` // 设置 redis 不扫描,以字符串格式存储 ExpiresAt time.Time `redis:"_" json:"expires_at"` CreatedAt time.Time `redis:"_" json:"created_at"` UserAgent string `redis:"user_agent" json:"user_agent"` ClientIP string `redis:"client_ip" json:"client_ip"` }
Session 登录 Session
type User ¶
type User struct { ID uint `gorm:"primaryKey"` Name string `gorm:"type:varchar(16);not null"` Email string `gorm:"type:varchar(255);uniqueIndex;not null"` Password string `gorm:"type:varchar(64);not null;"` Avatar *string `gorm:"type:varchar(255)"` ActivatedAt *time.Time VerifyCode *string `gorm:"type:varchar(255);comment '注册时激活账号发送邮件的签名'"` Roles []*Role `gorm:"many2many:user_roles"` *Base }
User 用户表结构
func (*User) ComparePassword ¶
func (*User) SetActivateEmailMessage ¶
func (*User) SetPassword ¶
func (*User) ToDto ¶
func (u *User) ToDto() *dto.UserResponse
Click to show internal directories.
Click to hide internal directories.