fmessages

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 23, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BindMsg added in v1.0.5

type BindMsg struct {
	// The name of the destination portal (an empty string selects the unnamed portal).
	DestPortalName string
	// The name of the source prepared statement (an empty string selects the unnamed prepared statement).
	PreparedStatementName string
	// The parameter format codes. Each must presently be zero (text) or one (binary).
	ParameterFormatCodes []int16
	// Array of the values of the parameters, in the format indicated by the associated format code. n is the above length.
	ParamVals []interface{}
	// The result-column format codes. Each must presently be zero (text) or one (binary).
	ResultColumnFormatCodes []int16
}

BindMsg Once a prepared statement exists, it can be readied for execution using a Bind message. The Bind message gives the name of the source prepared statement (empty string denotes the unnamed prepared statement), the name of the destination portal (empty string denotes the unnamed portal), and the values to use for any parameter placeholders present in the prepared statement. The supplied parameter set must match those needed by the prepared statement. (If you declared any void parameters in the Parse message, pass NULL values for them in the Bind message.) Bind also specifies the format to use for any data returned by the query; the format can be specified overall, or per-column. The response is either BindComplete or ErrorResponse.

Note The choice between text and binary output is determined by the format codes given in Bind, regardless of the SQL command involved. The BINARY attribute in cursor declarations is irrelevant when using extended query protocol.

func ParseBindMsg added in v1.0.5

func ParseBindMsg(payload []byte) (BindMsg, error)

type DescribeMsg added in v1.0.5

type DescribeMsg struct {
	// 'S' to describe a prepared statement; or 'P' to describe a portal.
	DescType string
	// The name of the prepared statement or portal to describe (an empty string selects the unnamed prepared statement or portal).
	Name string
}

func ParseDescribeMsg added in v1.0.5

func ParseDescribeMsg(msg []byte) (DescribeMsg, error)

type Execute added in v1.0.5

type Execute struct {
	// The name of the portal to execute (an empty string selects the unnamed portal).
	PortalName string
	// Maximum number of rows to return, if portal contains a query that returns rows (ignored otherwise). Zero denotes “no limit”.
	MaxRows int32
}

Once a portal exists, it can be executed using an Execute message. The Execute message specifies the portal name (empty string denotes the unnamed portal) and a maximum result-row count (zero meaning “fetch all rows”). The result-row count is only meaningful for portals containing commands that return row sets; in other cases the command is always executed to completion, and the row count is ignored. The possible responses to Execute are the same as those described above for queries issued via simple query protocol, except that Execute doesn't cause ReadyForQuery or RowDescription to be issued.

If Execute terminates before completing the execution of a portal (due to reaching a nonzero result-row count), it will send a PortalSuspended message; the appearance of this message tells the frontend that another Execute should be issued against the same portal to complete the operation. The CommandComplete message indicating completion of the source SQL command is not sent until the portal's execution is completed. Therefore, an Execute phase is always terminated by the appearance of exactly one of these messages: CommandComplete, EmptyQueryResponse (if the portal was created from an empty query string), ErrorResponse, or PortalSuspended.

func ParseExecuteMsg added in v1.0.5

func ParseExecuteMsg(payload []byte) (Execute, error)

type FlushMsg added in v1.1.0

type FlushMsg struct{}

func ParseFlushMsg added in v1.1.0

func ParseFlushMsg(msg []byte) (FlushMsg, error)

type ParseMsg added in v1.0.5

type ParseMsg struct {
	// The number of parameter data types specified (can be zero). Note that this is not an indication of the number of parameters that might appear in the query string, only the number that the frontend wants to prespecify types for.
	ParamsCount int16
	// The name of the destination prepared statement (an empty string selects the unnamed prepared statement).
	DestPreparedStatementName string
	// The query string to be parsed.
	Statements string
	// Specifies the object IDs of the parameters data type. Placing a zero here is equivalent to leaving the type unspecified.
	ObjectIDs []int32
}

func ParseParseMsg added in v1.0.5

func ParseParseMsg(payload []byte) (ParseMsg, error)

type PasswordMsg

type PasswordMsg struct {
	// contains filtered or unexported fields
}

func ParsePasswordMsg

func ParsePasswordMsg(payload []byte) (PasswordMsg, error)

func (*PasswordMsg) GetSecret

func (pw *PasswordMsg) GetSecret() string

type QueryMsg

type QueryMsg struct {
	// contains filtered or unexported fields
}

func ParseQueryMsg

func ParseQueryMsg(payload []byte) (QueryMsg, error)

func (*QueryMsg) GetStatements

func (q *QueryMsg) GetStatements() string

type SyncMsg added in v1.0.5

type SyncMsg struct{}

At completion of each series of extended-query messages, the frontend should issue a Sync message. This parameterless message causes the backend to close the current transaction if it's not inside a BEGIN/COMMIT transaction block (“close” meaning to commit if no error, or roll back if error). Then a ReadyForQuery response is issued. The purpose of Sync is to provide a resynchronization point for error recovery. When an error is detected while processing any extended-query message, the backend issues ErrorResponse, then reads and discards messages until a Sync is reached, then issues ReadyForQuery and returns to normal message processing. (But note that no skipping occurs if an error is detected while processing Sync — this ensures that there is one and only one ReadyForQuery sent for each Sync.)

func ParseSyncMsg added in v1.0.5

func ParseSyncMsg(msg []byte) (SyncMsg, error)

type TerminateMsg

type TerminateMsg struct{}

func ParseTerminateMsg

func ParseTerminateMsg(payload []byte) (TerminateMsg, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL