Documentation ¶
Overview ¶
Package model is the initial database driver and define the data structures corresponding to the tables.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrCacheNotFound No hit cache ErrCacheNotFound = redis.Nil // ErrRecordNotFound no records found ErrRecordNotFound = gorm.ErrRecordNotFound )
Functions ¶
Types ¶
type CacheType ¶
type CacheType struct { CType string // cache type memory or redis Rdb *redis.Client // if CType=redis, Rdb cannot be empty }
CacheType cache type
type UserExample ¶
type UserExample struct { mysql.Model `gorm:"embedded"` Name string `gorm:"column:name;NOT NULL" json:"name"` // username Password string `gorm:"column:password;NOT NULL" json:"password"` // password Email string `gorm:"column:email;NOT NULL" json:"email"` // email Phone string `gorm:"column:phone;NOT NULL" json:"phone"` // phone number Avatar string `gorm:"column:avatar;NOT NULL" json:"avatar"` // avatar Age int `gorm:"column:age;NOT NULL" json:"age"` // age Gender int `gorm:"column:gender;NOT NULL" json:"gender"` // gender, 1:Male, 2:Female, other values:unknown Status int `gorm:"column:status;NOT NULL" json:"status"` // account status, 1:inactive, 2:activated, 3:blocked LoginAt int64 `gorm:"column:login_at;NOT NULL" json:"loginAt"` // login timestamp }
UserExample object fields mapping table
func (*UserExample) TableName ¶
func (table *UserExample) TableName() string
TableName get table name
Click to show internal directories.
Click to hide internal directories.