database

package
v0.0.0-...-834c3ea Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectMySQLDB

func ConnectMySQLDB(connectionString string, newLogger *logger.Interface) *gorm.DB

ConnectMySQLDB connects to MySQL database.

func ConnectPostgresDB

func ConnectPostgresDB(connectionString string, newLogger *logger.Interface) *gorm.DB

ConnectPostgresDB connects to Postgres database.

func ConnectSQLite3DB

func ConnectSQLite3DB(connectionString string, newLogger *logger.Interface) *gorm.DB

ConnectSQLite3DB connects to SQLite database.

Types

type DB

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

DB contains a db connection.

func Connect

func Connect() *DB

Connect connects to the appropriate database.

func (*DB) CreateEngine

func (db *DB) CreateEngine() *models.Engine

CreateEngine creates an engine.

func (*DB) GetTableName

func (db *DB) GetTableName(model interface{}) string

GetTableName gets a model's real table name.

func (*DB) WriteLog

func (db *DB) WriteLog() *models.Log

WriteLog writes a log to the database.

type DBKind

type DBKind int

DBKind represents the type of the database.

const (
	POSTGRES DBKind = iota
	MYSQL
	SQLITE3
)

DBKind types.

func ToDBKind

func ToDBKind(ty string) (DBKind, error)

ToDBKind converts string representation to

func (DBKind) String

func (kind DBKind) String() string

Jump to

Keyboard shortcuts

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