30 lines
910 B
Go
30 lines
910 B
Go
package token
|
|
|
|
import "time"
|
|
|
|
// 用户的身份令牌
|
|
type Token struct {
|
|
// TokenId
|
|
Id uint `json:"id" gorm:"primaryKey;column:id"`
|
|
// 用户Id
|
|
RefUserId string `json:"ref_user_id" gorm:"column:ref_user_id"`
|
|
// 访问令牌
|
|
AccessToken string `json:"access_token" gorm:"column:access_token;unique;index"`
|
|
// 访问Token过期时间
|
|
AccessTokenExpireAt *time.Time `json:"access_token_expire_at" gorm:"column:access_token_expire_at"`
|
|
// 令牌办法的时间
|
|
IssueAt time.Time `json:"issue_at" gorm:"column:issue_at"`
|
|
|
|
// 刷新Token
|
|
RefreshToken string `json:"refresh_token" gorm:"column:refresh_token;unique;index"`
|
|
// 刷新Token过期时间
|
|
RefreshTokenExpireAt *time.Time `json:"refresh_token_expire_at" gorm:"column:refresh_token_expire_at"`
|
|
|
|
// 关联查询 需要查询出来
|
|
RefUserName string `json:"ref_user_name" gorm:"-"`
|
|
}
|
|
|
|
func (t *Token) TableName() string {
|
|
return "tokens"
|
|
}
|