Documentation ¶
Index ¶
- Constants
- Variables
- func Connect(logger lager.Logger, ...) (*sql.DB, error)
- func NewSQLHelper(flavor string) *sqlHelper
- func QuestionMarks(count int) string
- func RebindForFlavor(query, flavor string) string
- type ColumnList
- type ErrUnknownError
- type Queryable
- type QueryableDB
- type RowLock
- type RowScanner
- type SQLAttributes
- type SQLHelper
- type Tx
Constants ¶
View Source
const ( MySQL = "mysql" Postgres = "postgres" LockRow RowLock = true NoLockRow RowLock = false )
View Source
const MYSQL_GROUP_CONCAT_MAX_LEN = 78888889
MYSQL group_concat_max_len system variable defines the length of the result returned by GROUP_CONCAT() function default value 1024 only allows 282 instance indexes to be concatenated this will allow 10_000_000 instance indexes
Variables ¶
Functions ¶
func NewSQLHelper ¶
func NewSQLHelper(flavor string) *sqlHelper
func QuestionMarks ¶
func RebindForFlavor ¶
Types ¶
type ColumnList ¶
type ColumnList []string
type ErrUnknownError ¶
type ErrUnknownError struct {
// contains filtered or unexported fields
}
func (*ErrUnknownError) Error ¶
func (e *ErrUnknownError) Error() string
type Queryable ¶
type Queryable interface { ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) PrepareContext(ctx context.Context, query string) (*sql.Stmt, error) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) QueryRowContext(ctx context.Context, query string, args ...interface{}) RowScanner }
type QueryableDB ¶
type QueryableDB interface { Queryable BeginTx(ctx context.Context, opts *sql.TxOptions) (Tx, error) OpenConnections() int WaitDuration() time.Duration WaitCount() int64 }
func NewMonitoredDB ¶
func NewMonitoredDB(db *sql.DB, monitor monitor.Monitor) QueryableDB
type RowScanner ¶
type RowScanner interface {
Scan(dest ...interface{}) error
}
func NewRowScanner ¶
func NewRowScanner(monitor monitor.Monitor, scanner RowScanner) RowScanner
type SQLAttributes ¶
type SQLAttributes map[string]interface{}
type SQLHelper ¶
type SQLHelper interface { Transact(ctx context.Context, logger lager.Logger, db QueryableDB, f func(logger lager.Logger, tx Tx) error) error RetryOnDeadlock(logger lager.Logger, f func() error) error One(ctx context.Context, logger lager.Logger, q Queryable, table string, columns ColumnList, lockRow RowLock, wheres string, whereBindings ...interface{}) RowScanner All(ctx context.Context, logger lager.Logger, q Queryable, table string, columns ColumnList, lockRow RowLock, wheres string, whereBindings ...interface{}) (*sql.Rows, error) Upsert(ctx context.Context, logger lager.Logger, q Queryable, table string, attributes SQLAttributes, wheres string, whereBindings ...interface{}) (bool, error) Insert(ctx context.Context, logger lager.Logger, q Queryable, table string, attributes SQLAttributes) (sql.Result, error) Update(ctx context.Context, logger lager.Logger, q Queryable, table string, updates SQLAttributes, wheres string, whereBindings ...interface{}) (sql.Result, error) Delete(ctx context.Context, logger lager.Logger, q Queryable, table string, wheres string, whereBindings ...interface{}) (sql.Result, error) Count(ctx context.Context, logger lager.Logger, q Queryable, table string, wheres string, whereBindings ...interface{}) (int, error) ConvertSQLError(err error) error Rebind(query string) string }
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
monitorfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
Click to show internal directories.
Click to hide internal directories.