Documentation ¶
Index ¶
- Variables
- func GetTmpDir(dir, module string, log *xlog.Log) string
- type DB
- func (db *DB) AddQuery(query string, result *sqltypes.Result)
- func (db *DB) AddQueryDelay(query string, result *sqltypes.Result, delayMS int)
- func (db *DB) AddQueryError(query string, err error)
- func (db *DB) AddQueryErrorPattern(qp string, err error)
- func (db *DB) AddQueryPanic(query string)
- func (db *DB) AddQueryPattern(qp string, result *sqltypes.Result)
- func (db *DB) AddQueryStream(query string, result *sqltypes.Result)
- func (db *DB) AddQuerys(query string, result ...*sqltypes.Result)
- func (db *DB) Addrs() []string
- func (db *DB) BackendConfs() []*config.BackendConfig
- func (db *DB) Close()
- func (db *DB) GetQueryCalledNum(query string) int
- func (db *DB) ResetAll()
- func (db *DB) ResetErrors()
- func (db *DB) ResetPatternErrors()
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Result1 result. Result1 = &sqltypes.Result{ Fields: []*querypb.Field{ { Name: "id", Type: querypb.Type_INT32, }, { Name: "name", Type: querypb.Type_VARCHAR, }, }, Rows: [][]sqltypes.Value{ { sqltypes.MakeTrusted(querypb.Type_INT32, []byte("11")), sqltypes.MakeTrusted(querypb.Type_VARCHAR, []byte("1nice name")), }, { sqltypes.MakeTrusted(querypb.Type_INT32, []byte("12")), sqltypes.NULL, }, }, } // Result2 result. Result2 = &sqltypes.Result{ Fields: []*querypb.Field{ { Name: "id", Type: querypb.Type_INT32, }, { Name: "name", Type: querypb.Type_VARCHAR, }, }, Rows: [][]sqltypes.Value{ { sqltypes.MakeTrusted(querypb.Type_INT32, []byte("21")), sqltypes.MakeTrusted(querypb.Type_VARCHAR, []byte("2nice name")), }, { sqltypes.MakeTrusted(querypb.Type_INT32, []byte("22")), sqltypes.NULL, }, }, } // Result3 result. Result3 = &sqltypes.Result{} )
Functions ¶
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is a fake database.
func (*DB) AddQueryDelay ¶
AddQueryDelay used to add query and return by delay.
func (*DB) AddQueryError ¶
AddQueryError use to add a query and return the error expected.
func (*DB) AddQueryErrorPattern ¶
AddQueryErrorPattern use to add a query and return the error expected.
func (*DB) AddQueryPanic ¶
AddQueryPanic used to add the query with panic.
func (*DB) AddQueryPattern ¶
AddQueryPattern used to add an expected result for a set of queries.
func (*DB) AddQueryStream ¶
AddQueryStream used to add a query and the streamly return result expected.
func (*DB) BackendConfs ¶
func (db *DB) BackendConfs() []*config.BackendConfig
BackendConfs used to get all backend configs.
func (*DB) GetQueryCalledNum ¶
GetQueryCalledNum returns how many times db executes a certain query.
func (*DB) ResetAll ¶
func (db *DB) ResetAll()
ResetAll will reset all, including: query and query patterns.
func (*DB) ResetPatternErrors ¶
func (db *DB) ResetPatternErrors()
ResetPatternErrors used to reset all the error pattern.
Click to show internal directories.
Click to hide internal directories.