Documentation ¶
Overview ¶
Package dbutil provides database related utilities
Index ¶
Constants ¶
View Source
const ( // Class 22 - Data Exception PqDataException pq.ErrorClass = "22000" PqInvalidTextRepresentation pq.ErrorCode = "22P02" // Class 23 — Integrity Constraint Violation ErrIntegrityConstraintViolation pq.ErrorClass = "23000" ErrNotNullViolation pq.ErrorCode = "23502" ErrForeignKeyViolation pq.ErrorCode = "23503" ErrUniqueViolation pq.ErrorCode = "23505" ErrCheckViolation pq.ErrorCode = "23514" )
Variables ¶
This section is empty.
Functions ¶
func InterpolateSql ¶
func RebindPlaceholders ¶
Replaces all MySQL-style '?,?,...' placeholders with Postgres-style '$1,$2,...' placeholders.
Types ¶
type DBError ¶
func NewDBError ¶
NewDBError decorates an error returned from the database with the relevant query that was used (in (*DBError).Query so that handler functions can print out which SQL query was responsible for causing the error. If the underlying error is a (*pq.Error), it also copies the Code, Detail and Hint fields from
Click to show internal directories.
Click to hide internal directories.