models

package
v0.0.0-...-6a222b8 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseModel

type BaseModel struct {
	// ID should use uuid_generate_v4() for the pk's
	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"`
}

BaseModel defines the common columns that all db structs should hold, usually db structs based on this have no soft delete

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 Page

type Page struct {
	BaseModelSoftDelete
	Src     string `gorm:"not null;unique_index:idx_src"`
	Title   *string
	Text    *string
	Summary *string
	Videos  *string
	Images  *string
	Links   *string
}

Jump to

Keyboard shortcuts

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