model

package
v0.0.0-...-c833263 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2019 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDatabase

func GetDatabase() *gorm.DB

Types

type Base

type Base struct {
	ID        uuid.UUID  `json:"id";gorm:"primary_key;type:char(36);`
	CreatedAt time.Time  `json:"created_at";`
	UpdatedAt time.Time  `json:"updated_at";`
	DeletedAt *time.Time `json:"-";`
}

Base contains common columns for all tables.

func (*Base) BeforeCreate

func (base *Base) BeforeCreate(scope *gorm.Scope) error

BeforeCreate will set a UUID rather than numeric ID.

type Chemical

type Chemical struct {
	Base
	Name            string `json:"name"`
	DescriptionLink string `json:"description_link"`
	Slug            string `json:"slug"`
}

func GetAllChemicals

func GetAllChemicals() []*Chemical

func GetChemical

func GetChemical(id string) *Chemical

Jump to

Keyboard shortcuts

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