23 lines
463 B
Go
23 lines
463 B
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
// AccessToken 表示 OAuth2 访问令牌
|
|
type AccessToken struct {
|
|
gorm.Model
|
|
Token string `gorm:"uniqueIndex;not null"`
|
|
UserID uint `gorm:"not null"`
|
|
ClientID string `gorm:"not null"`
|
|
Scope string `gorm:"type:text"`
|
|
ExpiresAt time.Time `gorm:"not null"`
|
|
IsRevoked bool `gorm:"default:false"`
|
|
}
|
|
|
|
func (t *AccessToken) TableName() string {
|
|
return "oauth_access_tokens"
|
|
}
|