Documentation ¶
Overview ¶
Package database provides support for database interaction.
Index ¶
- Variables
- func Log(query string, args ...interface{}) string
- func NamedQuerySlice(ctx context.Context, db *sqlx.DB, query string, data interface{}, ...) error
- func NamedQueryStruct(ctx context.Context, db *sqlx.DB, query string, data interface{}, ...) error
- func Open(cfg Config) (*sqlx.DB, error)
- func StatusCheck(ctx context.Context, db *sqlx.DB) error
- type Config
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func Log ¶
Log provides a parsed print version of the query and parameters (sqlx does not provide it). PS: This function is traversing linearly to the query string so it is not efficient for the task at hand.
func NamedQuerySlice ¶
func NamedQuerySlice(ctx context.Context, db *sqlx.DB, query string, data interface{}, dest interface{}) error
NamedQuerySlice is a helper function for executing queries that return a collection of data to be unmarshaled into a slice.
func NamedQueryStruct ¶
func NamedQueryStruct(ctx context.Context, db *sqlx.DB, query string, data interface{}, dest interface{}) error
NamedQueryStruct is a helper function for executing queries that return a single value to be unmarshalled into a struct type.
Types ¶
Click to show internal directories.
Click to hide internal directories.