From 5f8d853b34bfa09fa9727f9122a347fa941af6f5 Mon Sep 17 00:00:00 2001 From: Oleg Kovalov Date: Sat, 10 Oct 2020 12:57:05 +0200 Subject: [PATCH] remove unused definitions on conn.go --- conn.go | 51 --------------------------------------------------- 1 file changed, 51 deletions(-) diff --git a/conn.go b/conn.go index cf6db0d6..f14e1801 100644 --- a/conn.go +++ b/conn.go @@ -10,18 +10,10 @@ import ( "github.com/jackc/pgconn" "github.com/jackc/pgconn/stmtcache" - "github.com/jackc/pgproto3/v2" "github.com/jackc/pgtype" "github.com/jackc/pgx/v4/internal/sanitize" ) -const ( - connStatusUninitialized = iota - connStatusClosed - connStatusIdle - connStatusBusy -) - // ConnConfig contains all the options used to establish a connection. It must be created by ParseConfig and // then it can be modified. A manually initialized ConnConfig will cause ConnectConfig to panic. type ConnConfig struct { @@ -321,49 +313,6 @@ func (c *Conn) IsClosed() bool { return c.pgConn.IsClosed() } -// Processes messages that are not exclusive to one context such as -// authentication or query response. The response to these messages is the same -// regardless of when they occur. It also ignores messages that are only -// meaningful in a given context. These messages can occur due to a context -// deadline interrupting message processing. For example, an interrupted query -// may have left DataRow messages on the wire. -func (c *Conn) processContextFreeMsg(msg pgproto3.BackendMessage) (err error) { - switch msg := msg.(type) { - case *pgproto3.ErrorResponse: - return c.rxErrorResponse(msg) - } - - return nil -} - -func (c *Conn) rxErrorResponse(msg *pgproto3.ErrorResponse) *pgconn.PgError { - err := &pgconn.PgError{ - Severity: msg.Severity, - Code: msg.Code, - Message: msg.Message, - Detail: msg.Detail, - Hint: msg.Hint, - Position: msg.Position, - InternalPosition: msg.InternalPosition, - InternalQuery: msg.InternalQuery, - Where: msg.Where, - SchemaName: msg.SchemaName, - TableName: msg.TableName, - ColumnName: msg.ColumnName, - DataTypeName: msg.DataTypeName, - ConstraintName: msg.ConstraintName, - File: msg.File, - Line: msg.Line, - Routine: msg.Routine, - } - - if err.Severity == "FATAL" { - c.die(err) - } - - return err -} - func (c *Conn) die(err error) { if c.IsClosed() { return