Documentation ¶
Index ¶
- Variables
- func DebugVars() map[string]interface{}
- func FetchInt(vars map[string]interface{}, tags string) int
- func FetchVal(vars map[string]interface{}, tags string) interface{}
- func NewServer(config tabletserver.Config, connParams sqldb.ConnParams, enableRowcache bool) (*tabletserver.TabletServer, error)
- func StartDefaultServer(connParams sqldb.ConnParams) error
- func StopDefaultServer()
- type QueryClient
- type QueryFetcher
- type TxFetcher
Constants ¶
This section is empty.
Variables ¶
var ( // BaseConfig is the base config of the default server. BaseConfig tabletserver.Config // Target is the target info for the default server. Target query.Target // DefaultServer is the default server. DefaultServer *tabletserver.TabletServer // ServerAddress is the http URL for the default server. ServerAddress string )
Functions ¶
func DebugVars ¶
func DebugVars() map[string]interface{}
DebugVars parses /debug/vars and returns a map. The function returns an empty map on error.
func FetchInt ¶
FetchInt fetches the specified dot-separated tag and returns the value as an int. It returns 0 on error, or if not found.
func FetchVal ¶
FetchVal fetches the specified dot-separated tag and returns the value as an interface. It returns nil on error, or if not found.
func NewServer ¶
func NewServer(config tabletserver.Config, connParams sqldb.ConnParams, enableRowcache bool) (*tabletserver.TabletServer, error)
NewServer starts a new unregistered TabletServer. You have to end it with StopService once testing is done.
func StartDefaultServer ¶
func StartDefaultServer(connParams sqldb.ConnParams) error
StartDefaultServer starts the default server and initializes all the global variables. This function should only be called once at the beginning of the test.
func StopDefaultServer ¶
func StopDefaultServer()
StopDefaultServer must be called once all the tests are done.
Types ¶
type QueryClient ¶
type QueryClient struct {
// contains filtered or unexported fields
}
QueryClient provides a convenient wrapper for TabletServer's query service. It's not thread safe, but you can create multiple clients that point to the same server.
func NewClient ¶
func NewClient(server *tabletserver.TabletServer) *QueryClient
NewClient creates a new client for the specified server.
func NewDefaultClient ¶
func NewDefaultClient() *QueryClient
NewDefaultClient creates a new client for the default server.
func (*QueryClient) Commit ¶
func (client *QueryClient) Commit() error
Commit commits the current transaction.
func (*QueryClient) Execute ¶
func (client *QueryClient) Execute(query string, bindvars map[string]interface{}) (*mproto.QueryResult, error)
Execute executes a query.
func (*QueryClient) Rollback ¶
func (client *QueryClient) Rollback() error
Rollback rolls back the current transaction.
type QueryFetcher ¶
type QueryFetcher struct {
// contains filtered or unexported fields
}
QueryFetcher allows you to capture and fetch queries that are being executed by TabletServer.
func NewQueryFetcher ¶
func NewQueryFetcher() *QueryFetcher
NewQueryFetcher sets up the capture and retuns a QueryFetcher. It has a buffer size of 20. You must call Close once done.
func (*QueryFetcher) Next ¶
func (fetcher *QueryFetcher) Next() (*tabletserver.LogStats, error)
Next fetches the next captured query. If the wait is longer than one second, it returns an error.
type TxFetcher ¶
type TxFetcher struct {
// contains filtered or unexported fields
}
TxFetcher allows you to capture and fetch info on the next transaction.
func NewTxFetcher ¶
func NewTxFetcher() *TxFetcher
NewTxFetcher sets up the capture and returns a new TxFetcher.
func (*TxFetcher) Fetch ¶
func (fetcher *TxFetcher) Fetch() (*tabletserver.TxConnection, error)
Fetch fetches the last captured transaction. It must be called only once. If the wait is longer than one second, it returns an error.