client

package
v0.0.0-...-b26f8fd Latest Latest
Warning

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

Go to latest
Published: May 24, 2016 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

View Source
const (
	Up = iota
	Down
	ManualDown
	Unknown

	InitConnCount           = 1
	DefaultMaxConnNum       = 1024
	PingPeroid        int64 = 8
)

Variables

View Source
var (
	ErrDatabaseClose = errors.New("database is close")
	ErrConnIsNil     = errors.New("connection is nil")
	ErrBadConn       = errors.New("connection was bad")
)

errors

Functions

This section is empty.

Types

type BackendConn

type BackendConn struct {
	*Conn
	// contains filtered or unexported fields
}

func (*BackendConn) Close

func (p *BackendConn) Close()

type Conn

type Conn struct {
	// contains filtered or unexported fields
}

Conn is a mysql clinet to server connection.

func (*Conn) Begin

func (c *Conn) Begin() error

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) ClosePrepare

func (c *Conn) ClosePrepare(id uint32) error

func (*Conn) Commit

func (c *Conn) Commit() error

func (*Conn) Connect

func (c *Conn) Connect(addr string, user string, password string, db string) error

Connect Mysql server.

func (*Conn) Execute

func (c *Conn) Execute(command string, args ...interface{}) (*mysql.Result, error)

func (*Conn) FieldList

func (c *Conn) FieldList(table string, wildcard string) ([]*mysql.Field, error)

func (*Conn) GetAddr

func (c *Conn) GetAddr() string

func (*Conn) GetCharset

func (c *Conn) GetCharset() string

func (*Conn) GetDB

func (c *Conn) GetDB() string

func (*Conn) IsAutoCommit

func (c *Conn) IsAutoCommit() bool

func (*Conn) IsInTransaction

func (c *Conn) IsInTransaction() bool

func (*Conn) Ping

func (c *Conn) Ping() error

func (*Conn) Prepare

func (c *Conn) Prepare(query string) (*Stmt, error)

func (*Conn) ReConnect

func (c *Conn) ReConnect() error

func (*Conn) Rollback

func (c *Conn) Rollback() error

func (*Conn) SetAutoCommit

func (c *Conn) SetAutoCommit(n uint8) error

func (*Conn) SetCharset

func (c *Conn) SetCharset(charset string) error

func (*Conn) UseDB

func (c *Conn) UseDB(dbName string) error

type DB

type DB struct {
	sync.RWMutex

	InitConnNum int
	// contains filtered or unexported fields
}

func Open

func Open(addr string, user string, password string, dbName string, maxConnNum int) (*DB, error)

func (*DB) Addr

func (db *DB) Addr() string

func (*DB) Close

func (db *DB) Close() error

func (*DB) GetConn

func (db *DB) GetConn() (*BackendConn, error)

func (*DB) GetConnFromCache

func (db *DB) GetConnFromCache(cacheConns chan *Conn) *Conn

func (*DB) GetConnFromIdle

func (db *DB) GetConnFromIdle(cacheConns, idleConns chan *Conn) (*Conn, error)

func (*DB) IdleConnCount

func (db *DB) IdleConnCount() int

func (*DB) Ping

func (db *DB) Ping() error

func (*DB) PopConn

func (db *DB) PopConn() (*Conn, error)

func (*DB) PushConn

func (db *DB) PushConn(co *Conn, err error)

func (*DB) State

func (db *DB) State() string

type Stmt

type Stmt struct {
	// contains filtered or unexported fields
}

func (*Stmt) Close

func (s *Stmt) Close() error

func (*Stmt) ColumnNum

func (s *Stmt) ColumnNum() int

func (*Stmt) Execute

func (s *Stmt) Execute(args ...interface{}) (*mysql.Result, error)

func (*Stmt) GetId

func (s *Stmt) GetId() uint32

func (*Stmt) ParamNum

func (s *Stmt) ParamNum() int

Jump to

Keyboard shortcuts

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