models

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const NoneID = uint64(0)

NoneID 空ID

Variables

This section is empty.

Functions

func AutoMigrate

func AutoMigrate(db *gorm.DB, tables ...interface{})

AutoMigrate 自动同步表结构

func Paginate

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

Paginate 分页器

page默认为0,pageSize默认为10

Types

type BaseModel

type BaseModel struct {
	ID        uint64     `gorm:"column:id;primary_key; AUTO_INCREMENT"`
	CreatedAt time.Time  `gorm:"column:created_at;comment:创建时间"`    //创建时间
	UpdatedAt time.Time  `gorm:"column:updated_at;comment:更新时间"`    //更新时间
	DeletedAt *time.Time `gorm:"column:deleted_at;comment:(软)删除时间"` //(软)删除时间
}

BaseModel 基础模型字段

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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