Documentation ¶
Index ¶
- Constants
- type Authentication
- type Backend
- type BackendKeyData
- type BackendMessage
- type BigEndianBuf
- type Bind
- type BindComplete
- type Close
- type CloseComplete
- type CommandComplete
- type CopyBothResponse
- type CopyData
- type CopyInResponse
- type CopyOutResponse
- type DataRow
- type Describe
- type EmptyQueryResponse
- type ErrorResponse
- type Execute
- type FieldDescription
- type Flush
- type Frontend
- type FrontendMessage
- type FunctionCallResponse
- type Message
- type NoData
- type NoticeResponse
- type NotificationResponse
- type ParameterDescription
- type ParameterStatus
- type Parse
- type ParseComplete
- type PasswordMessage
- type Query
- type ReadyForQuery
- type ReceivedMessages
- func (r *ReceivedMessages) Backward()
- func (r *ReceivedMessages) Forward()
- func (r *ReceivedMessages) Kth(k int) (BackendMessage, []byte)
- func (r ReceivedMessages) Len() int
- func (r *ReceivedMessages) Read() (BackendMessage, []byte, error)
- func (r ReceivedMessages) Readable() int
- func (r *ReceivedMessages) SetCapacity(capacity int)
- func (r *ReceivedMessages) Write(msg BackendMessage, msgBody []byte) error
- func (r ReceivedMessages) WriteCapacity() int
- type RowDescription
- type StartupMessage
- type Sync
- type Terminate
Constants ¶
const ( AuthTypeOk = 0 AuthTypeCleartextPassword = 3 AuthTypeMD5Password = 5 )
const ( TextFormat = 0 BinaryFormat = 1 )
const (
ProtocolVersionNumber = 196608 // 3.0
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authentication ¶
func (*Authentication) Backend ¶
func (*Authentication) Backend()
func (*Authentication) Decode ¶
func (dst *Authentication) Decode(src []byte) error
func (*Authentication) Encode ¶
func (src *Authentication) Encode(dst []byte) []byte
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
func (*Backend) Receive ¶
func (b *Backend) Receive() (FrontendMessage, error)
func (*Backend) ReceiveStartupMessage ¶
func (b *Backend) ReceiveStartupMessage() (*StartupMessage, error)
func (*Backend) Send ¶
func (b *Backend) Send(msg BackendMessage) error
type BackendKeyData ¶
func (*BackendKeyData) Backend ¶
func (*BackendKeyData) Backend()
func (*BackendKeyData) Decode ¶
func (dst *BackendKeyData) Decode(src []byte) error
func (*BackendKeyData) Encode ¶
func (src *BackendKeyData) Encode(dst []byte) []byte
func (*BackendKeyData) MarshalJSON ¶
func (src *BackendKeyData) MarshalJSON() ([]byte, error)
type BackendMessage ¶
type BackendMessage interface { Message Backend() // no-op method to distinguish frontend from backend methods }
type BigEndianBuf ¶
type BigEndianBuf [8]byte
func (BigEndianBuf) Int16 ¶
func (b BigEndianBuf) Int16(n int16) []byte
func (BigEndianBuf) Int32 ¶
func (b BigEndianBuf) Int32(n int32) []byte
func (BigEndianBuf) Int64 ¶
func (b BigEndianBuf) Int64(n int64) []byte
func (BigEndianBuf) Uint16 ¶
func (b BigEndianBuf) Uint16(n uint16) []byte
func (BigEndianBuf) Uint32 ¶
func (b BigEndianBuf) Uint32(n uint32) []byte
type Bind ¶
type Bind struct { DestinationPortal string PreparedStatement string ParameterFormatCodes []int16 Parameters [][]byte ResultFormatCodes []int16 }
func (*Bind) MarshalJSON ¶
type BindComplete ¶
type BindComplete struct{}
func (*BindComplete) Backend ¶
func (*BindComplete) Backend()
func (*BindComplete) Decode ¶
func (dst *BindComplete) Decode(src []byte) error
func (*BindComplete) Encode ¶
func (src *BindComplete) Encode(dst []byte) []byte
func (*BindComplete) MarshalJSON ¶
func (src *BindComplete) MarshalJSON() ([]byte, error)
type Close ¶
func (*Close) MarshalJSON ¶
type CloseComplete ¶
type CloseComplete struct{}
func (*CloseComplete) Backend ¶
func (*CloseComplete) Backend()
func (*CloseComplete) Decode ¶
func (dst *CloseComplete) Decode(src []byte) error
func (*CloseComplete) Encode ¶
func (src *CloseComplete) Encode(dst []byte) []byte
func (*CloseComplete) MarshalJSON ¶
func (src *CloseComplete) MarshalJSON() ([]byte, error)
type CommandComplete ¶
type CommandComplete struct {
CommandTag string
}
func (*CommandComplete) Backend ¶
func (*CommandComplete) Backend()
func (*CommandComplete) Decode ¶
func (dst *CommandComplete) Decode(src []byte) error
func (*CommandComplete) Encode ¶
func (src *CommandComplete) Encode(dst []byte) []byte
func (*CommandComplete) MarshalJSON ¶
func (src *CommandComplete) MarshalJSON() ([]byte, error)
type CopyBothResponse ¶
func (*CopyBothResponse) Backend ¶
func (*CopyBothResponse) Backend()
func (*CopyBothResponse) Decode ¶
func (dst *CopyBothResponse) Decode(src []byte) error
func (*CopyBothResponse) Encode ¶
func (src *CopyBothResponse) Encode(dst []byte) []byte
func (*CopyBothResponse) MarshalJSON ¶
func (src *CopyBothResponse) MarshalJSON() ([]byte, error)
type CopyInResponse ¶
func (*CopyInResponse) Backend ¶
func (*CopyInResponse) Backend()
func (*CopyInResponse) Decode ¶
func (dst *CopyInResponse) Decode(src []byte) error
func (*CopyInResponse) Encode ¶
func (src *CopyInResponse) Encode(dst []byte) []byte
func (*CopyInResponse) MarshalJSON ¶
func (src *CopyInResponse) MarshalJSON() ([]byte, error)
type CopyOutResponse ¶
func (*CopyOutResponse) Backend ¶
func (*CopyOutResponse) Backend()
func (*CopyOutResponse) Decode ¶
func (dst *CopyOutResponse) Decode(src []byte) error
func (*CopyOutResponse) Encode ¶
func (src *CopyOutResponse) Encode(dst []byte) []byte
func (*CopyOutResponse) MarshalJSON ¶
func (src *CopyOutResponse) MarshalJSON() ([]byte, error)
type Describe ¶
func (*Describe) MarshalJSON ¶
type EmptyQueryResponse ¶
type EmptyQueryResponse struct{}
func (*EmptyQueryResponse) Backend ¶
func (*EmptyQueryResponse) Backend()
func (*EmptyQueryResponse) Decode ¶
func (dst *EmptyQueryResponse) Decode(src []byte) error
func (*EmptyQueryResponse) Encode ¶
func (src *EmptyQueryResponse) Encode(dst []byte) []byte
func (*EmptyQueryResponse) MarshalJSON ¶
func (src *EmptyQueryResponse) MarshalJSON() ([]byte, error)
type 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 }
func (*ErrorResponse) Backend ¶
func (*ErrorResponse) Backend()
func (*ErrorResponse) Decode ¶
func (dst *ErrorResponse) Decode(src []byte) error
func (*ErrorResponse) Encode ¶
func (src *ErrorResponse) Encode(dst []byte) []byte
type Execute ¶
func (*Execute) MarshalJSON ¶
type FieldDescription ¶
type Frontend ¶
type Frontend struct {
// contains filtered or unexported fields
}
func (*Frontend) Receive ¶
func (b *Frontend) Receive(rmsgs *ReceivedMessages) error
function to batch receive backend message and write to given ReceivedMessages this will make sure ReceivedMessages have at least 1 BackendMessage
func (*Frontend) Send ¶
func (b *Frontend) Send(msg FrontendMessage) error
type FrontendMessage ¶
type FrontendMessage interface { Message Frontend() // no-op method to distinguish frontend from backend methods }
type FunctionCallResponse ¶
type FunctionCallResponse struct {
Result []byte
}
func (*FunctionCallResponse) Backend ¶
func (*FunctionCallResponse) Backend()
func (*FunctionCallResponse) Decode ¶
func (dst *FunctionCallResponse) Decode(src []byte) error
func (*FunctionCallResponse) Encode ¶
func (src *FunctionCallResponse) Encode(dst []byte) []byte
func (*FunctionCallResponse) MarshalJSON ¶
func (src *FunctionCallResponse) MarshalJSON() ([]byte, error)
type 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.
type NoticeResponse ¶
type NoticeResponse ErrorResponse
func (*NoticeResponse) Backend ¶
func (*NoticeResponse) Backend()
func (*NoticeResponse) Decode ¶
func (dst *NoticeResponse) Decode(src []byte) error
func (*NoticeResponse) Encode ¶
func (src *NoticeResponse) Encode(dst []byte) []byte
type NotificationResponse ¶
func (*NotificationResponse) Backend ¶
func (*NotificationResponse) Backend()
func (*NotificationResponse) Decode ¶
func (dst *NotificationResponse) Decode(src []byte) error
func (*NotificationResponse) Encode ¶
func (src *NotificationResponse) Encode(dst []byte) []byte
func (*NotificationResponse) MarshalJSON ¶
func (src *NotificationResponse) MarshalJSON() ([]byte, error)
type ParameterDescription ¶
type ParameterDescription struct {
ParameterOIDs []uint32
}
func (*ParameterDescription) Backend ¶
func (*ParameterDescription) Backend()
func (*ParameterDescription) Decode ¶
func (dst *ParameterDescription) Decode(src []byte) error
func (*ParameterDescription) Encode ¶
func (src *ParameterDescription) Encode(dst []byte) []byte
func (*ParameterDescription) MarshalJSON ¶
func (src *ParameterDescription) MarshalJSON() ([]byte, error)
type ParameterStatus ¶
func (*ParameterStatus) Backend ¶
func (*ParameterStatus) Backend()
func (*ParameterStatus) Decode ¶
func (dst *ParameterStatus) Decode(src []byte) error
func (*ParameterStatus) Encode ¶
func (src *ParameterStatus) Encode(dst []byte) []byte
func (*ParameterStatus) MarshalJSON ¶
func (ps *ParameterStatus) MarshalJSON() ([]byte, error)
type Parse ¶
func (*Parse) MarshalJSON ¶
type ParseComplete ¶
type ParseComplete struct{}
func (*ParseComplete) Backend ¶
func (*ParseComplete) Backend()
func (*ParseComplete) Decode ¶
func (dst *ParseComplete) Decode(src []byte) error
func (*ParseComplete) Encode ¶
func (src *ParseComplete) Encode(dst []byte) []byte
func (*ParseComplete) MarshalJSON ¶
func (src *ParseComplete) MarshalJSON() ([]byte, error)
type PasswordMessage ¶
type PasswordMessage struct {
Password string
}
func (*PasswordMessage) Decode ¶
func (dst *PasswordMessage) Decode(src []byte) error
func (*PasswordMessage) Encode ¶
func (src *PasswordMessage) Encode(dst []byte) []byte
func (*PasswordMessage) Frontend ¶
func (*PasswordMessage) Frontend()
func (*PasswordMessage) MarshalJSON ¶
func (src *PasswordMessage) MarshalJSON() ([]byte, error)
type ReadyForQuery ¶
type ReadyForQuery struct {
TxStatus byte
}
func (*ReadyForQuery) Backend ¶
func (*ReadyForQuery) Backend()
func (*ReadyForQuery) Decode ¶
func (dst *ReadyForQuery) Decode(src []byte) error
func (*ReadyForQuery) Encode ¶
func (src *ReadyForQuery) Encode(dst []byte) []byte
func (*ReadyForQuery) MarshalJSON ¶
func (src *ReadyForQuery) MarshalJSON() ([]byte, error)
type ReceivedMessages ¶
type ReceivedMessages struct {
// contains filtered or unexported fields
}
ring buffer structure to store non-decoded backend messages and its body
func NewReceivedMessages ¶
func NewReceivedMessages(n int) *ReceivedMessages
func (*ReceivedMessages) Backward ¶
func (r *ReceivedMessages) Backward()
moved 1 read message backward, it will not backward if all messages are not yet read
func (*ReceivedMessages) Forward ¶
func (r *ReceivedMessages) Forward()
skip 1 message which is not yet read, it will not forward if no readable messages
func (*ReceivedMessages) Kth ¶
func (r *ReceivedMessages) Kth(k int) (BackendMessage, []byte)
function to BackendMessage and its body by index (k) the start point is (r.rp + k) % r.Len() this function will not move message read position forward
func (ReceivedMessages) Len ¶
func (r ReceivedMessages) Len() int
return the length of messages array
func (*ReceivedMessages) Read ¶
func (r *ReceivedMessages) Read() (BackendMessage, []byte, error)
function to get BackendMessage and its body
func (ReceivedMessages) Readable ¶
func (r ReceivedMessages) Readable() int
return the count of message that is not yet read
func (*ReceivedMessages) SetCapacity ¶
func (r *ReceivedMessages) SetCapacity(capacity int)
update ReceivedMessages capacity, it will copy existing BackendMessage and message body to new array if they are not yet read
func (*ReceivedMessages) Write ¶
func (r *ReceivedMessages) Write(msg BackendMessage, msgBody []byte) error
function to store BackendMessage and its body this function would not overwrite the messages which are not yet read
func (ReceivedMessages) WriteCapacity ¶
func (r ReceivedMessages) WriteCapacity() int
return the count of space that allow to be written
type RowDescription ¶
type RowDescription struct {
Fields []FieldDescription
}
func (*RowDescription) Backend ¶
func (*RowDescription) Backend()
func (*RowDescription) Decode ¶
func (dst *RowDescription) Decode(src []byte) error
func (*RowDescription) Encode ¶
func (src *RowDescription) Encode(dst []byte) []byte
func (*RowDescription) MarshalJSON ¶
func (src *RowDescription) MarshalJSON() ([]byte, error)
type StartupMessage ¶
func (*StartupMessage) Decode ¶
func (dst *StartupMessage) Decode(src []byte) error
func (*StartupMessage) Encode ¶
func (src *StartupMessage) Encode(dst []byte) []byte
func (*StartupMessage) Frontend ¶
func (*StartupMessage) Frontend()
func (*StartupMessage) MarshalJSON ¶
func (src *StartupMessage) MarshalJSON() ([]byte, error)
Source Files ¶
- authentication.go
- backend.go
- backend_key_data.go
- big_endian.go
- bind.go
- bind_complete.go
- close.go
- close_complete.go
- command_complete.go
- copy_both_response.go
- copy_data.go
- copy_in_response.go
- copy_out_response.go
- data_row.go
- describe.go
- empty_query_response.go
- error_response.go
- execute.go
- flush.go
- frontend.go
- function_call_response.go
- no_data.go
- notice_response.go
- notification_response.go
- parameter_description.go
- parameter_status.go
- parse.go
- parse_complete.go
- password_message.go
- pgproto3.go
- query.go
- ready_for_query.go
- row_description.go
- startup_message.go
- sync.go
- terminate.go