database

package
v0.0.0-...-3311072 Latest Latest
Warning

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

Go to latest
Published: May 24, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBConnectCfg

type DBConnectCfg struct {
	Enabled      bool
	Driver       string // postgres, mysql
	Address      string
	DBname       string
	User         string
	Password     string
	SSLMode      string
	MaxIdleConns int
	MaxConns     int
}

DBConnectCfg database connect configure

type GormClient

type GormClient struct {
	DbConfig *DBConnectCfg
	Db       *gorm.DB
}

GormClient gorm database client

func (*GormClient) Close

func (d *GormClient) Close()

Close close gorm database client

func (*GormClient) GetConn

func (d *GormClient) GetConn() *gorm.DB

GetConn get database connect

func (*GormClient) Init

func (d *GormClient) Init() error

Init init gorm database client

type IGormClient

type IGormClient interface {
	Init() error
	GetConn() *gorm.DB
	Close()
}

IGormClient gorm database interface

func NewGormClient

func NewGormClient(cfg *DBConnectCfg) (IGormClient, error)

NewGormClient create gorm database client instance

Jump to

Keyboard shortcuts

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