From b6669ae6dda06f53fe221f80507123d967f7f099 Mon Sep 17 00:00:00 2001 From: Jack Christensen Date: Sat, 11 Jan 2020 18:23:41 -0600 Subject: [PATCH] Add PgError.SQLState method fixes #15 --- errors.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/errors.go b/errors.go index a088dcdd..7a21af98 100644 --- a/errors.go +++ b/errors.go @@ -55,6 +55,11 @@ func (pe *PgError) Error() string { return pe.Severity + ": " + pe.Message + " (SQLSTATE " + pe.Code + ")" } +// SQLState returns the SQLState of the error. +func (pe *PgError) SQLState() string { + return pe.Code +} + type connectError struct { config *Config msg string