Documentation
¶
Overview ¶
Package database provides support for access the database.
Index ¶
- Variables
- func NameQuerySlice(ctx context.Context, log *zap.SugaredLogger, db *sqlx.DB, query string, ...) error
- func NamedExecContext(ctx context.Context, log *zap.SugaredLogger, db *sqlx.DB, query string, ...) error
- func NamedQueryStruct(ctx context.Context, log *zap.SugaredLogger, db *sqlx.DB, query string, ...) 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 ¶
View Source
var ( ErrNotFound = errors.New("not found") ErrInvalidID = errors.New("ID is not in its proper form") ErrAuthenticationFailure = errors.New("authentication failed") ErrForbidden = errors.New("attempted action is not allowed") )
Set of error variables for CURD operations.
Functions ¶
func NameQuerySlice ¶
func NameQuerySlice(ctx context.Context, log *zap.SugaredLogger, db *sqlx.DB, query string, data interface{}, dest interface{}) error
NameQuerySlice is a helper function for executing queries that return a collection of data to be unmarshalled into a slice.
func NamedExecContext ¶
func NamedExecContext(ctx context.Context, log *zap.SugaredLogger, db *sqlx.DB, query string, data interface{}) error
NamedExecContext is a helper function to execute a CURD operation with logging and tracing.
func NamedQueryStruct ¶
func NamedQueryStruct(ctx context.Context, log *zap.SugaredLogger, 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.