Documentation ¶
Index ¶
- type Connection
- func (c *Connection) Begin() error
- func (c *Connection) CloseDB() error
- func (c *Connection) Commit() error
- func (c *Connection) Delete(stmt string) (int64, error)
- func (c *Connection) Exec(stmt string) error
- func (c *Connection) ExecDDL(query string, args ...interface{}) error
- func (c *Connection) FetchColumns(db, table string) ([][2]string, error)
- func (c *Connection) FetchDatabases() ([]string, error)
- func (c *Connection) FetchIndexes(db, table string) ([]string, error)
- func (c *Connection) FetchSchema(db string) ([][5]string, error)
- func (c *Connection) FetchTables(db string) ([]string, error)
- func (c *Connection) GeneralLog(v int) error
- func (c *Connection) GetBeginTime() time.Time
- func (c *Connection) IfTxn() bool
- func (c *Connection) Insert(stmt string) (int64, error)
- func (c *Connection) Prepare() error
- func (c *Connection) ReConnect() error
- func (c *Connection) Rollback() error
- func (c *Connection) Select(stmt string, args ...interface{}) ([][]*QueryItem, error)
- func (c *Connection) SetTiFlashEngine() error
- func (c *Connection) ShowDatabases() ([]string, error)
- func (c *Connection) Update(stmt string) (int64, error)
- type Option
- type QueryItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection define connection struct
func New ¶
func New(dsn string, opt *Option) (*Connection, error)
New create Connection instance from dsn
func (*Connection) Delete ¶
func (c *Connection) Delete(stmt string) (int64, error)
Delete run delete statement and return error
func (*Connection) ExecDDL ¶
func (c *Connection) ExecDDL(query string, args ...interface{}) error
ExecDDL do DDL actions
func (*Connection) FetchColumns ¶
func (c *Connection) FetchColumns(db, table string) ([][2]string, error)
FetchColumns get columns for given table
func (*Connection) FetchDatabases ¶
func (c *Connection) FetchDatabases() ([]string, error)
FetchDatabases database list
func (*Connection) FetchIndexes ¶
func (c *Connection) FetchIndexes(db, table string) ([]string, error)
FetchIndexes get indexes for given table
func (*Connection) FetchSchema ¶
func (c *Connection) FetchSchema(db string) ([][5]string, error)
FetchSchema get schema of given database from database
func (*Connection) FetchTables ¶
func (c *Connection) FetchTables(db string) ([]string, error)
FetchTables table list
func (*Connection) GeneralLog ¶
func (c *Connection) GeneralLog(v int) error
GeneralLog turn on or turn off general_log in TiDB
func (*Connection) GetBeginTime ¶
func (c *Connection) GetBeginTime() time.Time
GetBeginTime get the begin time of a transaction if not in transaction, return 0
func (*Connection) Insert ¶
func (c *Connection) Insert(stmt string) (int64, error)
Insert run insert statement and return error
func (*Connection) Select ¶
func (c *Connection) Select(stmt string, args ...interface{}) ([][]*QueryItem, error)
Select run select statement and return query result
func (*Connection) SetTiFlashEngine ¶
func (c *Connection) SetTiFlashEngine() error
SetTiFlashEngine sets the isolation to TiFlash in TiDB
func (*Connection) ShowDatabases ¶
func (c *Connection) ShowDatabases() ([]string, error)
ShowDatabases list databases