models

package
v0.0.0-...-f15f0a0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2021 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	ID        uuid.UUID  `pg:",pk, unique, notnull, type:uuid, default:uuid_generate_v4()" json:"id"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
	DeletedAt *time.Time `pg:",soft_delete" json:"deleted_at"`
}

Base is the base model for other models.

func (*Base) BeforeInsert

func (model *Base) BeforeInsert(ctx context.Context) error

BeforeInsert to update CreatedAt and UpdatedAt columns.

func (*Base) BeforeUpdate

func (model *Base) BeforeUpdate(ctx context.Context) error

BeforeUpdate to update UpdatedAt columns.

type BaseNoID

type BaseNoID struct {
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
	DeletedAt *time.Time `pg:",soft_delete" json:"deleted_at"`
}

BaseNoID is the base model for other models.

func (*BaseNoID) BeforeInsert

func (model *BaseNoID) BeforeInsert(ctx context.Context) error

BeforeInsert to update CreatedAt and UpdatedAt columns.

func (*BaseNoID) BeforeUpdate

func (model *BaseNoID) BeforeUpdate(ctx context.Context) error

BeforeUpdate to update UpdatedAt columns.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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