models

package
v0.0.0-...-3030a97 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FieldSortDest

func FieldSortDest(field string, bl bool) func(db *gorm.DB) *gorm.DB

FieldSortDest 自定义字段排序

func MakeCondition

func MakeCondition(query interface{}) func(db *gorm.DB) *gorm.DB

MakeCondition 生成查询条件

func Paginate

func Paginate(pageSize, pageIndex int) func(db *gorm.DB) *gorm.DB

Paginate 生成分页

Types

type ActiveRecord

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

type ControlBy

type ControlBy struct {
	CreateBy int `json:"create_by" gorm:"index;comment:创建者"`
	UpdateBy int `json:"update_by" gorm:"index;comment:更新者"`
}

func (*ControlBy) SetCreateBy

func (e *ControlBy) SetCreateBy(createBy int)

SetCreateBy 设置创建人id

func (*ControlBy) SetUpdateBy

func (e *ControlBy) SetUpdateBy(updateBy int)

SetUpdateBy 设置修改人id

type Model

type Model struct {
	ID int64 `gorm:"primaryKey;autoIncrement;comment:主键编码" json:"id"`
	ModelTime
}

type ModelTime

type ModelTime struct {
	CreateTime time.Time `gorm:"column:create_time; autoCreateTime; <-:create" json:"create_time,omitempty"`
	UpdateTime time.Time `gorm:"column:update_time; autoUpdateTime; <-;" json:"update_time,omitempty"`
}

Jump to

Keyboard shortcuts

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