package autorc
import "github.com/ziutek/mymysql/autorc"
Auto reconnect interface for MyMySQL
Index ¶
- func IsNetErr(err error) bool
- type Conn
- func New(proto, laddr, raddr, user, passwd string, db ...string) *Conn
- func NewFromCF(cfgFile string) (*Conn, map[string]string, error)
- func (c *Conn) Begin(f func(mysql.Transaction, ...interface{}) error, args ...interface{}) error
- func (c *Conn) Clone() *Conn
- func (c *Conn) Escape(s string) string
- func (c *Conn) Prepare(sql string) (*Stmt, error)
- func (c *Conn) PrepareOnce(s *Stmt, sql string) error
- func (c *Conn) Query(sql string, params ...interface{}) (rows []mysql.Row, res mysql.Result, err error)
- func (c *Conn) QueryFirst(sql string, params ...interface{}) (row mysql.Row, res mysql.Result, err error)
- func (c *Conn) QueryLast(sql string, params ...interface{}) (row mysql.Row, res mysql.Result, err error)
- func (c *Conn) Reconnect() (err error)
- func (c *Conn) Register(sql string)
- func (c *Conn) SetMaxPktSize(new_size int) int
- func (c *Conn) SetTimeout(timeout time.Duration)
- func (c *Conn) Use(dbname string) (err error)
- type Stmt
- func (s *Stmt) Bind(params ...interface{})
- func (s *Stmt) Exec(params ...interface{}) (rows []mysql.Row, res mysql.Result, err error)
- func (s *Stmt) ExecFirst(params ...interface{}) (row mysql.Row, res mysql.Result, err error)
- func (s *Stmt) ExecLast(params ...interface{}) (row mysql.Row, res mysql.Result, err error)
Functions ¶
func IsNetErr ¶
Return true if error is network error or UnexpectedEOF.
Types ¶
type Conn ¶
type Conn struct { Raw mysql.Conn // Maximum reconnect retries. // Default is 7 which means 1+2+3+4+5+6+7 = 28 seconds before return error // (if waiting for error takes no time). MaxRetries int // Debug logging. You may change it at any time. Debug bool }
func New ¶
func NewFromCF ¶
func (*Conn) Begin ¶
func (c *Conn) Begin(f func(mysql.Transaction, ...interface{}) error, args ...interface{}) error
Begin begins a transaction and calls f to complete it . If f returns an error and IsNetErr(error) == true it reconnects and calls f up to MaxRetries times. If error is of type *mysql.Error it tries rollback the transaction.
func (*Conn) Clone ¶
func (*Conn) Escape ¶
func (*Conn) Prepare ¶
Automatic connect/reconnect/repeat version of Prepare
func (*Conn) PrepareOnce ¶
Prepares statement if it wasn't prepared before
func (*Conn) Query ¶
func (c *Conn) Query(sql string, params ...interface{}) (rows []mysql.Row, res mysql.Result, err error)
Automatic connect/reconnect/repeat version of Query
func (*Conn) QueryFirst ¶
func (c *Conn) QueryFirst(sql string, params ...interface{}) (row mysql.Row, res mysql.Result, err error)
func (*Conn) QueryLast ¶
func (c *Conn) QueryLast(sql string, params ...interface{}) (row mysql.Row, res mysql.Result, err error)
func (*Conn) Reconnect ¶
func (*Conn) Register ¶
func (*Conn) SetMaxPktSize ¶
func (*Conn) SetTimeout ¶
func (*Conn) Use ¶
Automatic connect/reconnect/repeat version of Use
type Stmt ¶
func (*Stmt) Bind ¶
func (s *Stmt) Bind(params ...interface{})
func (*Stmt) Exec ¶
Automatic connect/reconnect/repeat version of Exec
func (*Stmt) ExecFirst ¶
func (*Stmt) ExecLast ¶
Source Files ¶
- Version
- v1.4.3
- Published
- Mar 18, 2013
- Platform
- windows/amd64
- Imports
- 5 packages
- Last checked
- 1 hour ago –
Tools for package owners.