models

package
v0.26.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 14, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DropDB

func DropDB() error

func InitDB

func InitDB() error

func UpgradeDB

func UpgradeDB(fromVersion string, toVersion string) error

Types

type ApiKey

type ApiKey struct {
	ID          uint      `gorm:"primaryKey;autoIncrement" json:"id,omitempty"` // 主键ID
	Username    string    `gorm:"index;not null" json:"username,omitempty"`     // 用户名
	Key         string    `gorm:"type:text" json:"key,omitempty"`               // API密钥值,未来可通过比对做校验,可校验是否用户签发,可阻止失效
	Description string    `json:"description,omitempty"`                        // 密钥描述信息
	ExpiresAt   time.Time `json:"expires_at,omitempty"`                         // 过期时间
	CreatedAt   time.Time `json:"created_at,omitempty" gorm:"<-:create"`        // 创建时间
	UpdatedAt   time.Time `json:"updated_at,omitempty"`                         // 更新时间
	CreatedBy   string    `json:"created_by,omitempty"`                         // 创建人
}

func (*ApiKey) Delete

func (c *ApiKey) Delete(params *dao.Params, ids string, queryFuncs ...func(*gorm.DB) *gorm.DB) error

func (*ApiKey) GetOne

func (c *ApiKey) GetOne(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) (*ApiKey, error)

func (*ApiKey) List

func (c *ApiKey) List(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) ([]*ApiKey, int64, error)

func (*ApiKey) Save

func (c *ApiKey) Save(params *dao.Params, queryFuncs ...func(*gorm.DB) *gorm.DB) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL