Documentation ¶
Index ¶
- type ColumnInfo
- type Config
- type IContext
- type IDriver
- type IStatement
- type ResultSet
- type Server
- type TiDBContext
- func (tc *TiDBContext) AffectedRows() uint64
- func (tc *TiDBContext) Auth(user string, auth []byte, salt []byte) bool
- func (tc *TiDBContext) Close() (err error)
- func (tc *TiDBContext) CurrentDB() string
- func (tc *TiDBContext) Execute(sql string) (rs ResultSet, err error)
- func (tc *TiDBContext) FieldList(table string) (colums []*ColumnInfo, err error)
- func (tc *TiDBContext) GetStatement(stmtID int) IStatement
- func (tc *TiDBContext) LastInsertID() uint64
- func (tc *TiDBContext) Prepare(sql string) (statement IStatement, columns, params []*ColumnInfo, err error)
- func (tc *TiDBContext) Status() uint16
- func (tc *TiDBContext) WarningCount() uint16
- type TiDBDriver
- type TiDBStatement
- func (ts *TiDBStatement) AppendParam(paramID int, data []byte) error
- func (ts *TiDBStatement) BoundParams() [][]byte
- func (ts *TiDBStatement) Close() error
- func (ts *TiDBStatement) Execute(args ...interface{}) (rs ResultSet, err error)
- func (ts *TiDBStatement) ID() int
- func (ts *TiDBStatement) NumParams() int
- func (ts *TiDBStatement) Reset()
- type Token
- type TokenLimiter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ColumnInfo ¶
type ColumnInfo struct { Schema string Table string OrgTable string Name string OrgName string ColumnLength uint32 Charset uint16 Flag uint16 Decimal uint8 Type uint8 DefaultValueLength uint64 DefaultValue []byte }
ColumnInfo contains information of a column
type Config ¶
type Config struct { Addr string `json:"addr" toml:"addr"` LogLevel string `json:"log_level" toml:"log_level"` SkipAuth bool `json:"skip_auth" toml:"skip_auth"` StatusAddr string `json:"status_addr" toml:"status_addr"` Socket string `json:"socket" toml:"socket"` }
Config contains configuration options.
type IContext ¶
type IContext interface { // Status returns server status code. Status() uint16 // LastInsertID returns last inserted ID. LastInsertID() uint64 // AffectedRows returns affected rows of last executed command. AffectedRows() uint64 // WarningCount returns warning count of last executed command. WarningCount() uint16 // CurrentDB returns current DB. CurrentDB() string // Execute executes a SQL statement. Execute(sql string) (ResultSet, error) // Prepare prepares a statement. Prepare(sql string) (statement IStatement, columns, params []*ColumnInfo, err error) // GetStatement gets IStatement by statement ID. GetStatement(stmtID int) IStatement // FieldList returns columns of a table. FieldList(tableName string) (columns []*ColumnInfo, err error) // Close closes the IContext. Close() error // Auth verifies user's authentication. Auth(user string, auth []byte, salt []byte) bool }
IContext is the interface to execute commant.
type IDriver ¶
type IDriver interface { // OpenCtx opens an IContext with connection id, client capability, collation and dbname. OpenCtx(connID uint64, capability uint32, collation uint8, dbname string) (IContext, error) }
IDriver opens IContext.
type IStatement ¶
type IStatement interface { // ID returns statement ID ID() int // Execute executes the statement. Execute(args ...interface{}) (ResultSet, error) // AppendParam appends parameter to the statement. AppendParam(paramID int, data []byte) error // NumParams returns number of parameters. NumParams() int // BoundParams returns bound parameters. BoundParams() [][]byte // Reset removes all bound parameters. Reset() // Close closes the statement. Close() error }
IStatement is the interface to use a prepared statement.
type ResultSet ¶
type ResultSet interface { Columns() ([]*ColumnInfo, error) Next() ([]types.Datum, error) Close() error }
ResultSet is the result set of an query.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the MySQL protocol server
func (*Server) ConnectionCount ¶
ConnectionCount gets current connection count.
type TiDBContext ¶
type TiDBContext struct {
// contains filtered or unexported fields
}
TiDBContext implements IContext.
func (*TiDBContext) AffectedRows ¶
func (tc *TiDBContext) AffectedRows() uint64
AffectedRows implements IContext AffectedRows method.
func (*TiDBContext) Auth ¶
func (tc *TiDBContext) Auth(user string, auth []byte, salt []byte) bool
Auth implements IContext Auth method.
func (*TiDBContext) Close ¶
func (tc *TiDBContext) Close() (err error)
Close implements IContext Close method.
func (*TiDBContext) CurrentDB ¶
func (tc *TiDBContext) CurrentDB() string
CurrentDB implements IContext CurrentDB method.
func (*TiDBContext) Execute ¶
func (tc *TiDBContext) Execute(sql string) (rs ResultSet, err error)
Execute implements IContext Execute method.
func (*TiDBContext) FieldList ¶
func (tc *TiDBContext) FieldList(table string) (colums []*ColumnInfo, err error)
FieldList implements IContext FieldList method.
func (*TiDBContext) GetStatement ¶
func (tc *TiDBContext) GetStatement(stmtID int) IStatement
GetStatement implements IContext GetStatement method.
func (*TiDBContext) LastInsertID ¶
func (tc *TiDBContext) LastInsertID() uint64
LastInsertID implements IContext LastInsertID method.
func (*TiDBContext) Prepare ¶
func (tc *TiDBContext) Prepare(sql string) (statement IStatement, columns, params []*ColumnInfo, err error)
Prepare implements IContext Prepare method.
func (*TiDBContext) Status ¶
func (tc *TiDBContext) Status() uint16
Status implements IContext Status method.
func (*TiDBContext) WarningCount ¶
func (tc *TiDBContext) WarningCount() uint16
WarningCount implements IContext WarningCount method.
type TiDBDriver ¶
type TiDBDriver struct {
// contains filtered or unexported fields
}
TiDBDriver implements IDriver.
func NewTiDBDriver ¶
func NewTiDBDriver(store kv.Storage) *TiDBDriver
NewTiDBDriver creates a new TiDBDriver.
type TiDBStatement ¶
type TiDBStatement struct {
// contains filtered or unexported fields
}
TiDBStatement implements IStatement.
func (*TiDBStatement) AppendParam ¶
func (ts *TiDBStatement) AppendParam(paramID int, data []byte) error
AppendParam implements IStatement AppendParam method.
func (*TiDBStatement) BoundParams ¶
func (ts *TiDBStatement) BoundParams() [][]byte
BoundParams implements IStatement BoundParams method.
func (*TiDBStatement) Close ¶
func (ts *TiDBStatement) Close() error
Close implements IStatement Close method.
func (*TiDBStatement) Execute ¶
func (ts *TiDBStatement) Execute(args ...interface{}) (rs ResultSet, err error)
Execute implements IStatement Execute method.
func (*TiDBStatement) NumParams ¶
func (ts *TiDBStatement) NumParams() int
NumParams implements IStatement NumParams method.
func (*TiDBStatement) Reset ¶
func (ts *TiDBStatement) Reset()
Reset implements IStatement Reset method.
type TokenLimiter ¶
type TokenLimiter struct {
// contains filtered or unexported fields
}
TokenLimiter is used to limit the number of concurrent tasks.
func NewTokenLimiter ¶
func NewTokenLimiter(count int) *TokenLimiter
NewTokenLimiter creates a TokenLimiter with count tokens.