Documentation
¶
Overview ¶
Package errors defines pgGo's stable, machine-readable error contract.
Every failure pgGo reports has exactly one Type from the fixed set below, the PostgreSQL SQLSTATE when the server supplied one, and a retryable flag, so an agent never has to infer error categories from message strings.
Index ¶
Constants ¶
View Source
const ( Connection = "connection_error" Authentication = "authentication_error" Timeout = "timeout" Postgres = "postgres_error" InvalidInput = "invalid_input" Protocol = "protocol_error" )
Error types. This set is part of the public contract; do not rename.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct {
Type string
Code string // SQLSTATE; empty when not from the server
Message string
Detail string
Hint string
Position int // 1-based character position in the SQL, 0 if unknown
Retryable bool
}
Error is the structured error emitted as {"ok":false,"error":{...}}.
func FromServer ¶
FromServer classifies a PostgreSQL ErrorResponse by SQLSTATE.
Click to show internal directories.
Click to hide internal directories.