Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Database ¶
type Database interface { // GetDB Get the underlying sql.DB object of the database GetDB() *sql.DB // Query Executes a query and return the cursor Query(sql string) (Cursor, error) // QueryContext Executes a query with context and return the cursor QueryContext(ctx context.Context, sqlString string) (Cursor, error) // Execute Executes a statement Execute(sql string) (sql.Result, error) // ExecuteContext Executes a statement with context ExecuteContext(ctx context.Context, sql string) (sql.Result, error) // SetLogger Set the logger function SetLogger(logger func(sql string, durationNano int64)) // SetRetryPolicy Set the retry policy function. // The retry policy function returns true if needs retry. SetRetryPolicy(retryPolicy func(err error) bool) // EnableCallerInfo enable or disable caller info EnableCallerInfo(enableCallerInfo bool) // SetInterceptor Set a interceptor function SetInterceptor(interceptor InterceptorFunc) }
Database is the interface of a database with underlying sql.DB object.
type InterceptorFunc ¶
type InterceptorFunc = func(ctx context.Context, sql string, invoker InvokerFunc) error
InterceptorFunc is the function type of an interceptor. An interceptor should implement this function to fulfill it's purpose.
type InvokerFunc ¶
InvokerFunc is the function type of the actual invoker. It should be called in an interceptor.
Click to show internal directories.
Click to hide internal directories.