model

package
v0.0.0-...-0de774d Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2020 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 Base

type Base struct {
	ID        string    `pg:",pk" json:"id,omitempty"`
	CreatedAt time.Time `json:"created_at,omitempty"`
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	DeletedAt time.Time `pg:",soft_delete"json:"deleted_at,omitempty"`
}

Base contains common fields for all tables

func (*Base) BeforeInsert

func (b *Base) BeforeInsert(c context.Context) (context.Context, error)

BeforeInsert hooks into insert operations, setting createdAt and updatedAt to current time

func (*Base) BeforeUpdate

func (b *Base) BeforeUpdate(c context.Context) (context.Context, error)

BeforeUpdate hooks into update operations, setting updatedAt to current time

Jump to

Keyboard shortcuts

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