Documentation ¶
Overview ¶
Package db implements a SQL database.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoRows = sql.ErrNoRows
ErrNoRows is returned by the Scanner when there are no rows to scan.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // QueryPeriod is the amount of time that any database action can take before it should timeout. QueryPeriod time.Duration }
Config contains options for how the database should run.
type Database ¶
Database is a SQL db.Database with additional configuration
func (Database) Exec ¶
Exec evaluates multiple queries in a transaction, ensuring each execSQLFunction one only updates one row.
type ExecFunction ¶
type ExecFunction struct {
// contains filtered or unexported fields
}
ExecFunction is a db Query that changes data.
func NewExecFunction ¶
func NewExecFunction(name string, args ...interface{}) ExecFunction
NewExecFunction creates a Query to call an exec function.
func (ExecFunction) Args ¶
func (e ExecFunction) Args() []interface{}
Args returns the arguments for the exec function.
func (ExecFunction) Cmd ¶
func (e ExecFunction) Cmd() string
Cmd returns a SQL string to execute the function with arguments.
type Query ¶
type Query interface { // cmd is the injection-safe message to send to the database. Cmd() string // args are the user-provided properties of the messages which should be escaped. Args() []interface{} }
Query is a message that is sent to the database.
type QueryFunction ¶
type QueryFunction struct {
// contains filtered or unexported fields
}
QueryFunction is a db Query that reads data.
func NewQueryFunction ¶
func NewQueryFunction(name string, cols []string, args ...interface{}) QueryFunction
NewQueryFunction creates a Query to call a query function.
func (QueryFunction) Args ¶
func (q QueryFunction) Args() []interface{}
Args returns the arguments for the query function.
func (QueryFunction) Cmd ¶
func (q QueryFunction) Cmd() string
Cmd returns a SQL string to execute the function with arguments.