sql

package
v0.0.0-...-5dc576f Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

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

Connection stores SQL database connection client & information.

func NewConnection

func NewConnection(DB *gorm.DB, host, port, dialect string) *Connection

NewConnection creates new SQL database connection.

func (*Connection) Close

func (c *Connection) Close() error

Close closes current db connection.

func (*Connection) LogError

func (c *Connection) LogError(err error, msg string)

LogError prints SQL database connection error log to stderr.

func (*Connection) LogWarn

func (c *Connection) LogWarn(err error, msg string)

LogWarn prints SQL database connection warning log to stdout.

type DBConfig

type DBConfig struct {
	Host          string
	Port          string
	Database      string
	Username      string
	Password      string
	Params        string
	MaxIdleConns  int
	MaxOpenConns  int
	SingularTable bool
	DebugMode     bool
}

DBConfig stores SQL database common connection config.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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