Documentation ¶
Index ¶
- func NetworkAddress(host string, port uint16) (network, address string)
- func SafeToRetry(err error) bool
- func Timeout(err error) bool
- type AfterConnectFunc
- type Batch
- type BuildFrontendFunc
- type CommandTag
- type ConcreteConfig
- type ConcreteNotification
- func (c *ConcreteNotification) Channel() string
- func (c *ConcreteNotification) PID() uint32
- func (c *ConcreteNotification) Payload() string
- func (c *ConcreteNotification) SetChannel(s string) Notification
- func (c *ConcreteNotification) SetPID(u uint32) Notification
- func (c *ConcreteNotification) SetPayload(s string) Notification
- type Config
- type DialFunc
- type FallbackConfig
- type Frontend
- type HijackedConn
- type LookupFunc
- type MultiResultReader
- type Notice
- type NoticeHandler
- type Notification
- type NotificationHandler
- type PgConn
- type PgError
- type Result
- type ResultReader
- type StatementDescription
- type ValidateConnectFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NetworkAddress ¶
func SafeToRetry ¶
Types ¶
type CommandTag ¶
type ConcreteConfig ¶
type ConcreteConfig Config
type ConcreteNotification ¶
type ConcreteNotification struct {
*pgconn.Notification
}
func (*ConcreteNotification) Channel ¶
func (c *ConcreteNotification) Channel() string
func (*ConcreteNotification) PID ¶
func (c *ConcreteNotification) PID() uint32
func (*ConcreteNotification) Payload ¶
func (c *ConcreteNotification) Payload() string
func (*ConcreteNotification) SetChannel ¶
func (c *ConcreteNotification) SetChannel(s string) Notification
func (*ConcreteNotification) SetPID ¶
func (c *ConcreteNotification) SetPID(u uint32) Notification
func (*ConcreteNotification) SetPayload ¶
func (c *ConcreteNotification) SetPayload(s string) Notification
type Config ¶
type Config interface { Host() string Port() uint16 Database() string User() string Password() string TLSConfig() *tls.Config // nil disables TLS ConnectTimeout() time.Duration DialFunc() DialFunc // e.g. net.Dialer.DialContext LookupFunc() LookupFunc // e.g. net.Resolver.LookupHost BuildFrontend() BuildFrontendFunc RuntimeParams() map[string]string // Run-time parameters to set on connection as session default values (e.g. search_path or application_name) Fallbacks() []FallbackConfig // ValidateConnect is called during a connection attempt after a successful authentication with the PostgreSQL server. // It can be used to validate that the server is acceptable. If this returns an error the connection is closed and the next // fallback config is tried. This allows implementing high availability behavior such as libpq does with target_session_attrs. ValidateConnect() ValidateConnectFunc // AfterConnect is called after ValidateConnect. It can be used to set up the connection (e.g. Set session variables // or prepare statements). If this returns an error the connection attempt fails. AfterConnect() AfterConnectFunc // OnNotice is a callback function called when a notice response is received. OnNotice() NoticeHandler // OnNotification is a callback function called when a notification from the LISTEN/NOTIFY system is received. OnNotification() NotificationHandler Copy() Config }
func ParseConfig ¶
func PgconnConfigFromBasePgconnConfig ¶
func PgconnConfigFromBasePgconnConfig(basePgconn.Config) Config
type FallbackConfig ¶
type FallbackConfig interface { Host() string Port() uint16 TLSConfig() *tls.Config SetHost(string) FallbackConfig SetPort(uint16) FallbackConfig SetTLSConfig(config *tls.Config) FallbackConfig }
type HijackedConn ¶
type HijackedConn interface { Config() Config Conn() net.Conn Frontend() Frontend ParameterStatuses() map[string]string PID() uint32 SecretKey() uint32 TxStatus() byte SetConfig(Config) HijackedConn SetConn(net.Conn) HijackedConn SetFrontend(Frontend) HijackedConn SetParameterStatuses(map[string]string) HijackedConn SetPID(uint32) HijackedConn SetSecretKey(uint32) HijackedConn SetTxStatus(byte) HijackedConn }
type LookupFunc ¶
type LookupFunc = pgconn.LookupFunc
type MultiResultReader ¶
type MultiResultReader interface { Close() error NextResult() bool ReadAll() ([]*Result, error) ResultReader() *ResultReader }
type NoticeHandler ¶
type Notification ¶
type Notification interface { Channel() string Payload() string PID() uint32 SetChannel(string) Notification SetPayload(string) Notification SetPID(uint32) Notification }
type NotificationHandler ¶
type NotificationHandler func(PgConn, Notification)
type PgConn ¶
type PgConn interface { CancelRequest(ctx context.Context) error CleanupDone() chan (struct{}) Close(ctx context.Context) error Conn() net.Conn CopyFrom(ctx context.Context, r io.Reader, sql string) (CommandTag, error) CopyTo(ctx context.Context, w io.Writer, sql string) (CommandTag, error) EscapeString(s string) (string, error) Exec(ctx context.Context, sql string) *MultiResultReader ExecBatch(ctx context.Context, batch *Batch) *MultiResultReader ExecParams(ctx context.Context, sql string, paramValues [][]byte, paramOIDs []uint32, paramFormats []int16, resultFormats []int16) *ResultReader ExecPrepared(ctx context.Context, stmtName string, paramValues [][]byte, paramFormats []int16, resultFormats []int16) *ResultReader Hijack() (*HijackedConn, error) IsBusy() bool IsClosed() bool ParameterStatus(key string) string PID() uint32 Prepare(ctx context.Context, name, sql string, paramOIDs []uint32) (*StatementDescription, error) ReceiveMessage(ctx context.Context) (pgproto3.BackendMessage, error) ReceiveResults(ctx context.Context) *MultiResultReader SecretKey() uint32 SendBytes(ctx context.Context, buf []byte) error TxStatus() byte WaitForNotification(ctx context.Context) error }
func ConnectConfig ¶
func Construct ¶
func Construct(hc HijackedConn) (PgConn, error)
type PgError ¶
func ErrorResponseToPgError ¶
func ErrorResponseToPgError(msg *pgproto3.ErrorResponse) *PgError
type Result ¶
type Result interface { CommandTag() CommandTag Err() error FieldDescriptions() []pgproto3.FieldDescription Rows() [][][]byte SetCommandTag(CommandTag) Result SetErr(error) Result SetFieldDescriptions([]pgproto3.FieldDescription) Result SetRows([][][]byte) Result }
type ResultReader ¶
type ResultReader interface { Close() (CommandTag, error) FieldDescriptions() []pgproto3.FieldDescription NextRow() bool Read() Result Values() [][]byte }
type StatementDescription ¶
type StatementDescription interface { Fields() []pgproto3.FieldDescription Name() string ParamOIDs() []uint32 SQL() string SetFields([]pgproto3.FieldDescription) StatementDescription SetName(string) StatementDescription SetParamOIDs([]uint32) StatementDescription SetSQL(string) StatementDescription }
Click to show internal directories.
Click to hide internal directories.