db

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseGorm

type BaseGorm struct {
	MaxIdleConn    int
	MaxOpenConn    int
	LifetimeOfConn time.Duration
	ConnStr        string
	DBType         Type
}

BaseGorm is a struct store base info for gorm

func NewBaseGorm

func NewBaseGorm(connStr string, dbType Type, maxIdleConn, maxOpenConn int, lifeTimeOfconn time.Duration) *BaseGorm

NewBaseGorm is a func for new base gorm

func (*BaseGorm) Close

func (bg *BaseGorm) Close()

Close close the db connect

func (*BaseGorm) GetDB

func (bg *BaseGorm) GetDB() (*gorm.DB, error)

GetDB is a func for connect db

type Type

type Type string

Type is new type for db type, from string

const (
	DBTypeMysql    Type = "mysql"
	DBTypePostgres Type = "Postgres"
	DBTypeSqlite   Type = "Sqlite"
	DBTypeMssql    Type = "mssql"
)

define the all db types

Jump to

Keyboard shortcuts

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