gormutils

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectMysql

func ConnectMysql(c *MysqlC) (db *gorm.DB, err error)

ConnectMysql build a connection to mysql

func SetLogger

func SetLogger(db *gorm.DB, logger gorm.LogWriter) *gorm.DB

SetLogger to open log mode and set logger notice that: gorm.LogWriter is an interface with Println method, and if logger is nil, default output to os.Stdout

Types

type MysqlC

type MysqlC struct {
	UserName  string `json:"username"`
	Password  string `json:"password"`
	Addr      string `json:"addr"`
	DBName    string `json:"dbname"`
	Charset   string `json:"charset"`
	ParseTime bool   `json:"parsetime"`
	Loc       string `json:"loc"`
	Pool      int    `json:"pool"`
}

MysqlC mysql server config struct

func (*MysqlC) String

func (c *MysqlC) String() string

@output "user:password@addr:port/dbname?charset=utf8&parseTime=True&loc=Local"

type TableConn

type TableConn struct {
	*gorm.DB
	*sync.RWMutex
}

TableConn ... connection to table

Jump to

Keyboard shortcuts

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