pgproto3
v3.6.2+incompatible
github.com/JAckc/pgx/pgproto3
Documentation
pkg.go.dev ↗Constants
AuthTypeOk (6 declarations)
const ( AuthTypeOk = 0 AuthTypeCleartextPassword = 3 AuthTypeMD5Password = 5 AuthTypeSASL = 10 AuthTypeSASLContinue = 11 AuthTypeSASLFinal = 12 )
TextFormat (2 declarations)
const ( TextFormat = 0 BinaryFormat = 1 )
ProtocolVersionNumber
const ( ProtocolVersionNumber = 196608 // 3.0 )
Types
Authentication
type Authentication struct {
Type uint32
// MD5Password fields
Salt [4]byte
// SASL fields
SASLAuthMechanisms []string
// SASLContinue and SASLFinal data
SASLData []byte
}
Authentication.Backend
func (*Authentication) Backend()
Authentication.Decode
func (dst *Authentication) Decode(src []byte) error
Authentication.Encode
func (src *Authentication) Encode(dst []byte) []byte
Backend
type Backend struct {
// contains filtered or unexported fields
}
NewBackend
func NewBackend(r io.Reader, w io.Writer) (*Backend, error)
Backend.Receive
func (b *Backend) Receive() (FrontendMessage, error)
Backend.ReceiveStartupMessage
func (b *Backend) ReceiveStartupMessage() (*StartupMessage, error)
Backend.Send
func (b *Backend) Send(msg BackendMessage) error
BackendKeyData
type BackendKeyData struct {
ProcessID uint32
SecretKey uint32
}
BackendKeyData.Backend
func (*BackendKeyData) Backend()
BackendKeyData.Decode
func (dst *BackendKeyData) Decode(src []byte) error
BackendKeyData.Encode
func (src *BackendKeyData) Encode(dst []byte) []byte
BackendKeyData.MarshalJSON
func (src *BackendKeyData) MarshalJSON() ([]byte, error)
BackendMessage
type BackendMessage interface {
Message
Backend() // no-op method to distinguish frontend from backend methods
}
BigEndianBuf
type BigEndianBuf [8]byte
BigEndianBuf.Int16
func (b BigEndianBuf) Int16(n int16) []byte
BigEndianBuf.Int32
func (b BigEndianBuf) Int32(n int32) []byte
BigEndianBuf.Int64
func (b BigEndianBuf) Int64(n int64) []byte
BigEndianBuf.Uint16
func (b BigEndianBuf) Uint16(n uint16) []byte
BigEndianBuf.Uint32
func (b BigEndianBuf) Uint32(n uint32) []byte
Bind
type Bind struct {
DestinationPortal string
PreparedStatement string
ParameterFormatCodes []int16
Parameters [][]byte
ResultFormatCodes []int16
}
Bind.Decode
func (dst *Bind) Decode(src []byte) error
Bind.Encode
func (src *Bind) Encode(dst []byte) []byte
Bind.Frontend
func (*Bind) Frontend()
Bind.MarshalJSON
func (src *Bind) MarshalJSON() ([]byte, error)
BindComplete
type BindComplete struct{}
BindComplete.Backend
func (*BindComplete) Backend()
BindComplete.Decode
func (dst *BindComplete) Decode(src []byte) error
BindComplete.Encode
func (src *BindComplete) Encode(dst []byte) []byte
BindComplete.MarshalJSON
func (src *BindComplete) MarshalJSON() ([]byte, error)
Close
type Close struct {
ObjectType byte // 'S' = prepared statement, 'P' = portal
Name string
}
Close.Decode
func (dst *Close) Decode(src []byte) error
Close.Encode
func (src *Close) Encode(dst []byte) []byte
Close.Frontend
func (*Close) Frontend()
Close.MarshalJSON
func (src *Close) MarshalJSON() ([]byte, error)
CloseComplete
type CloseComplete struct{}
CloseComplete.Backend
func (*CloseComplete) Backend()
CloseComplete.Decode
func (dst *CloseComplete) Decode(src []byte) error
CloseComplete.Encode
func (src *CloseComplete) Encode(dst []byte) []byte
CloseComplete.MarshalJSON
func (src *CloseComplete) MarshalJSON() ([]byte, error)
CommandComplete
type CommandComplete struct {
CommandTag string
}
CommandComplete.Backend
func (*CommandComplete) Backend()
CommandComplete.Decode
func (dst *CommandComplete) Decode(src []byte) error
CommandComplete.Encode
func (src *CommandComplete) Encode(dst []byte) []byte
CommandComplete.MarshalJSON
func (src *CommandComplete) MarshalJSON() ([]byte, error)
CopyBothResponse
type CopyBothResponse struct {
OverallFormat byte
ColumnFormatCodes []uint16
}
CopyBothResponse.Backend
func (*CopyBothResponse) Backend()
CopyBothResponse.Decode
func (dst *CopyBothResponse) Decode(src []byte) error
CopyBothResponse.Encode
func (src *CopyBothResponse) Encode(dst []byte) []byte
CopyBothResponse.MarshalJSON
func (src *CopyBothResponse) MarshalJSON() ([]byte, error)
CopyData
type CopyData struct {
Data []byte
}
CopyData.Backend
func (*CopyData) Backend()
CopyData.Decode
func (dst *CopyData) Decode(src []byte) error
CopyData.Encode
func (src *CopyData) Encode(dst []byte) []byte
CopyData.Frontend
func (*CopyData) Frontend()
CopyData.MarshalJSON
func (src *CopyData) MarshalJSON() ([]byte, error)
CopyDone
type CopyDone struct {
}
CopyDone.Backend
func (*CopyDone) Backend()
CopyDone.Decode
func (dst *CopyDone) Decode(src []byte) error
CopyDone.Encode
func (src *CopyDone) Encode(dst []byte) []byte
CopyDone.MarshalJSON
func (src *CopyDone) MarshalJSON() ([]byte, error)
CopyFail
type CopyFail struct {
Message string
}
CopyFail.Backend
func (*CopyFail) Backend()
CopyFail.Decode
func (dst *CopyFail) Decode(src []byte) error
CopyFail.Encode
func (src *CopyFail) Encode(dst []byte) []byte
CopyFail.MarshalJSON
func (src *CopyFail) MarshalJSON() ([]byte, error)
CopyInResponse
type CopyInResponse struct {
OverallFormat byte
ColumnFormatCodes []uint16
}
CopyInResponse.Backend
func (*CopyInResponse) Backend()
CopyInResponse.Decode
func (dst *CopyInResponse) Decode(src []byte) error
CopyInResponse.Encode
func (src *CopyInResponse) Encode(dst []byte) []byte
CopyInResponse.MarshalJSON
func (src *CopyInResponse) MarshalJSON() ([]byte, error)
CopyOutResponse
type CopyOutResponse struct {
OverallFormat byte
ColumnFormatCodes []uint16
}
CopyOutResponse.Backend
func (*CopyOutResponse) Backend()
CopyOutResponse.Decode
func (dst *CopyOutResponse) Decode(src []byte) error
CopyOutResponse.Encode
func (src *CopyOutResponse) Encode(dst []byte) []byte
CopyOutResponse.MarshalJSON
func (src *CopyOutResponse) MarshalJSON() ([]byte, error)
DataRow
type DataRow struct {
Values [][]byte
}
DataRow.Backend
func (*DataRow) Backend()
DataRow.Decode
func (dst *DataRow) Decode(src []byte) error
DataRow.Encode
func (src *DataRow) Encode(dst []byte) []byte
DataRow.MarshalJSON
func (src *DataRow) MarshalJSON() ([]byte, error)
Describe
type Describe struct {
ObjectType byte // 'S' = prepared statement, 'P' = portal
Name string
}
Describe.Decode
func (dst *Describe) Decode(src []byte) error
Describe.Encode
func (src *Describe) Encode(dst []byte) []byte
Describe.Frontend
func (*Describe) Frontend()
Describe.MarshalJSON
func (src *Describe) MarshalJSON() ([]byte, error)
EmptyQueryResponse
type EmptyQueryResponse struct{}
EmptyQueryResponse.Backend
func (*EmptyQueryResponse) Backend()
EmptyQueryResponse.Decode
func (dst *EmptyQueryResponse) Decode(src []byte) error
EmptyQueryResponse.Encode
func (src *EmptyQueryResponse) Encode(dst []byte) []byte
EmptyQueryResponse.MarshalJSON
func (src *EmptyQueryResponse) MarshalJSON() ([]byte, error)
ErrorResponse
type ErrorResponse struct {
Severity string
Code string
Message string
Detail string
Hint string
Position int32
InternalPosition int32
InternalQuery string
Where string
SchemaName string
TableName string
ColumnName string
DataTypeName string
ConstraintName string
File string
Line int32
Routine string
UnknownFields map[byte]string
}
ErrorResponse.Backend
func (*ErrorResponse) Backend()
ErrorResponse.Decode
func (dst *ErrorResponse) Decode(src []byte) error
ErrorResponse.Encode
func (src *ErrorResponse) Encode(dst []byte) []byte
Execute
type Execute struct {
Portal string
MaxRows uint32
}
Execute.Decode
func (dst *Execute) Decode(src []byte) error
Execute.Encode
func (src *Execute) Encode(dst []byte) []byte
Execute.Frontend
func (*Execute) Frontend()
Execute.MarshalJSON
func (src *Execute) MarshalJSON() ([]byte, error)
FieldDescription
type FieldDescription struct {
Name string
TableOID uint32
TableAttributeNumber uint16
DataTypeOID uint32
DataTypeSize int16
TypeModifier int32
Format int16
}
Flush
type Flush struct{}
Flush.Decode
func (dst *Flush) Decode(src []byte) error
Flush.Encode
func (src *Flush) Encode(dst []byte) []byte
Flush.Frontend
func (*Flush) Frontend()
Flush.MarshalJSON
func (src *Flush) MarshalJSON() ([]byte, error)
Frontend
type Frontend struct {
// contains filtered or unexported fields
}
NewFrontend
func NewFrontend(r io.Reader, w io.Writer) (*Frontend, error)
Frontend.Receive
func (b *Frontend) Receive() (BackendMessage, error)
Frontend.Send
func (b *Frontend) Send(msg FrontendMessage) error
FrontendMessage
type FrontendMessage interface {
Message
Frontend() // no-op method to distinguish frontend from backend methods
}
FunctionCallResponse
type FunctionCallResponse struct {
Result []byte
}
FunctionCallResponse.Backend
func (*FunctionCallResponse) Backend()
FunctionCallResponse.Decode
func (dst *FunctionCallResponse) Decode(src []byte) error
FunctionCallResponse.Encode
func (src *FunctionCallResponse) Encode(dst []byte) []byte
FunctionCallResponse.MarshalJSON
func (src *FunctionCallResponse) MarshalJSON() ([]byte, error)
Message
type Message interface {
// Decode is allowed and expected to retain a reference to data after
// returning (unlike encoding.BinaryUnmarshaler).
Decode(data []byte) error
// Encode appends itself to dst and returns the new buffer.
Encode(dst []byte) []byte
}
Message is the interface implemented by an object that can decode and encode a particular PostgreSQL message.
NoData
type NoData struct{}
NoData.Backend
func (*NoData) Backend()
NoData.Decode
func (dst *NoData) Decode(src []byte) error
NoData.Encode
func (src *NoData) Encode(dst []byte) []byte
NoData.MarshalJSON
func (src *NoData) MarshalJSON() ([]byte, error)
NoticeResponse
type NoticeResponse ErrorResponse
NoticeResponse.Backend
func (*NoticeResponse) Backend()
NoticeResponse.Decode
func (dst *NoticeResponse) Decode(src []byte) error
NoticeResponse.Encode
func (src *NoticeResponse) Encode(dst []byte) []byte
NotificationResponse
type NotificationResponse struct {
PID uint32
Channel string
Payload string
}
NotificationResponse.Backend
func (*NotificationResponse) Backend()
NotificationResponse.Decode
func (dst *NotificationResponse) Decode(src []byte) error
NotificationResponse.Encode
func (src *NotificationResponse) Encode(dst []byte) []byte
NotificationResponse.MarshalJSON
func (src *NotificationResponse) MarshalJSON() ([]byte, error)
ParameterDescription
type ParameterDescription struct {
ParameterOIDs []uint32
}
ParameterDescription.Backend
func (*ParameterDescription) Backend()
ParameterDescription.Decode
func (dst *ParameterDescription) Decode(src []byte) error
ParameterDescription.Encode
func (src *ParameterDescription) Encode(dst []byte) []byte
ParameterDescription.MarshalJSON
func (src *ParameterDescription) MarshalJSON() ([]byte, error)
ParameterStatus
type ParameterStatus struct {
Name string
Value string
}
ParameterStatus.Backend
func (*ParameterStatus) Backend()
ParameterStatus.Decode
func (dst *ParameterStatus) Decode(src []byte) error
ParameterStatus.Encode
func (src *ParameterStatus) Encode(dst []byte) []byte
ParameterStatus.MarshalJSON
func (ps *ParameterStatus) MarshalJSON() ([]byte, error)
Parse
type Parse struct {
Name string
Query string
ParameterOIDs []uint32
}
Parse.Decode
func (dst *Parse) Decode(src []byte) error
Parse.Encode
func (src *Parse) Encode(dst []byte) []byte
Parse.Frontend
func (*Parse) Frontend()
Parse.MarshalJSON
func (src *Parse) MarshalJSON() ([]byte, error)
ParseComplete
type ParseComplete struct{}
ParseComplete.Backend
func (*ParseComplete) Backend()
ParseComplete.Decode
func (dst *ParseComplete) Decode(src []byte) error
ParseComplete.Encode
func (src *ParseComplete) Encode(dst []byte) []byte
ParseComplete.MarshalJSON
func (src *ParseComplete) MarshalJSON() ([]byte, error)
PasswordMessage
type PasswordMessage struct {
Password string
}
PasswordMessage.Decode
func (dst *PasswordMessage) Decode(src []byte) error
PasswordMessage.Encode
func (src *PasswordMessage) Encode(dst []byte) []byte
PasswordMessage.Frontend
func (*PasswordMessage) Frontend()
PasswordMessage.MarshalJSON
func (src *PasswordMessage) MarshalJSON() ([]byte, error)
PortalSuspended
type PortalSuspended struct{}
PortalSuspended.Backend
func (*PortalSuspended) Backend()
PortalSuspended.Decode
func (dst *PortalSuspended) Decode(src []byte) error
PortalSuspended.Encode
func (src *PortalSuspended) Encode(dst []byte) []byte
PortalSuspended.MarshalJSON
func (src *PortalSuspended) MarshalJSON() ([]byte, error)
Query
type Query struct {
String string
}
Query.Decode
func (dst *Query) Decode(src []byte) error
Query.Encode
func (src *Query) Encode(dst []byte) []byte
Query.Frontend
func (*Query) Frontend()
Query.MarshalJSON
func (src *Query) MarshalJSON() ([]byte, error)
ReadyForQuery
type ReadyForQuery struct {
TxStatus byte
}
ReadyForQuery.Backend
func (*ReadyForQuery) Backend()
ReadyForQuery.Decode
func (dst *ReadyForQuery) Decode(src []byte) error
ReadyForQuery.Encode
func (src *ReadyForQuery) Encode(dst []byte) []byte
ReadyForQuery.MarshalJSON
func (src *ReadyForQuery) MarshalJSON() ([]byte, error)
RowDescription
type RowDescription struct {
Fields []FieldDescription
}
RowDescription.Backend
func (*RowDescription) Backend()
RowDescription.Decode
func (dst *RowDescription) Decode(src []byte) error
RowDescription.Encode
func (src *RowDescription) Encode(dst []byte) []byte
RowDescription.MarshalJSON
func (src *RowDescription) MarshalJSON() ([]byte, error)
SASLInitialResponse
type SASLInitialResponse struct {
AuthMechanism string
Data []byte
}
SASLInitialResponse.Decode
func (dst *SASLInitialResponse) Decode(src []byte) error
SASLInitialResponse.Encode
func (src *SASLInitialResponse) Encode(dst []byte) []byte
SASLInitialResponse.Frontend
func (*SASLInitialResponse) Frontend()
SASLInitialResponse.MarshalJSON
func (src *SASLInitialResponse) MarshalJSON() ([]byte, error)
SASLResponse
type SASLResponse struct {
Data []byte
}
SASLResponse.Decode
func (dst *SASLResponse) Decode(src []byte) error
SASLResponse.Encode
func (src *SASLResponse) Encode(dst []byte) []byte
SASLResponse.Frontend
func (*SASLResponse) Frontend()
SASLResponse.MarshalJSON
func (src *SASLResponse) MarshalJSON() ([]byte, error)
StartupMessage
type StartupMessage struct {
ProtocolVersion uint32
Parameters map[string]string
}
StartupMessage.Decode
func (dst *StartupMessage) Decode(src []byte) error
StartupMessage.Encode
func (src *StartupMessage) Encode(dst []byte) []byte
StartupMessage.Frontend
func (*StartupMessage) Frontend()
StartupMessage.MarshalJSON
func (src *StartupMessage) MarshalJSON() ([]byte, error)
Sync
type Sync struct{}
Sync.Decode
func (dst *Sync) Decode(src []byte) error
Sync.Encode
func (src *Sync) Encode(dst []byte) []byte
Sync.Frontend
func (*Sync) Frontend()
Sync.MarshalJSON
func (src *Sync) MarshalJSON() ([]byte, error)
Terminate
type Terminate struct{}
Terminate.Decode
func (dst *Terminate) Decode(src []byte) error
Terminate.Encode
func (src *Terminate) Encode(dst []byte) []byte
Terminate.Frontend
func (*Terminate) Frontend()
Terminate.MarshalJSON
func (src *Terminate) MarshalJSON() ([]byte, error)