orm

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ModelInt

type ModelInt struct {
	ID          int       `gorm:"primary_key;AUTO_INCREMENT"`
	CreatedTime time.Time `gorm:"not null;default:CURRENT_TIMESTAMP"`
	UpdatedTime time.Time `gorm:"not null;default:CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"`
	IsActive    bool      `gorm:"not null"`
}

ModelInt int主键

func (ModelInt) BeforeCreate

func (m ModelInt) BeforeCreate(scope *gorm.Scope) error

BeforeCreate 自动主键值

func (ModelInt) BeforeDelete

func (m ModelInt) BeforeDelete(scope *gorm.Scope) (err error)

func (ModelInt) BeforeUpdate

func (m ModelInt) BeforeUpdate(scope *gorm.Scope) (err error)

type ModelUUID

type ModelUUID struct {
	ID          uuid.GUID `gorm:"primary_key"`
	CreatedTime time.Time `gorm:"not null;default:CURRENT_TIMESTAMP"`
	UpdatedTime time.Time `gorm:"not null;default:CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"`
	IsActive    bool      `gorm:"not null"`
}

ModelUUID uuid主键

func (ModelUUID) BeforeCreate

func (m ModelUUID) BeforeCreate(scope *gorm.Scope) error

BeforeCreate 自动主键值

func (ModelUUID) BeforeDelete

func (m ModelUUID) BeforeDelete(scope *gorm.Scope) (err error)

func (ModelUUID) BeforeUpdate

func (m ModelUUID) BeforeUpdate(scope *gorm.Scope) (err error)

Jump to

Keyboard shortcuts

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