database

package
v0.0.0-...-fb2f31d Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterCallbacks

func RegisterCallbacks(db *gorm.DB)

Types

type BaseModel

type BaseModel struct {
	IDModel
	MetadataTimeModel
	DeleteModel
}

func (BaseModel) Init

func (m BaseModel) Init()

type BaseUUIDModel

type BaseUUIDModel struct {
	BaseModel
	UniqueUUIDModel
}

func (BaseUUIDModel) Init

func (m BaseUUIDModel) Init()

type DeleteModel

type DeleteModel struct {
	Delete bool `json:"deleted" db:"deleted" gorm:"column:deleted; not null"` // 数据软删除
}

func (DeleteModel) Init

func (m DeleteModel) Init()

type IDModel

type IDModel struct {
	ID uint64 `json:"id" db:"id" gorm:"column:id; primaryKey"`
}

type MetadataTimeModel

type MetadataTimeModel struct {
	Ctime time.Time `json:"ctime" db:"ctime" gorm:"column:ctime; not null"` // 状态最后一次更改
	Mtime time.Time `json:"mtime" db:"mtime" gorm:"column:mtime; not null"` // 数据最后一次修改
}

func (MetadataTimeModel) Init

func (m MetadataTimeModel) Init()

type UniqueUUIDModel

type UniqueUUIDModel struct {
	UUID uuid.UUID `json:"uuid" db:"uuid" gorm:"column:uuid; uniqueIndex; not null"`
}

func (UniqueUUIDModel) Init

func (m UniqueUUIDModel) Init()

Jump to

Keyboard shortcuts

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