models

package
v0.0.0-...-88540c7 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Directory 目录
	Directory string = "M"
	// Menu 菜单
	Menu string = "C"
	// Button 按钮
	Button string = "F"
)

Menu 菜单中的类型枚举值

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveRecord

type ActiveRecord interface {
	schema.Tabler
	SetCreateBy(createBy int)
	SetUpdateBy(updateBy int)
	Generate() ActiveRecord
	GetId() interface{}
}

type BaseUser

type BaseUser struct {
	Username     string `json:"username" gorm:"type:varchar(100);comment:用户名"`
	Salt         string `json:"-" gorm:"type:varchar(255);comment:加盐;<-"`
	PasswordHash string `json:"-" gorm:"type:varchar(128);comment:密码hash;<-"`
	Password     string `json:"password" gorm:"-"`
}

BaseUser 密码登录基础用户

func (*BaseUser) GetPasswordHash

func (u *BaseUser) GetPasswordHash() string

GetPasswordHash 获取密码hash

func (*BaseUser) SetPassword

func (u *BaseUser) SetPassword(value string)

SetPassword 设置密码

func (*BaseUser) Verify

func (u *BaseUser) Verify(db *gorm.DB, tableName string) bool

Verify 验证密码

type ControlBy

type ControlBy struct {
	CreateBy int `json:"createBy" gorm:"index;comment:create user"`
	UpdateBy int `json:"updateBy" gorm:"index;comment:update user"`
}

create and update by user

func (*ControlBy) SetCreateBy

func (e *ControlBy) SetCreateBy(createBy int)

SetCreateBy creater id

func (*ControlBy) SetUpdateBy

func (e *ControlBy) SetUpdateBy(updateBy int)

SetUpdateBy edit id

type Migration

type Migration struct {
	Version   string    `gorm:"primaryKey"`
	ApplyTime time.Time `gorm:"autoCreateTime"`
}

func (Migration) TableName

func (Migration) TableName() string

type Model

type Model struct {
	Id int `json:"id" gorm:"primaryKey;autoIncrement;comment:key"`
}

type ModelTime

type ModelTime struct {
	CreatedAt time.Time             `json:"createdAt" gorm:"comment:create date"`
	UpdatedAt time.Time             `json:"updatedAt" gorm:"comment:update date"`
	DeletedAt soft_delete.DeletedAt `json:"-" gorm:"index;comment:flag"`
}

Org model Time and delete flag

type Page

type Page struct {
	List      interface{} `json:"list"`
	Count     int         `json:"count"`
	PageIndex int         `json:"pageIndex"`
	PageSize  int         `json:"pageSize"`
}

type Response

type Response struct {
	// code
	Code int `json:"code" example:"200"`
	// data
	Data interface{} `json:"data"`
	// msg
	Msg       string `json:"msg"`
	RequestId string `json:"requestId"`
}

func (*Response) ReturnError

func (res *Response) ReturnError(code int) *Response

ReturnError

func (*Response) ReturnOK

func (res *Response) ReturnOK() *Response

ReturnOK

Jump to

Keyboard shortcuts

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