const (
DEFAULT_MAX_QUERY_MILLIS = 3000
)
func IsSQLSafe(txt string) bool
**** // Helpers /********* returns true if this string is sql safe (no special characters
type DB struct {
MaxQueryTimeout int
// contains filtered or unexported fields
}
func Open() (*DB, error)
call this once when you startup and cache the result only if there is an error you'll need to retry
func OpenWithInfo(dbhost, dbdb, dbuser, dbpw string) (*DB, error)
func (d *DB) CheckDuplicateRowError(err error) bool
func (d *DB) Conn(ctx context.Context) (*sql.Conn, error)
func (d *DB) ExecContext(ctx context.Context, name string, query string, args ...interface{}) (sql.Result, error)
"name" will be used to provide timing information as prometheus metric.
func (d *DB) ExecContextQuiet(ctx context.Context, name string, query string, args ...interface{}) (sql.Result, error)
func (d *DB) GetDatabaseName() string
func (d *DB) GetFailureCounter() *utils.SlidingAverage
func (d *DB) QueryContext(ctx context.Context, name string, query string, args ...interface{}) (*sql.Rows, error)
"name" will be used to provide timing information as prometheus metric.
func (d *DB) QueryRowContext(ctx context.Context, name string, query string, args ...interface{}) *sql.Row
discouraged use. QueryRow() does not provide an error on the query, nor do we get a good timing value. Use QueryContext() instead.
type PoolSizeCollector struct {
// contains filtered or unexported fields
}
func NewPoolSizeCollector() *PoolSizeCollector
func (c *PoolSizeCollector) Collect(ch chan<- pm.Metric)
func (c *PoolSizeCollector) Describe(ch chan<- *pm.Desc)