db

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

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

Go to latest
Published: Dec 22, 2020 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interface

type Interface interface {
	Connect(c *utils.Config) *utils.ModelError
	Migrate(table interface{}) *utils.ModelError
	GetDB() *gorm.DB
}

Interface DB interface

func GetDB

func GetDB(config *utils.Config) (Interface, *utils.ModelError)

GetDB gets the DB

type PostgreSQL

type PostgreSQL struct {
	DB       *gorm.DB
	Username string
	Password string
}

PostgreSQL struct

func (*PostgreSQL) Connect

func (pg *PostgreSQL) Connect(c *utils.Config) *utils.ModelError

Connect starts initial connection to DB

func (*PostgreSQL) GetDB

func (pg *PostgreSQL) GetDB() *gorm.DB

GetDB gets the DB from the struct

func (*PostgreSQL) Migrate

func (pg *PostgreSQL) Migrate(table interface{}) *utils.ModelError

Migrate migrates a table

type SQLite3

type SQLite3 struct {
	DB *gorm.DB
}

SQLite3 struct

func (*SQLite3) Connect

func (sql3 *SQLite3) Connect(c *utils.Config) *utils.ModelError

Connect starts initial connection to DB

func (*SQLite3) GetDB

func (sql3 *SQLite3) GetDB() *gorm.DB

GetDB gets the DB from the struct

func (*SQLite3) Migrate

func (sql3 *SQLite3) Migrate(table interface{}) *utils.ModelError

Migrate migrates a table

Jump to

Keyboard shortcuts

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