models

package
v0.0.0-...-699b668 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

type Model struct {
	*gorm.DB
	// contains filtered or unexported fields
}

Model facilitate database interactions, supports postgres, mysql and foundation

func NewModel

func NewModel() *Model

NewModel returns a new Model without opening database connection

func (*Model) AutoMigrateAll

func (m *Model) AutoMigrateAll()

AutoMigrateAll runs migrations for all the registered models

func (*Model) IsOpen

func (m *Model) IsOpen() bool

IsOpen returns true if the Model has already established connection to the database

func (*Model) OpenWithConfig

func (m *Model) OpenWithConfig(cfg *config.Config) error

OpenWithConfig opens database connection with the settings found in cfg

func (*Model) Register

func (m *Model) Register(values ...interface{}) error

Register adds the values to the models registry

Jump to

Keyboard shortcuts

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