schema

package
v0.0.0-...-8a04328 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2018 License: GPL-3.0, GPL-3.0-only Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SQLITE = "sqlite3"
	MYSQL  = "mysql"
)

constants for supported dmbs names in config

View Source
const ID_LENGTH = 8

Variables

This section is empty.

Functions

func AddSchema

func AddSchema(schema interface{})

func CloseDatabaseConnection

func CloseDatabaseConnection()

func ConnectDatabase

func ConnectDatabase()

func CreateOrUpdate

func CreateOrUpdate() error

func GetDatabase

func GetDatabase() *gorm.DB

Types

type DatabaseLogger

type DatabaseLogger struct {
	gorm.Logger
}

func (*DatabaseLogger) Print

func (logger *DatabaseLogger) Print(v ...interface{})

type DatabaseObject

type DatabaseObject struct {
	ID        string     `gorm:"primary_key;size:64" json:"id"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
	DeletedAt *time.Time `sql:"index" json:"-"`
}

DatabaseObject is the base object for all database objects. Copy from `gorm.Model` for json annotations

func (*DatabaseObject) BeforeCreate

func (d *DatabaseObject) BeforeCreate(scope *gorm.Scope) error

type ObjectMapping

type ObjectMapping struct {
	Relation string `gorm:"size:128"`
	ID       string `gorm:"size:64"`
}

ObjectMapping is a simple class to map every ID to the relation (tablename) of it's object

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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