models

package
v0.0.0-...-7daae65 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateObject

func CreateObject(objToCreate interface{}, objToReturn interface{}, db *gorm.DB) (dbToReturn *gorm.DB, err error)

Types

type BaseModel

type BaseModel struct {
	Id        int        `gorm:"primary_key;AUTO_INCREMENT"`
	CreatedAt time.Time  `gorm:"index;not null;default:CURRENT_TIMESTAMP"` // (My|Postgre)SQL
	UpdatedAt *time.Time `gorm:"index"`
}

type BaseModelSoftDelete

type BaseModelSoftDelete struct {
	BaseModel
	DeletedAt *time.Time `sql:"index"`
}

BaseModelSoftDelete defines the common columns that all db structs should hold, usually. This struct also defines the fields for GORM triggers to detect the entity should soft delete

type Order

type Order struct {
	BaseModelSoftDelete
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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