dbwrap

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2021 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close() error

func CommonDB

func CommonDB() *sql.DB

func Db

func Db() *gorm.DB

func GetEnv

func GetEnv(env, defaultEnv string) string

func IsRecordNotFoundError

func IsRecordNotFoundError(err error) bool

func Keepalive

func Keepalive(ctx context.Context, table interface{}, interval time.Duration)

func Open

func Open() (err error)

func OpenUntilOk

func OpenUntilOk(retryInterval time.Duration) bool

Types

type AssociationFunc

type AssociationFunc func(*gorm.DB) *gorm.DB

type DbMgt

type DbMgt struct {
	Host      string
	Port      string
	User      string
	Password  string
	Name      string
	Ssl       bool
	CharSet   string // default 'utf8'
	ParseTime string // value is 'True' and 'False', default 'True'
	Loc       string // default 'Local'
	Path      string
	Log       *log.Logger
	Debug     bool
	// contains filtered or unexported fields
}

func CreateTables

func CreateTables(models ...interface{}) *DbMgt

func DefaultDbMgt

func DefaultDbMgt() *DbMgt

func OpenUntilOkAndCreateTables

func OpenUntilOkAndCreateTables(retryInterval time.Duration, models ...interface{}) *DbMgt

func Register

func Register(models ...interface{}) *DbMgt

func RegisterAssociationFunc

func RegisterAssociationFunc(funcs ...AssociationFunc) *DbMgt

func SetDbParam

func SetDbParam(host, port, user, password, name string, ssl bool) *DbMgt

func SetMssqlParam

func SetMssqlParam(host, port, user, password, name string) *DbMgt

func SetMysqlParam

func SetMysqlParam(host, port, user, password, name, charset, loc string, parseTime bool) *DbMgt

func SetPgParam

func SetPgParam(host, port, user, password, name string, ssl bool) *DbMgt

func SetSqlite3Param

func SetSqlite3Param(path string) *DbMgt

func (*DbMgt) Close

func (c *DbMgt) Close() error

func (*DbMgt) CommonDB

func (c *DbMgt) CommonDB() *sql.DB

func (*DbMgt) CreateTables

func (c *DbMgt) CreateTables(models ...interface{}) *DbMgt

func (*DbMgt) Db

func (c *DbMgt) Db() *gorm.DB

func (*DbMgt) Keepalive

func (c *DbMgt) Keepalive(ctx context.Context, table interface{}, interval time.Duration)

func (*DbMgt) Open

func (c *DbMgt) Open() error

func (*DbMgt) OpenUntilOk

func (c *DbMgt) OpenUntilOk(retryInterval time.Duration) bool

func (*DbMgt) OpenUntilOkAndCreateTables

func (c *DbMgt) OpenUntilOkAndCreateTables(retryInterval time.Duration, models ...interface{}) *DbMgt

func (*DbMgt) Register

func (c *DbMgt) Register(models ...interface{}) *DbMgt

func (*DbMgt) RegisterAssociationFunc

func (c *DbMgt) RegisterAssociationFunc(funcs ...AssociationFunc) *DbMgt

func (*DbMgt) SetDbParam

func (c *DbMgt) SetDbParam(host, port, user, password, name string, ssl bool) *DbMgt

func (*DbMgt) SetMssqlParam

func (c *DbMgt) SetMssqlParam(host, port, user, password, name string) *DbMgt

func (*DbMgt) SetMysqlParam

func (c *DbMgt) SetMysqlParam(host, port, user, password, name, charset, loc string, parseTime bool) *DbMgt

func (*DbMgt) SetPgParam

func (c *DbMgt) SetPgParam(host, port, user, password, name string, ssl bool) *DbMgt

func (*DbMgt) SetSqlite3Param

func (c *DbMgt) SetSqlite3Param(path string) *DbMgt

Jump to

Keyboard shortcuts

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