Versions in this module Expand all Collapse all v1 v1.12.0 Apr 6, 2022 Changes in this version + func NetworkAddress(host string, port uint16) (network, address string) + func SafeToRetry(err error) bool + func Timeout(err error) bool + func ValidateConnectTargetSessionAttrsPrimary(ctx context.Context, pgConn *PgConn) error + func ValidateConnectTargetSessionAttrsReadOnly(ctx context.Context, pgConn *PgConn) error + func ValidateConnectTargetSessionAttrsReadWrite(ctx context.Context, pgConn *PgConn) error + func ValidateConnectTargetSessionAttrsStandby(ctx context.Context, pgConn *PgConn) error + type AfterConnectFunc func(ctx context.Context, pgconn *PgConn) error + type Batch struct + func (batch *Batch) ExecParams(sql string, paramValues [][]byte, paramOIDs []uint32, paramFormats []int16, ...) + func (batch *Batch) ExecPrepared(stmtName string, paramValues [][]byte, paramFormats []int16, ...) + type BuildFrontendFunc func(r io.Reader, w io.Writer) Frontend + type CommandTag []byte + func (ct CommandTag) Delete() bool + func (ct CommandTag) Insert() bool + func (ct CommandTag) RowsAffected() int64 + func (ct CommandTag) Select() bool + func (ct CommandTag) String() string + func (ct CommandTag) Update() bool + type Config struct + AfterConnect AfterConnectFunc + BuildFrontend BuildFrontendFunc + ConnectTimeout time.Duration + Database string + DialFunc DialFunc + Fallbacks []*FallbackConfig + Host string + LookupFunc LookupFunc + OnNotice NoticeHandler + OnNotification NotificationHandler + Password string + Port uint16 + RuntimeParams map[string]string + TLSConfig *tls.Config + User string + ValidateConnect ValidateConnectFunc + func ParseConfig(connString string) (*Config, error) + func (c *Config) Copy() *Config + type DialFunc func(ctx context.Context, network, addr string) (net.Conn, error) + type FallbackConfig struct + Host string + Port uint16 + TLSConfig *tls.Config + type Frontend interface + Receive func() (pgproto3.BackendMessage, error) + type HijackedConn struct + Config *Config + Conn net.Conn + Frontend Frontend + PID uint32 + ParameterStatuses map[string]string + SecretKey uint32 + TxStatus byte + type LookupFunc func(ctx context.Context, host string) (addrs []string, err error) + type MultiResultReader struct + func (mrr *MultiResultReader) Close() error + func (mrr *MultiResultReader) NextResult() bool + func (mrr *MultiResultReader) ReadAll() ([]*Result, error) + func (mrr *MultiResultReader) ResultReader() *ResultReader + type Notice PgError + type NoticeHandler func(*PgConn, *Notice) + type Notification struct + Channel string + PID uint32 + Payload string + type NotificationHandler func(*PgConn, *Notification) + type PgConn struct + func Connect(ctx context.Context, connString string) (*PgConn, error) + func ConnectConfig(ctx context.Context, config *Config) (pgConn *PgConn, err error) + func Construct(hc *HijackedConn) (*PgConn, error) + func (pgConn *PgConn) CancelRequest(ctx context.Context) error + func (pgConn *PgConn) CleanupDone() chan (struct{}) + func (pgConn *PgConn) Close(ctx context.Context) error + func (pgConn *PgConn) Conn() net.Conn + func (pgConn *PgConn) CopyFrom(ctx context.Context, r io.Reader, sql string) (CommandTag, error) + func (pgConn *PgConn) CopyTo(ctx context.Context, w io.Writer, sql string) (CommandTag, error) + func (pgConn *PgConn) EscapeString(s string) (string, error) + func (pgConn *PgConn) Exec(ctx context.Context, sql string) *MultiResultReader + func (pgConn *PgConn) ExecBatch(ctx context.Context, batch *Batch) *MultiResultReader + func (pgConn *PgConn) ExecParams(ctx context.Context, sql string, paramValues [][]byte, paramOIDs []uint32, ...) *ResultReader + func (pgConn *PgConn) ExecPrepared(ctx context.Context, stmtName string, paramValues [][]byte, ...) *ResultReader + func (pgConn *PgConn) Hijack() (*HijackedConn, error) + func (pgConn *PgConn) IsBusy() bool + func (pgConn *PgConn) IsClosed() bool + func (pgConn *PgConn) PID() uint32 + func (pgConn *PgConn) ParameterStatus(key string) string + func (pgConn *PgConn) Prepare(ctx context.Context, name, sql string, paramOIDs []uint32) (*StatementDescription, error) + func (pgConn *PgConn) ReceiveMessage(ctx context.Context) (pgproto3.BackendMessage, error) + func (pgConn *PgConn) ReceiveResults(ctx context.Context) *MultiResultReader + func (pgConn *PgConn) SecretKey() uint32 + func (pgConn *PgConn) SendBytes(ctx context.Context, buf []byte) error + func (pgConn *PgConn) TxStatus() byte + func (pgConn *PgConn) WaitForNotification(ctx context.Context) error + type PgError struct + Code string + ColumnName string + ConstraintName string + DataTypeName string + Detail string + File string + Hint string + InternalPosition int32 + InternalQuery string + Line int32 + Message string + Position int32 + Routine string + SchemaName string + Severity string + TableName string + Where string + func ErrorResponseToPgError(msg *pgproto3.ErrorResponse) *PgError + func (pe *PgError) Error() string + func (pe *PgError) SQLState() string + type Result struct + CommandTag CommandTag + Err error + FieldDescriptions []pgproto3.FieldDescription + Rows [][][]byte + type ResultReader struct + func (rr *ResultReader) Close() (CommandTag, error) + func (rr *ResultReader) FieldDescriptions() []pgproto3.FieldDescription + func (rr *ResultReader) NextRow() bool + func (rr *ResultReader) Read() *Result + func (rr *ResultReader) Values() [][]byte + type StatementDescription struct + Fields []pgproto3.FieldDescription + Name string + ParamOIDs []uint32 + SQL string + type ValidateConnectFunc func(ctx context.Context, pgconn *PgConn) error