20 lines
889 B
Go
20 lines
889 B
Go
package model
|
|
|
|
// 用户的token
|
|
type Token struct {
|
|
Id int64 `gorm:"column:id;primaryKey;autoIncrement"`
|
|
UserId int64 `gorm:"column:user_id;not null;index:idx_token_user_id"`
|
|
Name string `gorm:"column:name;index:idx_token_name"`
|
|
Key string `gorm:"column:key;type:char(48);uniqueIndex:idx_token_key"`
|
|
Status bool `gorm:"column:status;default:true"` // enabled 0, disabled 1
|
|
Quota int64 `gorm:"column:quota;type:bigint;default:0"` // -1 means unlimited
|
|
UnlimitedQuota bool `gorm:"column:unlimited_quota;default:true"`
|
|
UsedQuota int64 `gorm:"column:used_quota;type:bigint;default:0"`
|
|
CreatedTime int64 `gorm:"column:created_time;type:bigint"`
|
|
ExpiredTime int64 `gorm:"column:expired_time;type:bigint;default:-1"` // -1 means never expired
|
|
}
|
|
|
|
func (Token) TableName() string {
|
|
return "token"
|
|
}
|