⬆️ dashboard v0.12.26 update gorm fields tags

This commit is contained in:
naiba
2022-04-26 12:46:44 +08:00
parent 0e35862b23
commit b5f33a6c5b
6 changed files with 27 additions and 14 deletions

View File

@@ -1,13 +1,15 @@
package model
import "time"
import (
"time"
)
const CtxKeyAuthorizedUser = "ckau"
const CacheKeyOauth2State = "p:a:state"
type Common struct {
ID uint64 `gorm:"primary_key"`
ID uint64 `gorm:"primaryKey"`
CreatedAt time.Time `sql:"index"`
UpdatedAt time.Time
DeletedAt *time.Time `sql:"index"`

View File

@@ -11,15 +11,15 @@ import (
type User struct {
Common
Login string `gorm:"UNIQUE_INDEX" json:"login,omitempty"` // 登录名
AvatarURL string `json:"avatar_url,omitempty"` // 头像地址
Name string `json:"name,omitempty"` // 昵称
Blog string `json:"blog,omitempty"` // 网站链接
Email string `json:"email,omitempty"` // 邮箱
Login string `gorm:"uniqueIndex" json:"login,omitempty"` // 登录名
AvatarURL string `json:"avatar_url,omitempty"` // 头像地址
Name string `json:"name,omitempty"` // 昵称
Blog string `json:"blog,omitempty"` // 网站链接
Email string `json:"email,omitempty"` // 邮箱
Hireable bool `json:"hireable,omitempty"`
Bio string `json:"bio,omitempty"` // 个人简介
Token string `gorm:"UNIQUE_INDEX" json:"-"` // 认证 Token
Token string `gorm:"uniqueIndex" json:"-"` // 认证 Token
TokenExpired time.Time `json:"token_expired,omitempty"` // Token 过期时间
SuperAdmin bool `json:"super_admin,omitempty"` // 超级管理员
}