sql

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	DSN         string        // write data source name.
	ReadDSN     []string      // read data source name.
	Active      int           // pool
	Idle        int           // pool
	IdleTimeout time.Duration // connect max life time.
	ExecTimeout time.Duration // execute sql timeout
}

Config mysql config.

type DB

type DB struct {
	*gorm.DB
}

func NewMySQL

func NewMySQL(c *Config) (db *DB)

NewMySQL new db and retry connection when has error.

func Open

func Open(c *Config) (db *DB, err error)

func (*DB) Fork

func (db *DB) Fork(ctx context.Context) *DB

Jump to

Keyboard shortcuts

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