package models import ( common "go-admin/common/models" "time" ) type APIKey struct { common.Model Name string `json:"name" gorm:"size:128;not null"` KeyHash string `json:"-" gorm:"size:64;uniqueIndex;not null"` KeyValue string `json:"apiKey" gorm:"column:key_value;size:128;not null"` Enabled bool `json:"enabled" gorm:"default:true;index"` LastUsedAt *time.Time `json:"lastUsedAt"` common.ModelTime common.ControlBy } func (*APIKey) TableName() string { return "api_key" } func (e *APIKey) Generate() common.ActiveRecord { o := *e; return &o } func (e *APIKey) GetId() interface{} { return e.Id }