Documentation ¶
Index ¶
Constants ¶
View Source
const ( // TypePostgres holder for postgres database TypePostgres string = "POSTGRES" )
Variables ¶
This section is empty.
Functions ¶
func NewErrAlreadyExists ¶
NewErrAlreadyExists wraps a message in an ErrAlreadyExists object.
Types ¶
type Common ¶
type Common interface { // Close closes the db connections Close(ctx context.Context) Error // Create stores the object Create(ctx context.Context, i any) Error // DoMigration runs database migrations DoMigration(ctx context.Context) Error // LoadTestData adds test data to the database LoadTestData(ctx context.Context) Error }
Common wraps common database functions
type ErrAlreadyExists ¶
type ErrAlreadyExists struct {
// contains filtered or unexported fields
}
ErrAlreadyExists is returned when a caller tries to insert a database entry that already exists in the db.
func (*ErrAlreadyExists) Error ¶
func (e *ErrAlreadyExists) Error() string
Error returns the error message as a string.
type Error ¶
type Error error
Error represents a database specific error
var ( // ErrGenID is returned when creating a new ID can't be generated for a new model. ErrGenID Error = fmt.Errorf("can't generate id") // ErrNoEntries is returned when a caller expected an entry for a query, but none was found. ErrNoEntries Error = fmt.Errorf("no entries") // ErrMultipleEntries is returned when a caller expected ONE entry for a query, but multiples were found. ErrMultipleEntries Error = fmt.Errorf("multiple entries") // ErrUnknown denotes an unknown database error. ErrUnknown Error = fmt.Errorf("unknown error") )
Click to show internal directories.
Click to hide internal directories.