github.com/XiaoMi/Gaea@v1.2.5/backend/interface.go (about) 1 package backend 2 3 import ( 4 "context" 5 "time" 6 7 "github.com/XiaoMi/Gaea/mysql" 8 ) 9 10 type PooledConnect interface { 11 Recycle() 12 Reconnect() error 13 Close() 14 IsClosed() bool 15 UseDB(db string) error 16 Execute(sql string, maxRows int) (*mysql.Result, error) 17 SetAutoCommit(v uint8) error 18 Begin() error 19 Commit() error 20 Rollback() error 21 Ping() error 22 SetCharset(charset string, collation mysql.CollationID) (bool, error) 23 FieldList(table string, wildcard string) ([]*mysql.Field, error) 24 GetAddr() string 25 SetSessionVariables(frontend *mysql.SessionVariables) (bool, error) 26 WriteSetStatement() error 27 GetConnectionID() int64 28 GetReturnTime() time.Time 29 } 30 31 type ConnectionPool interface { 32 Open() 33 Addr() string 34 Close() 35 Get(ctx context.Context) (PooledConnect, error) 36 Put(pc PooledConnect) 37 38 SetCapacity(capacity int) (err error) 39 SetIdleTimeout(idleTimeout time.Duration) 40 StatsJSON() string 41 Capacity() int64 42 Available() int64 43 Active() int64 44 InUse() int64 45 MaxCap() int64 46 WaitCount() int64 47 WaitTime() time.Duration 48 IdleTimeout() time.Duration 49 IdleClosed() int64 50 }