Documentation ¶
Index ¶
- type CachingProxy
- func (proxy *CachingProxy) Exec(query string, args ...interface{}) (res sql.Result, err error)
- func (proxy *CachingProxy) ExecContext(ctx context.Context, query string, args ...interface{}) (res sql.Result, err error)
- func (proxy *CachingProxy) Prepare(query string) (*sql.Stmt, error)
- func (proxy *CachingProxy) PrepareContext(ctx context.Context, query string) (*sql.Stmt, error)
- func (proxy *CachingProxy) Query(query string, args ...interface{}) (rows *sql.Rows, err error)
- func (proxy *CachingProxy) QueryContext(ctx context.Context, query string, args ...interface{}) (rows *sql.Rows, err error)
- func (proxy *CachingProxy) QueryRow(query string, args ...interface{}) *sql.Row
- func (proxy *CachingProxy) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
- type CachingWrapper
- func (wrapper *CachingWrapper) ExecContextPrepared(ctx context.Context, query string, args ...interface{}) (res sql.Result, err error)
- func (wrapper *CachingWrapper) ExecPrepared(query string, args ...interface{}) (res sql.Result, err error)
- func (wrapper *CachingWrapper) QueryContextPrepared(ctx context.Context, query string, args ...interface{}) (rows *sql.Rows, err error)
- func (wrapper *CachingWrapper) QueryPrepared(query string, args ...interface{}) (rows *sql.Rows, err error)
- func (wrapper *CachingWrapper) QueryRowContextPrepared(ctx context.Context, query string, args ...interface{}) *sql.Row
- func (wrapper *CachingWrapper) QueryRowPrepared(query string, args ...interface{}) *sql.Row
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CachingProxy ¶
Caching proxy and wrapper around sql.DB. Exec, Query, QueryRow, ExecContext, QueryContext, and QueryRowContext are each wrapped to cache and reuse prepared statements
func (*CachingProxy) Exec ¶
func (proxy *CachingProxy) Exec(query string, args ...interface{}) (res sql.Result, err error)
sql.DB.Exec with caching and reuse of the generated prepared statement
func (*CachingProxy) ExecContext ¶
func (proxy *CachingProxy) ExecContext(ctx context.Context, query string, args ...interface{}) (res sql.Result, err error)
sql.DB.ExecContext with caching and reuse of the generated prepared statement
func (*CachingProxy) Prepare ¶
func (proxy *CachingProxy) Prepare(query string) (*sql.Stmt, error)
sql.DB.Prepare that checks an object cache before creating a new prepared statement
func (*CachingProxy) PrepareContext ¶
sql.DB.PrepareContext that checks an object cache before creating a new prepared statement
func (*CachingProxy) Query ¶
func (proxy *CachingProxy) Query(query string, args ...interface{}) (rows *sql.Rows, err error)
sql.DB.Query with caching and reuse of the generated prepared statement
func (*CachingProxy) QueryContext ¶
func (proxy *CachingProxy) QueryContext(ctx context.Context, query string, args ...interface{}) (rows *sql.Rows, err error)
sql.DB.QueryContext with caching and reuse of the generated prepared statement
func (*CachingProxy) QueryRow ¶
func (proxy *CachingProxy) QueryRow(query string, args ...interface{}) *sql.Row
sql.DB.QueryRow with caching and reuse of the generated prepared statement
func (*CachingProxy) QueryRowContext ¶
func (proxy *CachingProxy) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
sql.DB.QueryRowContext with caching and reuse of the generated prepared statement
type CachingWrapper ¶
Wrapper around DB with additional functions that explicitly reuse cached prepared statements. All sql.DB query functions are wrapped and available with the suffix "Prepared", e.g. QueryPrepared, ExecPrepared
func NewCachingWrapper ¶
func NewCachingWrapper(db *sql.DB) *CachingWrapper
Returns a CachingWrapper
func (*CachingWrapper) ExecContextPrepared ¶
func (wrapper *CachingWrapper) ExecContextPrepared(ctx context.Context, query string, args ...interface{}) (res sql.Result, err error)
sql.DB.ExecContext with caching and reuse of the generated prepared statement
func (*CachingWrapper) ExecPrepared ¶
func (wrapper *CachingWrapper) ExecPrepared(query string, args ...interface{}) (res sql.Result, err error)
sql.DB.Exec with caching and reuse of the generated prepared statement
func (*CachingWrapper) QueryContextPrepared ¶
func (wrapper *CachingWrapper) QueryContextPrepared(ctx context.Context, query string, args ...interface{}) (rows *sql.Rows, err error)
sql.DB.QueryContext with caching and reuse of the generated prepared statement
func (*CachingWrapper) QueryPrepared ¶
func (wrapper *CachingWrapper) QueryPrepared(query string, args ...interface{}) (rows *sql.Rows, err error)
sql.DB.Query with caching and reuse of the generated prepared statement
func (*CachingWrapper) QueryRowContextPrepared ¶
func (wrapper *CachingWrapper) QueryRowContextPrepared(ctx context.Context, query string, args ...interface{}) *sql.Row
sql.DB.QueryRowContext with caching and reuse of the generated prepared statement
func (*CachingWrapper) QueryRowPrepared ¶
func (wrapper *CachingWrapper) QueryRowPrepared(query string, args ...interface{}) *sql.Row
sql.DB.QueryRow with caching and reuse of the generated prepared statement