Documentation ¶
Overview ¶
Package store provides utilities when working with a database.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( errors.DefineUnavailable("database_unavailable", "database unavailable") // ErrNotFound is an error that indicates a missing entity. ErrNotFound = errors.DefineNotFound("not_found", "no results found") // ErrDriver is an error that indicates a driver error. ErrDriver = errors.Define("driver", "driver error") // ErrIDTaken is returned when an entity can not be created because the ID is already taken. ErrIDTaken = errors.DefineAlreadyExists("id_taken", "ID already taken, choose a different one and try again") // ErrEUITaken is returned when an entity can not be created because the EUI is already taken. ErrEUITaken = errors.DefineAlreadyExists("eui_taken", "EUI already taken") )ErrUnavailable =
Functions ¶
func NewLoggerHook ¶ added in v3.24.1
func NewLoggerHook(logger log.Interface, opts ...LoggerHookOption) bun.QueryHook
NewLoggerHook returns a new bun.QueryHook that logs queries to the logger.
func WrapDriverError ¶ added in v3.24.0
WrapDriverError wraps a driver error with the corresponding error definition.
Types ¶
type DriverError ¶ added in v3.24.0
type DriverError struct { Code string Message string Detail string Table string Column string Constraint string }
DriverError encapsulates the PostgreSQL error data.
func (*DriverError) Attributes ¶ added in v3.24.0
func (e *DriverError) Attributes() []any
Attributes gets the DriverError attributes.
func (*DriverError) GetError ¶ added in v3.24.0
func (e *DriverError) GetError() error
GetError gets the corresponding error definition.
type LoggerHookOption ¶ added in v3.24.1
type LoggerHookOption func(*loggerHook)
LoggerHookOption is an option for the LoggerHook.
Click to show internal directories.
Click to hide internal directories.