Documentation ¶
Index ¶
- Variables
- func DSN() (string, error)
- func Execute(ctx context.Context, fn func(context.Context, *sql.Conn) error) error
- func Query(ctx context.Context, conn *sql.Conn, fn func(*sql.Rows) error, query string, ...) error
- func QueryWithoutCtx(fn func(*sql.Rows) error, query string, arguments ...interface{}) error
- func TransactionExec(ctx context.Context, tx *sql.Tx, query string, args ...interface{}) error
- type Configuration
Constants ¶
This section is empty.
Variables ¶
var DB *sql.DB
Functions ¶
func DSN ¶
DSN returns the data soure name from the environment. If there is a configuration problem an error is returned.
func QueryWithoutCtx ¶
Types ¶
type Configuration ¶
Configuration represents a set of configuration key/value pairs.
func GetConfiguration ¶
func GetConfiguration(name string) (Configuration, error)
GetConfiguration returns a named configuration from the database. If this fails an error is returned. The returned configuration even if fetching was not successful can be used to lookup specific values for given keys.
func LoadConfiguration ¶
func LoadConfiguration(name string) (Configuration, error)
LoadConfiguration loads an uncached configuration from the database.
func LoadConfigurationPrefix ¶
func LoadConfigurationPrefix(name, prefix string) (Configuration, error)
LoadConfiguration loads an uncached configuration from the database where the keys have a given prefix.
func (Configuration) Int64 ¶
func (cfg Configuration) Int64(key string, def int64) int64
Int64 returns the int64 value for a given key. If not found the given default value is returned. This methods works on uninitialized configurations, too.
func (Configuration) String ¶
func (cfg Configuration) String(key, def string) string
String returns the string value for a given key. If not found the given default value is returned. This methods works on uninitialized configurations, too.