Documentation
¶
Index ¶
- Constants
- Variables
- type AppendEntriesRequest
- type AppendEntriesResponse
- type Authentication
- type Backend
- type BackendKeyData
- type BackendMessage
- type BackendMessages
- type BigEndianBuf
- type Bind
- type BindComplete
- type Close
- type CloseComplete
- type CommandComplete
- type CommandRequest
- type CopyBothResponse
- type CopyData
- type CopyInResponse
- type CopyOutResponse
- type DataRow
- type Describe
- type DiscoveryRequest
- type DiscoveryResponse
- type EmptyQueryResponse
- type ErrorResponse
- type Execute
- type FieldDescription
- type Flush
- type Frontend
- type FrontendMessage
- type FunctionCallResponse
- type InitialMessage
- type InstallSnapshotRequest
- type InstallSnapshotResponse
- type JoinRequest
- type KeyValue
- type Message
- type NoData
- type NoticeResponse
- type NotificationResponse
- type ParameterDescription
- type ParameterStatus
- type Parse
- type ParseComplete
- type PasswordMessage
- type Query
- type RaftMessage
- type RaftStartupMessage
- type RaftWire
- type ReadyForQuery
- type RequestVoteRequest
- type RequestVoteResponse
- type RowDescription
- type RpcBackend
- type RpcCommandType
- type RpcFrontendMessage
- type RpcStartupMessage
- type Sequence
- type SequenceChunkResponse
- type SequenceRequest
- type StartupMessage
- type Sync
- type Terminate
- type TransactionStatus
Constants ¶
View Source
const (
AuthTypeOk = 0
AuthTypeCleartextPassword = 3
AuthTypeMD5Password = 5
)
View Source
const (
// PgAuthentication is just a general authentication byte prefix.
PgAuthentication = 'R'
PgAuthenticationOk = 'R'
PgAuthenticationKerberosV5 = 'R'
PgAuthenticationCleartextPassword = 'R'
PgAuthenticationMD5Password = 'R'
PgAuthenticationSCMCredential = 'R'
PgAuthenticationGSS = 'R'
PgAuthenticationSSPI = 'R'
PgAuthenticationGSSContinue = 'R'
PgAuthenticationSASL = 'R'
PgAuthenticationSASLContinue = 'R'
PgAuthenticationSASLFinal = 'R'
PgBackendKeyData = 'K'
PgBindComplete = '2'
PgCloseComplete = '3'
PgCommandComplete = 'C'
PgCopyInResponse = 'G'
PgCopyOutResponse = 'H'
PgCopyBothResponse = 'W'
PgDataRow = 'D'
PgEmptyQueryResponse = 'I'
PgErrorResponse = 'E'
PgFunctionCallResponse = 'B'
PgNegotiateProtocolVersion = 'v'
PgNoData = 'n'
PgNoticeResponse = 'N'
PgNotificationResponse = 'A'
PgParameterDescription = 't'
PgParameterStatus = 'S'
PgParseComplete = '1'
PgPortialSuspended = 's'
PgReadyForQuery = 'Z'
PgRowDescription = 'T'
// PgBind is the byte prefix for bind messages from the client.
PgBind = 'B'
PgClose = 'C'
PgCopyFail = 'f'
PgDescribe = 'D'
PgExecute = 'E'
PgFlush = 'H'
PgFunctionCall = 'F'
PgGSSResponse = 'p'
PgParse = 'P'
PgPasswordMessage = 'p'
PgQuery = 'Q'
PgSASLInitialResponse = 'p'
PgSASLResponse = 'p'
PgSync = 'S'
PgTerminate = 'X'
// RaftAppendEntriesRequest is the byte prefix for append entries from the leader.
RaftAppendEntriesRequest = 'a'
RaftRequestVoteRequest = 'v'
RaftInstallSnapshotRequest = 'i'
// RaftRPCResponse is a generic tag
RaftRPCResponse = 'r'
RaftAppendEntriesResponse = 'Y'
RaftRequestVoteResponse = 'V'
RaftInstallSnapshotResponse = 'M'
// RpcSequenceResponse indicates sequence metadata.
RpcSequenceRequest = '*'
RpcSequenceResponse = '`'
RpcJoinRequest = 'j'
RpcDiscoveryRequest = 'm'
RpcCommandRequest = '$'
RpcCommandResponse = '~'
// Both
PgCopyData = 'd'
PgCopyDone = 'c'
)
View Source
const (
TextFormat = 0
BinaryFormat = 1
)
View Source
const (
RaftNumber = 20190109
RpcNumber = 19950202
ProtocolVersionNumber = 196608 // 3.0
)
Variables ¶
View Source
var (
RaftStartupMessageError = errors.New("startup message is raft")
RpcStartupMessageError = errors.New("startup message is rpc")
)
Functions ¶
This section is empty.
Types ¶
type AppendEntriesRequest ¶
type AppendEntriesRequest struct {
raft.AppendEntriesRequest
}
func (*AppendEntriesRequest) Decode ¶
func (appendEntries *AppendEntriesRequest) Decode(src []byte) error
type AppendEntriesResponse ¶
type AppendEntriesResponse struct {
raft.AppendEntriesResponse
Error error
}
func (*AppendEntriesResponse) Decode ¶
func (response *AppendEntriesResponse) Decode(src []byte) error
type Authentication ¶
type Authentication struct {
Type uint32
// MD5Password fields
Salt [4]byte
}
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
func NewBackend ¶
func NewBackend(r io.Reader, w io.Writer) (*Backend, error)
func (*Backend) ReceiveInitialMessage ¶
func (b *Backend) ReceiveInitialMessage() (int, error)
func (*Backend) ReceiveStartupMessage ¶
func (b *Backend) ReceiveStartupMessage() (*StartupMessage, error)
type BackendKeyData ¶
type BackendKeyData struct {
ProcessID uint32
SecretKey uint32
}
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 BackendMessages ¶
type BackendMessages []BackendMessage
type BigEndianBuf ¶
type BigEndianBuf [8]byte
type Bind ¶
type Bind struct {
DestinationPortal string
PreparedStatement string
ParameterFormatCodes []int16
Parameters [][]byte
ResultFormatCodes []pgwirebase.FormatCode
}
func (*Bind) MarshalJSON ¶
func (src *Bind) MarshalJSON() ([]byte, error)
type BindComplete ¶
type BindComplete struct{}
func (*BindComplete) MarshalJSON ¶
func (src *BindComplete) MarshalJSON() ([]byte, error)
type Close ¶
type Close struct {
ObjectType byte // 'S' = prepared statement, 'P' = portal
Name string
}
func (*Close) MarshalJSON ¶
func (src *Close) MarshalJSON() ([]byte, error)
type CloseComplete ¶
type CloseComplete struct{}
func (*CloseComplete) MarshalJSON ¶
func (src *CloseComplete) MarshalJSON() ([]byte, error)
type CommandComplete ¶
type CommandComplete struct {
CommandTag string
}
func (*CommandComplete) MarshalJSON ¶
func (src *CommandComplete) MarshalJSON() ([]byte, error)
type CommandRequest ¶
type CommandRequest struct {
CommandType RpcCommandType
Queries []string
KeyValueSets []KeyValue
KeyValueDeletes [][]byte
}
func (CommandRequest) RpcFrontend ¶
func (CommandRequest) RpcFrontend()
type CopyBothResponse ¶
type CopyBothResponse struct {
OverallFormat byte
ColumnFormatCodes []uint16
}
func (*CopyBothResponse) MarshalJSON ¶
func (src *CopyBothResponse) MarshalJSON() ([]byte, error)
type CopyData ¶
type CopyData struct {
Data []byte
}
func (*CopyData) MarshalJSON ¶
func (src *CopyData) MarshalJSON() ([]byte, error)
type CopyInResponse ¶
type CopyInResponse struct {
OverallFormat byte
ColumnFormatCodes []uint16
}
func (*CopyInResponse) MarshalJSON ¶
func (src *CopyInResponse) MarshalJSON() ([]byte, error)
type CopyOutResponse ¶
type CopyOutResponse struct {
OverallFormat byte
ColumnFormatCodes []uint16
}
func (*CopyOutResponse) MarshalJSON ¶
func (src *CopyOutResponse) MarshalJSON() ([]byte, error)
type DataRow ¶
type DataRow struct {
Values [][]byte
}
func (*DataRow) MarshalJSON ¶
func (src *DataRow) MarshalJSON() ([]byte, error)
type Describe ¶
type Describe struct {
ObjectType byte // 'S' = prepared statement, 'P' = portal
Name string
}
func (*Describe) MarshalJSON ¶
func (src *Describe) MarshalJSON() ([]byte, error)
type DiscoveryRequest ¶
type DiscoveryRequest struct{}
func (DiscoveryRequest) RpcFrontend ¶
func (DiscoveryRequest) RpcFrontend()
type DiscoveryResponse ¶
type DiscoveryResponse struct {
LeaderAddr string
}
func (DiscoveryResponse) RpcBackend ¶
func (DiscoveryResponse) RpcBackend()
type EmptyQueryResponse ¶
type EmptyQueryResponse struct{}
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
}
type Execute ¶
type Execute struct {
Portal string
MaxRows uint32
}
func (*Execute) MarshalJSON ¶
func (src *Execute) MarshalJSON() ([]byte, error)
type FieldDescription ¶
type FieldDescription struct {
Name string
TableOID uint32
TableAttributeNumber uint16
DataTypeOID uint32
DataTypeSize int16
TypeModifier uint32
Format int16
}
type Flush ¶
type Flush struct{}
func (*Flush) MarshalJSON ¶
func (src *Flush) MarshalJSON() ([]byte, error)
type Frontend ¶
type Frontend struct {
// contains filtered or unexported fields
}
func NewFrontend ¶
func NewFrontend(r io.Reader, w io.Writer) (*Frontend, 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) MarshalJSON ¶
func (src *FunctionCallResponse) MarshalJSON() ([]byte, error)
type InitialMessage ¶
type InitialMessage interface {
Message
Initial()
}
type InstallSnapshotRequest ¶
type InstallSnapshotRequest struct {
raft.InstallSnapshotRequest
SnapshotData []byte
}
func (*InstallSnapshotRequest) Decode ¶
func (installSnapshot *InstallSnapshotRequest) Decode(src []byte) error
type InstallSnapshotResponse ¶
type InstallSnapshotResponse struct {
raft.InstallSnapshotResponse
Error error
}
func (*InstallSnapshotResponse) Decode ¶
func (response *InstallSnapshotResponse) Decode(src []byte) error
type JoinRequest ¶
type JoinRequest struct {
NodeID string
Address string
}
func (JoinRequest) RpcFrontend ¶
func (JoinRequest) RpcFrontend()
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 NoData ¶
type NoData struct{}
func (*NoData) MarshalJSON ¶
func (src *NoData) MarshalJSON() ([]byte, error)
type NoticeResponse ¶
type NoticeResponse ErrorResponse
type NotificationResponse ¶
type NotificationResponse struct {
PID uint32
Channel string
Payload string
}
func (*NotificationResponse) MarshalJSON ¶
func (src *NotificationResponse) MarshalJSON() ([]byte, error)
type ParameterDescription ¶
type ParameterDescription struct {
ParameterOIDs []uint32
}
func (*ParameterDescription) MarshalJSON ¶
func (src *ParameterDescription) MarshalJSON() ([]byte, error)
type ParameterStatus ¶
type ParameterStatus struct {
Name string
Value string
}
func (*ParameterStatus) MarshalJSON ¶
func (ps *ParameterStatus) MarshalJSON() ([]byte, error)
type Parse ¶
type Parse struct {
Name string
Query string
ParameterOIDs []uint32
}
func (*Parse) MarshalJSON ¶
func (src *Parse) MarshalJSON() ([]byte, error)
type ParseComplete ¶
type ParseComplete struct{}
func (*ParseComplete) MarshalJSON ¶
func (src *ParseComplete) MarshalJSON() ([]byte, error)
type PasswordMessage ¶
type PasswordMessage struct {
Password string
}
func (*PasswordMessage) MarshalJSON ¶
func (src *PasswordMessage) MarshalJSON() ([]byte, error)
type Query ¶
type Query struct {
String string
}
func (*Query) MarshalJSON ¶
func (src *Query) MarshalJSON() ([]byte, error)
type RaftMessage ¶
type RaftMessage interface {
Message
Raft() // no-op method to distinguish raft frontend from backend methods
}
type RaftStartupMessage ¶
type RaftStartupMessage struct {
}
func (RaftStartupMessage) RaftFrontend ¶
func (RaftStartupMessage) RaftFrontend()
type RaftWire ¶
type RaftWire struct {
// contains filtered or unexported fields
}
func NewRaftWire ¶
func NewRaftWire(r io.Reader, w io.Writer) (*RaftWire, error)
type ReadyForQuery ¶
type ReadyForQuery struct {
TxStatus byte
}
func (*ReadyForQuery) MarshalJSON ¶
func (src *ReadyForQuery) MarshalJSON() ([]byte, error)
type RequestVoteRequest ¶
type RequestVoteRequest struct {
raft.RequestVoteRequest
}
type RequestVoteResponse ¶
type RequestVoteResponse struct {
raft.RequestVoteResponse
Error error
}
type RowDescription ¶
type RowDescription struct {
Fields []FieldDescription
}
func (*RowDescription) MarshalJSON ¶
func (src *RowDescription) MarshalJSON() ([]byte, error)
type RpcBackend ¶
type RpcBackend struct {
// contains filtered or unexported fields
}
func NewRpcBackend ¶
func NewRpcBackend(r io.Reader, w io.Writer) (*RpcBackend, error)
type RpcCommandType ¶
type RpcCommandType int
const (
RpcCommandType_Execute RpcCommandType = iota
RpcCommandType_Query
RpcCommandType_MetadataSet
RpcCommandType_MetadataDelete
RpcCommandType_Connect
RpcCommandType_Disconnect
RpcCommandType_KeyValueSet
RpcCommandType_KeyValueDelete
)
type RpcFrontendMessage ¶
type RpcFrontendMessage interface {
Message
Frontend() // no-op method to distinguish frontend from backend methods
RpcFrontend() // no-op method to distinguish raft frontend from backend methods
}
type RpcStartupMessage ¶
type RpcStartupMessage struct {
}
type Sequence ¶
type Sequence struct {
CurrentValue uint64
LastPartitionIndex uint64
MaxPartitionIndex uint64
Partitions uint64
}
func (*Sequence) EncodeBody ¶
func (item *Sequence) EncodeBody() []byte
type SequenceChunkResponse ¶
type SequenceChunkResponse struct {
Start uint64
End uint64
Offset uint64
Count uint64
}
func (*SequenceChunkResponse) EncodeBody ¶
func (item *SequenceChunkResponse) EncodeBody() []byte
type SequenceRequest ¶
type SequenceRequest struct {
SequenceName string
}
func (*SequenceRequest) EncodeBody ¶
func (item *SequenceRequest) EncodeBody() []byte
func (SequenceRequest) RpcFrontend ¶
func (SequenceRequest) RpcFrontend()
type StartupMessage ¶
type StartupMessage struct {
ProtocolVersion uint32
Parameters map[string]string
}
func (*StartupMessage) MarshalJSON ¶
func (src *StartupMessage) MarshalJSON() ([]byte, error)
type Sync ¶
type Sync struct{}
func (*Sync) MarshalJSON ¶
func (src *Sync) MarshalJSON() ([]byte, error)
type Terminate ¶
type Terminate struct{}
func (*Terminate) MarshalJSON ¶
func (src *Terminate) MarshalJSON() ([]byte, error)
func (*Terminate) RpcFrontend ¶
func (*Terminate) RpcFrontend()
type TransactionStatus ¶
type TransactionStatus byte
const (
// TransactionStatus_Idle means the session is outside of a transaction.
TransactionStatus_Idle TransactionStatus = 'I'
// TransactionStatus_In means the session is inside a transaction.
TransactionStatus_In TransactionStatus = 'T'
// TransactionStatus_InFailed means the session is inside a transaction, but the
// transaction is in the Aborted state.
TransactionStatus_InFailed TransactionStatus = 'E'
)
Source Files
¶
- append_entries_request.go
- append_entries_response.go
- authentication.go
- backend.go
- backend_key_data.go
- big_endian.go
- bind.go
- bind_complete.go
- close.go
- close_complete.go
- command_complete.go
- command_request.go
- copy_both_response.go
- copy_data.go
- copy_in_response.go
- copy_out_response.go
- data_row.go
- describe.go
- discovery_request.go
- discovery_response.go
- empty_query_response.go
- error_response.go
- execute.go
- flush.go
- frontend.go
- function_call_response.go
- install_snapshot_request.go
- install_snapshot_response.go
- join_request.go
- messages.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
- raft_backend.go
- raft_startup_message.go
- ready_for_query.go
- request_vote_request.go
- request_vote_response.go
- row_description.go
- rpc_backend.go
- rpc_startup_message.go
- sequence_request.go
- sequence_response.go
- startup_message.go
- sync.go
- terminate.go
- transaction_status.go
Click to show internal directories.
Click to hide internal directories.