Documentation ¶
Index ¶
- Constants
- type AuthenticationMD5PasswordPgMessage
- type AuthenticationOkPgMessage
- type AuthenticationSASLContinuePgMessage
- type AuthenticationSASLFinalPgMessage
- type AuthenticationSASLPgMessage
- type BackendKeyDataPgMessage
- type CancelRequestPgMessage
- type CommandCompletePgMessage
- type DataRowPgMessage
- type ErrorField
- type ErrorResponsePgMessage
- type FieldDescription
- type NoDataPgMessage
- type ParameterStatusPgMessage
- type PasswordPgMessage
- type PgMessage
- type QueryPgMessage
- type RawPgMessage
- type ReadyForQueryPgMessage
- type RowDescriptionPgMessage
- type SASLInitialResponsePgMessage
- type SASLResponsePgMessage
- type StartupPgMessage
Constants ¶
const ( BMESSAGE_ROW_DESCRIPTION = 84 BMESSAGE_AUTH = 82 BMESSAGE_PARAMETER_STATUS = 83 BMESSAGE_BACKEND_KEY_DATA = 75 BMESSAGE_READY_FOR_QUERY = 90 BMESSAGE_NO_DATA = 110 BMESSAGE_DATA_ROW = 68 BMESSAGE_COMMAND_COMPLETE = 67 BMESSAGE_ERROR_RESPONSE = 69 )
Backend Postgres Message kinds
const ( AUTH_OK = 0 AUTH_MD5_PASSWORD = 5 AUTH_SASL = 10 AUTH_SASL_CONTINUE = 11 AUTH_SASL_FINAL = 12 )
const ( NOTICE_KIND_SEVERITY_NONLOCALIZED = "Severity Nonlocalized" NOTICE_KIND_SEVERITY_LOCALIZED = "Severity Localized" NOTICE_KIND_CODE = "Code" NOTICE_KIND_MESSAGE = "Message" NOTICE_KIND_DETAIL = "Detail" NOTICE_KIND_HINT = "Hint" NOTICE_KIND_POSITION = "Position" NOTICE_KIND_INTERNAL_POSITION = "Internal Position" NOTICE_KIND_INTERNAL_QUERY = "Internal Query" NOTICE_KIND_WHERE = "Where" NOTICE_KIND_SCHEMA_NAME = "Schema Name" NOTICE_KIND_TABLE_NAME = "Table Name" NOTICE_KIND_COLUMN_NAME = "Column Name" NOTICE_KIND_DATA_TYPE_NAME = "Data Type Name" NOTICE_KIND_CONSTRAINT_NAME = "Constraint Name" NOTICE_KIND_FILE = "File" NOTICE_KIND_LINE = "Line" NOTICE_KIND_ROUTINE = "Routine" )
const ( FMESSAGE_STARTUP = -1 FMESSAGE_QUERY = 81 FMESSAGE_TERMINATE = 88 FMESSAGE_PASSWORD = 112 FMESSAGE_CANCEL = -2 FMESSAGE_SASL = 112 )
Frontend PgMessage kinds
const (
CANCEL_REQUEST_CODE int = 80877102
)
const (
SUPPORTED_PROTOCOL_VERSION = 196608
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthenticationMD5PasswordPgMessage ¶
type AuthenticationMD5PasswordPgMessage struct { Salt []byte // contains filtered or unexported fields }
func BuildAuthenticationMD5PasswordPgMessage ¶
func BuildAuthenticationMD5PasswordPgMessage(salt []byte) *AuthenticationMD5PasswordPgMessage
func (*AuthenticationMD5PasswordPgMessage) Pack ¶
func (m *AuthenticationMD5PasswordPgMessage) Pack() []byte
func (*AuthenticationMD5PasswordPgMessage) Unpack ¶
func (m *AuthenticationMD5PasswordPgMessage) Unpack(message *RawPgMessage) (*AuthenticationMD5PasswordPgMessage, error)
Postgres Message interface implementation for AuthenticationMD5PasswordPgMessage
type AuthenticationOkPgMessage ¶
type AuthenticationOkPgMessage struct{}
AuthenticationOkPgMessage represents the message sent by the server to indicate that the authentication was successful
func BuildAuthenticationOkPgMessage ¶
func BuildAuthenticationOkPgMessage() *AuthenticationOkPgMessage
Build a new AuthenticationOkPgMessage
func (*AuthenticationOkPgMessage) Pack ¶
func (m *AuthenticationOkPgMessage) Pack() []byte
func (*AuthenticationOkPgMessage) Unpack ¶
func (m *AuthenticationOkPgMessage) Unpack(message *RawPgMessage) (*AuthenticationOkPgMessage, error)
Postgres Message interface implementation for AuthenticationOkPgMessage
type AuthenticationSASLContinuePgMessage ¶
type AuthenticationSASLContinuePgMessage struct {
Data []byte
}
AuthenticationSASLContinuePgMessage represents the message sent by the server to continue the SASL authentication process
func BuildAuthenticationSASLContinuePgMessage ¶
func BuildAuthenticationSASLContinuePgMessage(data []byte) *AuthenticationSASLContinuePgMessage
func (*AuthenticationSASLContinuePgMessage) Pack ¶
func (m *AuthenticationSASLContinuePgMessage) Pack() []byte
func (*AuthenticationSASLContinuePgMessage) Unpack ¶
func (m *AuthenticationSASLContinuePgMessage) Unpack(message *RawPgMessage) (*AuthenticationSASLContinuePgMessage, error)
Postgres Message interface implementation for AuthenticationSASLContinuePgMessage
type AuthenticationSASLFinalPgMessage ¶
type AuthenticationSASLFinalPgMessage struct {
Data []byte
}
AuthenticationSASLFinalPgMessage represents the message sent by the server to indicate that the SASL authentication process is complete
func BuildAuthenticationSASLFinalPgMessage ¶
func BuildAuthenticationSASLFinalPgMessage(data []byte) *AuthenticationSASLFinalPgMessage
func (*AuthenticationSASLFinalPgMessage) Pack ¶
func (m *AuthenticationSASLFinalPgMessage) Pack() []byte
func (*AuthenticationSASLFinalPgMessage) Unpack ¶
func (m *AuthenticationSASLFinalPgMessage) Unpack(message *RawPgMessage) (*AuthenticationSASLFinalPgMessage, error)
Postgres Message interface implementation for AuthenticationSASLFinalPgMessage
type AuthenticationSASLPgMessage ¶
type AuthenticationSASLPgMessage struct {
AuthMechanisms []string
}
AuthenticationSASLPgMessage represents the message sent by the server to indicate that the client should use SASL authentication
func BuildAuthenticationSASLPgMessage ¶
func BuildAuthenticationSASLPgMessage(authMechanisms []string) *AuthenticationSASLPgMessage
func (*AuthenticationSASLPgMessage) Pack ¶
func (m *AuthenticationSASLPgMessage) Pack() []byte
func (*AuthenticationSASLPgMessage) Unpack ¶
func (m *AuthenticationSASLPgMessage) Unpack(message *RawPgMessage) (*AuthenticationSASLPgMessage, error)
Postgres Message interface implementation for AuthenticationSASLPgMessage
type BackendKeyDataPgMessage ¶
BackendKeyDataPgMessage represents the message sent by the server to inform the client of the process id and secret key
func BuildBackendKeyDataPgMessage ¶
func BuildBackendKeyDataPgMessage(processID int, secretKey int) *BackendKeyDataPgMessage
func (*BackendKeyDataPgMessage) Pack ¶
func (m *BackendKeyDataPgMessage) Pack() []byte
func (*BackendKeyDataPgMessage) Unpack ¶
func (m *BackendKeyDataPgMessage) Unpack(message *RawPgMessage) (*BackendKeyDataPgMessage, error)
Postgres Message interface implementation for BackendKeyDataPgMessage
type CancelRequestPgMessage ¶
CancelRequestPgMessage represents the message sent by the client to cancel a query
func BuildCancelRequestPgMessage ¶
func BuildCancelRequestPgMessage(backendPid int, backendKey int) *CancelRequestPgMessage
func (*CancelRequestPgMessage) Pack ¶
func (m *CancelRequestPgMessage) Pack() []byte
PgMessage interface implementation for CancelRequestPgMessage
func (*CancelRequestPgMessage) Unpack ¶
func (m *CancelRequestPgMessage) Unpack(message *RawPgMessage) (*CancelRequestPgMessage, error)
type CommandCompletePgMessage ¶
type CommandCompletePgMessage struct {
Command string
}
CommandCompletePgMessage represents the message sent by the server to indicate that a command has been completed
func BuildCommandCompletePgMessage ¶
func BuildCommandCompletePgMessage(command string) *CommandCompletePgMessage
func (*CommandCompletePgMessage) Pack ¶
func (m *CommandCompletePgMessage) Pack() []byte
func (*CommandCompletePgMessage) Unpack ¶
func (m *CommandCompletePgMessage) Unpack(message *RawPgMessage) (*CommandCompletePgMessage, error)
Message interface implementation for CommandCompletePgMessage
type DataRowPgMessage ¶
type DataRowPgMessage struct {
Values [][]byte
}
DataRowPgMessage represents the message sent by the server to send a row of data
func BuildDataRowPgMessage ¶
func BuildDataRowPgMessage(values [][]byte) *DataRowPgMessage
func (*DataRowPgMessage) Pack ¶
func (m *DataRowPgMessage) Pack() []byte
func (*DataRowPgMessage) Unpack ¶
func (m *DataRowPgMessage) Unpack(message *RawPgMessage) (*DataRowPgMessage, error)
PostgresMessage interface implementation for DataRowPgMessage
type ErrorField ¶
func (ErrorField) Pack ¶
func (e ErrorField) Pack() []byte
type ErrorResponsePgMessage ¶
type ErrorResponsePgMessage struct {
Fields map[string]ErrorField
}
ErrorResponsePgMessage represents the message sent by the server to indicate that an error occurred
func BuildErrorResponsePgMessage ¶
func BuildErrorResponsePgMessage(params map[string]string) *ErrorResponsePgMessage
func MakeConnectionErrorMessages ¶
func MakeConnectionErrorMessages( message string, detail string, code string, routine string, ) *ErrorResponsePgMessage
func (*ErrorResponsePgMessage) Error ¶
func (m *ErrorResponsePgMessage) Error() string
func (*ErrorResponsePgMessage) GetErrorResponseField ¶
func (m *ErrorResponsePgMessage) GetErrorResponseField(kind string) string
func (*ErrorResponsePgMessage) Pack ¶
func (m *ErrorResponsePgMessage) Pack() []byte
func (*ErrorResponsePgMessage) Unpack ¶
func (m *ErrorResponsePgMessage) Unpack(message *RawPgMessage) (*ErrorResponsePgMessage, error)
type FieldDescription ¶
type FieldDescription struct { Name string // contains filtered or unexported fields }
FieldDescription represents the description of a field in a row
func (FieldDescription) Pack ¶
func (d FieldDescription) Pack() []byte
type NoDataPgMessage ¶
type NoDataPgMessage struct{}
NoDataPgMessage represents the message sent by the server to indicate that there is no data to return
func BuildNoDataPgMessage ¶
func BuildNoDataPgMessage() *NoDataPgMessage
func (*NoDataPgMessage) Pack ¶
func (m *NoDataPgMessage) Pack() []byte
func (*NoDataPgMessage) Unpack ¶
func (m *NoDataPgMessage) Unpack(message *RawPgMessage) (*NoDataPgMessage, error)
Postgres Message interface implementation for NoDataPgMessage
type ParameterStatusPgMessage ¶
ParameterStatusPgMessage represents the message sent by the server to inform the client of sever parameter values
func BuildParameterStatusPgMessage ¶
func BuildParameterStatusPgMessage(name string, value string) *ParameterStatusPgMessage
func (*ParameterStatusPgMessage) Pack ¶
func (m *ParameterStatusPgMessage) Pack() []byte
func (*ParameterStatusPgMessage) Unpack ¶
func (m *ParameterStatusPgMessage) Unpack(message *RawPgMessage) (*ParameterStatusPgMessage, error)
Postgres Message interface implementation for ParameterStatusPgMessage
type PasswordPgMessage ¶
type PasswordPgMessage struct {
Password string
}
PasswordPgMessage represents the message sent by the client to authenticate
func BuildPasswordMessage ¶
func BuildPasswordMessage(password string) *PasswordPgMessage
func (PasswordPgMessage) Pack ¶
func (m PasswordPgMessage) Pack() []byte
func (*PasswordPgMessage) Unpack ¶
func (m *PasswordPgMessage) Unpack(message *RawPgMessage) (*PasswordPgMessage, error)
PgMessage interface implementation for PasswordPgMessage
type PgMessage ¶
type PgMessage interface { Unpack(*RawPgMessage) (*PgMessage, error) Pack() []byte }
A Interface for message types in the postgres protocol
type QueryPgMessage ¶
type QueryPgMessage struct {
Query string
}
QueryPgMessage represents the message sent by the client to query the database
func BuildQueryMessage ¶
func BuildQueryMessage(query string) *QueryPgMessage
func (QueryPgMessage) Pack ¶
func (m QueryPgMessage) Pack() []byte
func (*QueryPgMessage) Unpack ¶
func (m *QueryPgMessage) Unpack(message *RawPgMessage) (*QueryPgMessage, error)
PgMessage interface implementation for QueryPgMessage
type RawPgMessage ¶
RawPgMessage is a low level representation of a message containing the kind of message, the length of the message and the raw bytes. Generally we read a raw message from a connection and then Unpack it into a higher level message
RawPgMessage still implements the Message interface as it can be useful to pass it around generically
func GetRawPgMessage ¶
func GetRawPgMessage(conn io.Reader) (*RawPgMessage, error)
Reads a raw message from a connection
func GetRawStartupPgMessage ¶
func GetRawStartupPgMessage(conn net.Conn) (*RawPgMessage, error)
func (RawPgMessage) Pack ¶
func (rm RawPgMessage) Pack() []byte
func (RawPgMessage) Unpack ¶
func (rm RawPgMessage) Unpack(data []byte) RawPgMessage
Message interface implementation for RawPgMessage
type ReadyForQueryPgMessage ¶
type ReadyForQueryPgMessage struct {
TransactionStatus byte
}
ReadyForQueryPgMessage represents the message sent by the server to indicate that the server is ready to accept a new query
func BuildReadyForQueryPgMessage ¶
func BuildReadyForQueryPgMessage(status byte) *ReadyForQueryPgMessage
func (*ReadyForQueryPgMessage) Pack ¶
func (m *ReadyForQueryPgMessage) Pack() []byte
func (*ReadyForQueryPgMessage) Unpack ¶
func (m *ReadyForQueryPgMessage) Unpack(message *RawPgMessage) (*ReadyForQueryPgMessage, error)
Postgres Message interface implementation for ReadyForQueryPgMessage
type RowDescriptionPgMessage ¶
type RowDescriptionPgMessage struct {
Fields []FieldDescription
}
RowDescriptionPgMessage represents the message sent by the server to describe the fields of a row
func BuildRowDescriptionPgMessage ¶
func BuildRowDescriptionPgMessage(fieldsMap map[string][]int) *RowDescriptionPgMessage
Build a new RowDescriptionPgMessage
func (RowDescriptionPgMessage) Pack ¶
func (m RowDescriptionPgMessage) Pack() []byte
func (*RowDescriptionPgMessage) Unpack ¶
func (m *RowDescriptionPgMessage) Unpack(message *RawPgMessage) (*RowDescriptionPgMessage, error)
PostgresMessage interface implementation for RowDescriptionPgMessage
type SASLInitialResponsePgMessage ¶
SASLInitialResponsePgMessage represents the message sent by the client to authenticate using SASL
func BuildSASLInitialResponseMessage ¶
func BuildSASLInitialResponseMessage(mechanism string, response []byte) *SASLInitialResponsePgMessage
func (SASLInitialResponsePgMessage) Pack ¶
func (m SASLInitialResponsePgMessage) Pack() []byte
func (*SASLInitialResponsePgMessage) Unpack ¶
func (m *SASLInitialResponsePgMessage) Unpack(message *RawPgMessage) (*SASLInitialResponsePgMessage, error)
PgMessage interface implementation for SASLInitialResponsePgMessage
type SASLResponsePgMessage ¶
type SASLResponsePgMessage struct {
Response []byte
}
SASLResponsePgMessage represents the message sent by the client to authenticate using SASL
func BuildSASLResponseMessage ¶
func BuildSASLResponseMessage(response []byte) *SASLResponsePgMessage
func (SASLResponsePgMessage) Pack ¶
func (m SASLResponsePgMessage) Pack() []byte
func (*SASLResponsePgMessage) Unpack ¶
func (m *SASLResponsePgMessage) Unpack(message *RawPgMessage) (*SASLResponsePgMessage, error)
PgMessage interface implementation for SASLResponsePgMessage
type StartupPgMessage ¶
type StartupPgMessage struct { ProtocolVersion int User string Database string Options map[string]string }
StartupPgMessage represents the message sent by the client to start the connection
func BuildStartupMessage ¶
func BuildStartupMessage(user string, database string) *StartupPgMessage
func (StartupPgMessage) Pack ¶
func (m StartupPgMessage) Pack() []byte
func (*StartupPgMessage) Unpack ¶
func (m *StartupPgMessage) Unpack(message *RawPgMessage) (*StartupPgMessage, error)
PgMessage interface implementation for StartupPgMessage