mymysql: Index | Files

package thrsafe

import ""

Package thrsafe is a 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.


Package Files


func New Uses

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

New creates a new thread safe connection.

type Conn Uses

type Conn struct {
    // contains filtered or unexported fields

Conn is a thread safe connection type.

func (*Conn) Begin Uses

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

func (*Conn) Clone Uses

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

func (*Conn) Close Uses

func (c *Conn) Close() error

Close closes the connection.

func (*Conn) Connect Uses

func (c *Conn) Connect() error

func (*Conn) Escape Uses

func (c *Conn) Escape(txt string) string

func (*Conn) Ping Uses

func (c *Conn) Ping() error

func (*Conn) Prepare Uses

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

func (*Conn) Query Uses

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

Query: See mysql.Query

func (*Conn) QueryFirst Uses

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

QueryFirst: See mysql.QueryFirst

func (*Conn) QueryLast Uses

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

QueryLast: See mysql.QueryLast

func (*Conn) Reconnect Uses

func (c *Conn) Reconnect() error

func (*Conn) Start Uses

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

func (*Conn) Status Uses

func (c *Conn) Status() mysql.ConnStatus

func (*Conn) Use Uses

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

type Result Uses

type Result struct {
    // contains filtered or unexported fields

Result is a thread safe result type.

func (*Result) End Uses

func (res *Result) End() error

End: See mysql.End

func (*Result) GetFirstRow Uses

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

GetFirstRow: See mysql.GetFirstRow

func (*Result) GetLastRow Uses

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

GetLastRow: See mysql.GetLastRow

func (*Result) GetRow Uses

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

func (*Result) GetRows Uses

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

GetRows: See mysql.GetRows

func (*Result) NextResult Uses

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

func (*Result) ScanRow Uses

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

type Stmt Uses

type Stmt struct {
    // contains filtered or unexported fields

Stmt is a thread safe statement type.

func (*Stmt) Delete Uses

func (stmt *Stmt) Delete() error

func (*Stmt) Exec Uses

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

Exec: See mysql.Exec

func (*Stmt) ExecFirst Uses

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

ExecFirst: See mysql.ExecFirst

func (*Stmt) ExecLast Uses

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

ExecLast: See mysql.ExecLast

func (*Stmt) Reset Uses

func (stmt *Stmt) Reset() error

func (*Stmt) Run Uses

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

func (*Stmt) SendLongData Uses

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

type Transaction Uses

type Transaction struct {
    // contains filtered or unexported fields

Transaction is a thread safe transaction type.

func (*Transaction) Commit Uses

func (tr *Transaction) Commit() error

func (*Transaction) Do Uses

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

func (*Transaction) IsValid Uses

func (tr *Transaction) IsValid() bool

func (*Transaction) Rollback Uses

func (tr *Transaction) Rollback() error

Package thrsafe imports 5 packages (graph) and is imported by 84 packages. Updated 2019-02-20. Refresh now. Tools for package owners.