Versions in this module Expand all Collapse all v1 v1.4.0 Apr 19, 2026 Changes in this version + const AuthCleartextPassword + const AuthGSS + const AuthGSSContinue + const AuthKerberosV5 + const AuthMD5Password + const AuthOK + const AuthSASL + const AuthSASLContinue + const AuthSASLFinal + const AuthSSPI + const BackendAuthentication + const BackendBackendKeyData + const BackendBindComplete + const BackendCloseComplete + const BackendCommandComplete + const BackendCopyBothResponse + const BackendCopyData + const BackendCopyDone + const BackendCopyInResponse + const BackendCopyOutResponse + const BackendDataRow + const BackendEmptyQuery + const BackendErrorResponse + const BackendNegotiateProtocolVersion + const BackendNoData + const BackendNoticeResponse + const BackendNotification + const BackendParameterDesc + const BackendParameterStatus + const BackendParseComplete + const BackendPortalSuspended + const BackendReadyForQuery + const BackendRowDescription + const FormatBinary + const FormatText + const MsgBind + const MsgClose + const MsgCopyData + const MsgCopyDone + const MsgCopyFail + const MsgDescribe + const MsgExecute + const MsgFlush + const MsgFunctionCall + const MsgParse + const MsgPasswordMessage + const MsgQuery + const MsgSync + const MsgTerminate + const OIDBool + const OIDBoolArr + const OIDBytea + const OIDByteaArr + const OIDDate + const OIDFloat4 + const OIDFloat4Arr + const OIDFloat8 + const OIDFloat8Arr + const OIDInt2 + const OIDInt2Arr + const OIDInt4 + const OIDInt4Arr + const OIDInt8 + const OIDInt8Arr + const OIDJSON + const OIDJSONB + const OIDNumeric + const OIDText + const OIDTextArr + const OIDTimestamp + const OIDTimestamptz + const OIDUUID + const OIDUUIDArr + const OIDUnknown + const OIDVarchar + const OIDVarcharArr + const ProtocolVersion + var CopyBinaryHeader = []byte + var CopyBinaryTrailer = []byte + var ErrIncomplete = errors.New("postgres/protocol: incomplete message") + var ErrInvalidLength = errors.New("postgres/protocol: invalid message length") + var PGInfinity = time.Date(9999, 12, 31, 23, 59, 59, 0, time.UTC) + var PGNegInfinity = time.Date(-4713, 1, 1, 0, 0, 0, 0, time.UTC) + func AppendBind(w *Writer, portal, stmt string, paramFormats []int16, paramValues [][]byte, ...) + func AppendDescribe(w *Writer, kind byte, name string) + func AppendExecute(w *Writer, portal string, maxRows int32) + func AppendParse(w *Writer, name, query string, paramOIDs []uint32) + func AppendSync(w *Writer) + func DecodeIntBinary(src []byte, codec *TypeCodec) (int64, error) + func EncodeArrayBinary(dst []byte, elementOID uint32, elements []any) ([]byte, error) + func ParseCommandComplete(payload []byte) (string, error) + func ParseDataRow(payload []byte) ([][]byte, error) + func ParseDataRowInto(dst [][]byte, payload []byte) ([][]byte, error) + func ParseIntTextASCII(src []byte) (int64, error) + func ParseParameterDescription(payload []byte) ([]uint32, error) + func ReadByte(payload []byte, pos *int) (byte, error) + func ReadBytes(payload []byte, pos *int, n int) ([]byte, error) + func ReadCString(payload []byte, pos *int) (string, error) + func ReadInt16(payload []byte, pos *int) (int16, error) + func ReadInt32(payload []byte, pos *int) (int32, error) + func RegisterType(c *TypeCodec) + func RowsAffected(tag string) (int64, bool) + func RowsAffectedBytes(tag []byte) (int64, bool) + func WriteBind(w *Writer, portal, stmt string, paramFormats []int16, paramValues [][]byte, ...) []byte + func WriteClose(w *Writer, kind byte, name string) []byte + func WriteCopyData(w *Writer, rowBytes []byte) []byte + func WriteCopyDone(w *Writer) []byte + func WriteCopyFail(w *Writer, reason string) []byte + func WriteDescribe(w *Writer, kind byte, name string) []byte + func WriteExecute(w *Writer, portal string, maxRows int32) []byte + func WriteFlush(w *Writer) []byte + func WriteParse(w *Writer, name, query string, paramOIDs []uint32) []byte + func WriteQuery(w *Writer, sql string) []byte + func WriteQueryInto(w *Writer, sql string) []byte + func WriteSync(w *Writer) []byte + type ColumnDesc struct + ColumnAttNum int16 + FormatCode int16 + Name string + TableOID uint32 + TypeModifier int32 + TypeOID uint32 + TypeSize int16 + func ParseRowDescription(payload []byte) ([]ColumnDesc, error) + func ParseRowDescriptionInto(dst []ColumnDesc, payload []byte) ([]ColumnDesc, error) + type CopyInState struct + Err *PGError + Resp CopyResponse + Tag string + func (s *CopyInState) Handle(msgType byte, payload []byte) (bool, error) + func (s *CopyInState) Ready() bool + type CopyOutState struct + Err *PGError + Resp CopyResponse + Tag string + func (s *CopyOutState) Handle(msgType byte, payload []byte, onRow func([]byte)) (bool, error) + type CopyResponse struct + ColumnFormats []int16 + Format int8 + NumColumns int16 + func ParseCopyResponse(payload []byte) (CopyResponse, error) + type DecodedArray struct + Dims []int32 + ElementOID uint32 + Elements []driver.Value + func DecodeArrayBinary(src []byte) (*DecodedArray, error) + type ExtendedQueryState struct + Columns []ColumnDesc + Err *PGError + HasDescribe bool + ParamOIDs []uint32 + SkipParse bool + Tag string + func (e *ExtendedQueryState) Handle(msgType byte, payload []byte, onRow func([][]byte)) (bool, error) + func (e *ExtendedQueryState) Reset() + func (e *ExtendedQueryState) TagBytes() []byte + type PGError struct + Code string + Detail string + Extra map[byte]string + Hint string + Message string + Position int + Severity string + func ParseErrorResponse(payload []byte) *PGError + func (e *PGError) Error() string + type PreparedStmt struct + Columns []ColumnDesc + Name string + ParamOIDs []uint32 + Query string + type Reader struct + func NewReader() *Reader + func (r *Reader) Buffered() int + func (r *Reader) Compact() + func (r *Reader) Feed(data []byte) + func (r *Reader) Next() (byte, []byte, error) + func (r *Reader) Reset() + type SimpleQueryState struct + Columns []ColumnDesc + Err *PGError + Tag string + func (q *SimpleQueryState) Handle(msgType byte, payload []byte, onRowDesc func([]ColumnDesc), ...) (bool, error) + func (q *SimpleQueryState) Reset() + func (q *SimpleQueryState) TagBytes() []byte + type StartupState struct + Database string + PID int32 + Params map[string]string + Password string + Secret int32 + ServerParams map[string]string + User string + func (s *StartupState) Handle(msgType byte, payload []byte, w *Writer) (response []byte, done bool, err error) + func (s *StartupState) Start(w *Writer) []byte + type TypeCodec struct + DecodeBinary func(src []byte) (driver.Value, error) + DecodeText func(src []byte) (driver.Value, error) + EncodeBinary func(dst []byte, v any) ([]byte, error) + EncodeText func(dst []byte, v any) ([]byte, error) + Name string + OID uint32 + ScanType reflect.Type + func LookupOID(oid uint32) *TypeCodec + type Writer struct + func NewWriter() *Writer + func (w *Writer) Bytes() []byte + func (w *Writer) FinishMessage() + func (w *Writer) Len() int + func (w *Writer) Reset() + func (w *Writer) StartMessage(msgType byte) + func (w *Writer) StartStartupMessage() + func (w *Writer) WriteByte(b byte) error + func (w *Writer) WriteBytes(b []byte) + func (w *Writer) WriteInt16(v int16) + func (w *Writer) WriteInt32(v int32) + func (w *Writer) WriteString(s string)