database

package
v0.0.0-...-d2dc7f7 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Db *gorm.DB
)

Functions

func Close

func Close()

func Drop

func Drop(table interface{})

func Migrate

func Migrate(db *gorm.DB, entity interface{}) error

func NewMySQLDb

func NewMySQLDb(config Config) (*gorm.DB, error)

func NewPostgresDb

func NewPostgresDb(config Config) (*gorm.DB, error)

New open a new database connection

func NewSqliteDb

func NewSqliteDb(path string) (*gorm.DB, error)

func SetupDatabase

func SetupDatabase()

func SetupDatabaseTests

func SetupDatabaseTests()

Types

type Config

type Config struct {
	Host     string
	Port     int
	User     string
	Password string
	Database string
}

Config represents a set of parameter to configure a database.

type Model

type Model struct {
	gorm.Model
	UUID string `json:"uuid"`
}

Jump to

Keyboard shortcuts

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