Documentation ¶
Index ¶
- type Conn
- func (c *Conn) ClearInTransaction()
- func (c *Conn) Close()
- func (c *Conn) Closed() bool
- func (c *Conn) ConnectionID() uint32
- func (c *Conn) GetUser() string
- func (c *Conn) HandleCommand() error
- func (c *Conn) IsAutoCommit() bool
- func (c *Conn) IsInTransaction() bool
- func (c *Conn) SetInTransaction()
- type EmptyHandler
- func (h EmptyHandler) HandleFieldList(table string, fieldWildcard string) ([]*Field, error)
- func (h EmptyHandler) HandleOtherCommand(cmd byte, data []byte) error
- func (h EmptyHandler) HandleQuery(query string) (*Result, error)
- func (h EmptyHandler) HandleStmtClose(context interface{}) error
- func (h EmptyHandler) HandleStmtExecute(context interface{}, query string, args []interface{}) (*Result, error)
- func (h EmptyHandler) HandleStmtPrepare(query string) (int, int, interface{}, error)
- func (h EmptyHandler) UseDB(dbName string) error
- type Handler
- type Stmt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
Conn acts like a MySQL server connection, you can use MySQL client to communicate with it.
func (*Conn) ClearInTransaction ¶
func (c *Conn) ClearInTransaction()
func (*Conn) ConnectionID ¶
func (*Conn) HandleCommand ¶
func (*Conn) IsAutoCommit ¶
func (*Conn) IsInTransaction ¶
func (*Conn) SetInTransaction ¶
func (c *Conn) SetInTransaction()
type EmptyHandler ¶
type EmptyHandler struct { }
func (EmptyHandler) HandleFieldList ¶
func (h EmptyHandler) HandleFieldList(table string, fieldWildcard string) ([]*Field, error)
func (EmptyHandler) HandleOtherCommand ¶
func (h EmptyHandler) HandleOtherCommand(cmd byte, data []byte) error
func (EmptyHandler) HandleQuery ¶
func (h EmptyHandler) HandleQuery(query string) (*Result, error)
func (EmptyHandler) HandleStmtClose ¶
func (h EmptyHandler) HandleStmtClose(context interface{}) error
func (EmptyHandler) HandleStmtExecute ¶
func (h EmptyHandler) HandleStmtExecute(context interface{}, query string, args []interface{}) (*Result, error)
func (EmptyHandler) HandleStmtPrepare ¶
func (h EmptyHandler) HandleStmtPrepare(query string) (int, int, interface{}, error)
func (EmptyHandler) UseDB ¶
func (h EmptyHandler) UseDB(dbName string) error
type Handler ¶
type Handler interface { //handle COM_INIT_DB command, you can check whether the dbName is valid, or other. UseDB(dbName string) error //handle COM_QUERY comamnd, like SELECT, INSERT, UPDATE, etc... //If Result has a Resultset (SELECT, SHOW, etc...), we will send this as the repsonse, otherwise, we will send Result HandleQuery(query string) (*Result, error) //handle COM_FILED_LIST command HandleFieldList(table string, fieldWildcard string) ([]*Field, error) //handle COM_STMT_PREPARE, params is the param number for this statement, columns is the column number //context will be used later for statement execute HandleStmtPrepare(query string) (params int, columns int, context interface{}, err error) //handle COM_STMT_EXECUTE, context is the previous one set in prepare //query is the statement prepare query, and args is the params for this statement HandleStmtExecute(context interface{}, query string, args []interface{}) (*Result, error) //handle COM_STMT_CLOSE, context is the previous one set in prepare //this handler has no response HandleStmtClose(context interface{}) error //handle any other command that is not currently handled by the library, //default implementation for this method will return an ER_UNKNOWN_ERROR HandleOtherCommand(cmd byte, data []byte) error }
Click to show internal directories.
Click to hide internal directories.