thrsafe

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2015 License: BSD-3-Clause, BSD-3-Clause Imports: 5 Imported by: 179

Documentation

Overview

Thread safe engine for MyMySQL

In contrast to native engine:

  • one connection can be used by multiple gorutines,
  • if connection is idle pings are sent to the server (once per minute) to avoid timeout.

See documentation of mymysql/native for details

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(proto, laddr, raddr, user, passwd string, db ...string) mysql.Conn

Types

type Conn

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

func (*Conn) Begin

func (c *Conn) Begin() (mysql.Transaction, error)

func (*Conn) Clone added in v0.4.10

func (c *Conn) Clone() mysql.Conn

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) Connect

func (c *Conn) Connect() error

func (*Conn) Ping

func (c *Conn) Ping() error

func (*Conn) Prepare

func (c *Conn) Prepare(sql string) (mysql.Stmt, error)

func (*Conn) Query

func (c *Conn) Query(sql string, params ...interface{}) ([]mysql.Row, mysql.Result, error)

See mysql.Query

func (*Conn) QueryFirst added in v0.4.8

func (my *Conn) QueryFirst(sql string, params ...interface{}) (mysql.Row, mysql.Result, error)

See mysql.QueryFirst

func (*Conn) QueryLast added in v0.4.8

func (my *Conn) QueryLast(sql string, params ...interface{}) (mysql.Row, mysql.Result, error)

See mysql.QueryLast

func (*Conn) Reconnect

func (c *Conn) Reconnect() error

func (*Conn) Start

func (c *Conn) Start(sql string, params ...interface{}) (mysql.Result, error)

func (*Conn) Use

func (c *Conn) Use(dbname string) error

type Result

type Result struct {
	mysql.Result
	// contains filtered or unexported fields
}

func (*Result) End

func (res *Result) End() error

See mysql.End

func (*Result) GetFirstRow added in v0.4.8

func (res *Result) GetFirstRow() (mysql.Row, error)

See mysql.GetFirstRow

func (*Result) GetLastRow added in v0.4.8

func (res *Result) GetLastRow() (mysql.Row, error)

See mysql.GetLastRow

func (*Result) GetRow

func (res *Result) GetRow() (mysql.Row, error)

func (*Result) GetRows

func (res *Result) GetRows() ([]mysql.Row, error)

See mysql.GetRows

func (*Result) NextResult

func (res *Result) NextResult() (mysql.Result, error)

func (*Result) ScanRow added in v0.4.7

func (res *Result) ScanRow(row mysql.Row) error

type Stmt

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

func (*Stmt) Delete

func (stmt *Stmt) Delete() error

func (*Stmt) Exec

func (stmt *Stmt) Exec(params ...interface{}) ([]mysql.Row, mysql.Result, error)

See mysql.Exec

func (*Stmt) ExecFirst added in v0.4.8

func (stmt *Stmt) ExecFirst(params ...interface{}) (mysql.Row, mysql.Result, error)

See mysql.ExecFirst

func (*Stmt) ExecLast added in v0.4.8

func (stmt *Stmt) ExecLast(params ...interface{}) (mysql.Row, mysql.Result, error)

See mysql.ExecLast

func (*Stmt) Reset

func (stmt *Stmt) Reset() error

func (*Stmt) Run

func (stmt *Stmt) Run(params ...interface{}) (mysql.Result, error)

func (*Stmt) SendLongData

func (stmt *Stmt) SendLongData(pnum int, data interface{}, pkt_size int) error

type Transaction

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

func (*Transaction) Commit

func (tr *Transaction) Commit() error

func (*Transaction) Do

func (tr *Transaction) Do(st mysql.Stmt) mysql.Stmt

func (*Transaction) IsValid added in v1.0.1

func (tr *Transaction) IsValid() bool

func (*Transaction) Rollback

func (tr *Transaction) Rollback() error

Jump to

Keyboard shortcuts

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