From 6d1d0f3b6b1f2dd42f47f79006327bae33c679cc Mon Sep 17 00:00:00 2001 From: Sakurasan <26715255+Sakurasan@users.noreply.github.com> Date: Tue, 22 Apr 2025 02:08:32 +0800 Subject: [PATCH] up --- internal/model/token.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/internal/model/token.go b/internal/model/token.go index 60e9733..65d398e 100644 --- a/internal/model/token.go +++ b/internal/model/token.go @@ -2,19 +2,19 @@ package model // 用户的token type Token struct { - ID int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id,omitempty"` - UserID int64 `gorm:"column:user_id;not null;index:idx_token_user_id" json:"userid,omitempty"` - Name string `gorm:"column:name;not null;index:idx_token_name" json:"name,omitempty" binding:"required,min=1,max=20"` - Key string `gorm:"column:key;not null;uniqueIndex:idx_token_key;comment:token key" json:"key,omitempty"` - Active *bool `gorm:"column:active;default:true" json:"active,omitempty"` // - Quota *int64 `gorm:"column:quota;type:bigint;default:0" json:"quota,omitempty"` // default 0 - UnlimitedQuota *bool `gorm:"column:unlimited_quota;default:true" json:"unlimited_quota,omitempty"` // set Quota 1 unlimited - UsedQuota *int64 `gorm:"column:used_quota;type:bigint;default:0" json:"used_quota,omitempty"` - ExpiredAt *int64 `gorm:"column:expired_at;type:bigint;default:0" json:"expired_at,omitempty"` - NeverExpired *bool `gorm:"column:never_expires;type:bigint;" json:"never_expires,omitempty"` - CreatedAt int64 `gorm:"column:created_at;type:bigint;autoCreateTime" json:"created_at,omitempty"` - LastUsedAt int64 `gorm:"column:lastused_at;type:bigint;autoUpdateTime" json:"lastused_at,omitempty"` - User *User `gorm:"foreignKey:UserID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"-"` + ID int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id,omitempty"` + UserID int64 `gorm:"column:user_id;not null;index:idx_token_user_id" json:"userid,omitempty"` + Name string `gorm:"column:name;not null;index:idx_token_name" json:"name,omitempty" binding:"required,min=1,max=20"` + Key string `gorm:"column:key;not null;uniqueIndex:idx_token_key;comment:token key" json:"key,omitempty"` + Active *bool `gorm:"column:active;default:true" json:"active,omitempty"` // + Quota *float64 `gorm:"column:quota;type:bigint;default:0" json:"quota,omitempty"` // default 0 + UnlimitedQuota *bool `gorm:"column:unlimited_quota;default:true" json:"unlimited_quota,omitempty"` // set Quota 1 unlimited + UsedQuota *float64 `gorm:"column:used_quota;type:bigint;default:0" json:"used_quota,omitempty"` + ExpiredAt *int64 `gorm:"column:expired_at;type:bigint;default:0" json:"expired_at,omitempty"` + NeverExpired *bool `gorm:"column:never_expires;type:bigint;" json:"never_expires,omitempty"` + CreatedAt int64 `gorm:"column:created_at;type:bigint;autoCreateTime" json:"created_at,omitempty"` + LastUsedAt int64 `gorm:"column:lastused_at;type:bigint;autoUpdateTime" json:"lastused_at,omitempty"` + User *User `gorm:"foreignKey:UserID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"-"` } func (Token) TableName() string {