Documentation ¶
Index ¶
Constants ¶
View Source
const ( // ErrUnknown is returned for all errors with unknown cause. ErrUnknown = iota // ErrUniqueViolation is returned for unique constraint violations. ErrUniqueViolation // ErrNotNullViolation is returned for non-null constraint violations. ErrNotNullViolation // ErrRecordNotFound is returned when query is expected to return a single record, but none are returned. ErrRecordNotFound // ErrInvalidText is returned when you try assigned invalid value to types such as uuid. ErrInvalidText )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client is a wrapper for *gorm.DB providing a handy Close() function.
func DialPostgres ¶
DialPostgres creates a connection to Postgres using values from specified config.Config, and returns Client instance.
type Error ¶
type Error struct { // Err is the wrapped error. Err error // Code is the error code. Code int // Constraint is the name of violated constraint. Constraint string // TableName is the name of the table. TableName string // ColumnName is the name of the column. ColumnName string // Message is the message returned by the DB. Message string }
Error represents a wrapped query error.
func TranslateError ¶
TranslateError tries to cast given error instance to PgError and extract enough information to build Error instance.
Click to show internal directories.
Click to hide internal directories.