models

package
v3.2.12 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GormBase

type GormBase struct {
	Id        string `gorm:"type:string;primaryKey;autoIncrement:false"`
	CreatedAt sql.NullTime
	UpdatedAt sql.NullTime
	SyncedAt  sql.NullTime
	CreatedBy sql.NullString
	UpdatedBy sql.NullString
	DeletedAt gorm.DeletedAt
	DeletedBy sql.NullString
	Env       *configs.Env `gorm:"-:all"`
}

func (*GormBase) BeforeCreate

func (b *GormBase) BeforeCreate(tx *gorm.DB) (err error)

func (*GormBase) BeforeDelete

func (b *GormBase) BeforeDelete(tx *gorm.DB) (err error)

func (*GormBase) BeforeUpdate

func (b *GormBase) BeforeUpdate(tx *gorm.DB) (err error)

func (*GormBase) SetCreatedAt

func (b *GormBase) SetCreatedAt(time time.Time)

func (*GormBase) SetCreatedBy

func (b *GormBase) SetCreatedBy(user string)

func (*GormBase) SetDeletedAt

func (b *GormBase) SetDeletedAt(time time.Time)

func (*GormBase) SetDeletedBy

func (b *GormBase) SetDeletedBy(user string)

func (*GormBase) SetSyncedAt

func (b *GormBase) SetSyncedAt(time time.Time)

func (*GormBase) SetUpdatedAt

func (b *GormBase) SetUpdatedAt(time time.Time)

func (*GormBase) SetUpdatedBy

func (b *GormBase) SetUpdatedBy(user string)

type GormModel

type GormModel interface {
	TableName() string
	SetCreatedBy(user string)
	SetUpdatedBy(user string)
	SetDeletedBy(user string)
	SetCreatedAt(time time.Time)
	SetUpdatedAt(time time.Time)
	SetSyncedAt(time time.Time)
	SetDeletedAt(time time.Time)
	IsSoftDelete() bool
}

type MongoBase

type MongoBase struct {
	mgm.DefaultModel `bson:",inline"`
	CreatedAt        time.Time `bson:"created_at"`
	UpdatedAt        time.Time `bson:"updated_at"`
	SyncedAt         time.Time `bson:"synced_at"`
	CreatedBy        string    `bson:"created_by"`
	UpdatedBy        string    `bson:"updated_by"`
}

Jump to

Keyboard shortcuts

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