mysql

package
v0.0.0-...-298ae05 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB interface {
	Init(opts ...Option) (db *sqlx.DB, err error)
}

func NewDB

func NewDB(driver string) (db DB)

建库sql: CREATE DATABASE IF NOT EXISTS `giligili` DEFAULT CHARACTER SET 'utf8mb4' DEFAULT COLLATE 'utf8mb4_unicode_ci';

type Option

type Option func(opts *Options)

func WithAddr

func WithAddr(addr string) Option

func WithCharSet

func WithCharSet(char string) Option

func WithDatabase

func WithDatabase(db string) Option

func WithMaxConn

func WithMaxConn(max int) Option

func WithMaxIdleConn

func WithMaxIdleConn(idle int) Option

func WithParseTime

func WithParseTime(p bool) Option

func WithPassword

func WithPassword(pwd string) Option

func WithUsername

func WithUsername(user string) Option

type Options

type Options struct {
	Addr        string
	Username    string
	Password    string
	Database    string
	MaxConn     int // 最大连接数
	MaxIdleConn int // 最大空闲连接数
	CharSet     string
	ParseTime   bool
}

func DefaultOpts

func DefaultOpts() *Options

Jump to

Keyboard shortcuts

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