Documentation ¶
Index ¶
- Constants
- Variables
- func NewErrExist(v any) error
- func NewErrInvalidMessage(t Type) error
- func NewErrMessageNotSuppoted(t Type) error
- func NewErrNotExist(v any) error
- func WithRowFieldDataType(dt *DataType) func(*RowField)
- func WithRowFieldFormatCode(formatCode int16) func(*RowField)
- func WithRowFieldModifier(typeModifier int32) func(*RowField)
- func WithRowFieldNumber(number int16) func(*RowField)
- func WithRowFieldObjectID(dataTypeID int32) func(*RowField)
- func WithRowFieldSize(dataTypeSize int16) func(*RowField)
- func WithRowFieldTableID(tableID int32) func(*RowField)
- type BackendKeyData
- type Bind
- type BindComplete
- type BindParam
- type BindParams
- type Close
- type CloseComplete
- type CommandComplete
- func NewCommandComplete() *CommandComplete
- func NewCommandCompleteWith(tag string) (*CommandComplete, error)
- func NewCommitComplete() (*CommandComplete, error)
- func NewCopyCompleteWith(n int) (*CommandComplete, error)
- func NewDeleteCompleteWith(n int) (*CommandComplete, error)
- func NewEmptyComplete() (*CommandComplete, error)
- func NewInsertCompleteWith(n int) (*CommandComplete, error)
- func NewSelectCompleteWith(n int) (*CommandComplete, error)
- func NewUpdateCompleteWith(n int) (*CommandComplete, error)
- type CopyData
- type CopyDone
- type CopyFail
- type CopyFormat
- type CopyInResponse
- type DataRow
- type DataType
- type Describe
- type EmptyQueryResponse
- type ErrorResponse
- type ErrorType
- type Execute
- type Flush
- type FormatCode
- type Message
- type MessageReader
- type NoData
- type ObjectID
- type ParameterDescription
- type ParameterStatus
- type Parse
- type ParseComplete
- type Password
- type PreparedType
- type Query
- type Reader
- func (reader *Reader) PeekBytes(n int) ([]byte, error)
- func (reader *Reader) PeekInt32() (int32, error)
- func (reader *Reader) ReadByte() (byte, error)
- func (reader *Reader) ReadBytes(buf []byte) (int, error)
- func (reader *Reader) ReadBytesUntil(delim byte) ([]byte, error)
- func (reader *Reader) ReadInt16() (int16, error)
- func (reader *Reader) ReadInt32() (int32, error)
- func (reader *Reader) ReadString() (string, error)
- type ReadyForQuery
- type RequestMessage
- type Response
- type ResponseMessage
- type Responses
- func NewCommandCompleteResponsesWith(msg string) (Responses, error)
- func NewCopyCompleteResponsesWith(n int) (Responses, error)
- func NewDeleteCompleteResponsesWith(n int) (Responses, error)
- func NewEmptyCompleteResponses() (Responses, error)
- func NewInsertCompleteResponsesWith(n int) (Responses, error)
- func NewParameterStatusesWith(m map[string]string) (Responses, error)
- func NewResponses() Responses
- func NewResponsesWith(responses ...Response) Responses
- func NewSelectCompleteResponsesWith(n int) (Responses, error)
- func NewUpdateCompleteResponsesWith(n int) (Responses, error)
- type RowDescription
- type RowField
- type RowFieldOption
- type SSLRequest
- type SSLResponse
- type Startup
- type Sync
- type Terminate
- type TransactionStatus
- type Type
- type Writer
- func (writer *Writer) AppendByte(c byte) error
- func (writer *Writer) AppendBytes(p []byte) error
- func (writer *Writer) AppendFloat32(v float32) error
- func (writer *Writer) AppendFloat64(v float64) error
- func (writer *Writer) AppendInt16(v int16) error
- func (writer *Writer) AppendInt32(v int32) error
- func (writer *Writer) AppendInt64(v int64) error
- func (writer *Writer) AppendInt8(v int8) error
- func (writer *Writer) AppendString(s string) error
- func (writer *Writer) AppendTerminator() error
- func (writer *Writer) Bytes() ([]byte, error)
Constants ¶
const ( AuthenticationKerberosV5Required = 2 AuthenticationCleartextPasswordRequired = 3 AuthenticationMD5PasswordRequired = 5 AuthenticationSCMCredentialRequired = 6 AuthenticationGSSRequired = 7 AuthenticationGSSContinueRequired = 8 AuthenticationSSPIRequired = 9 AuthenticationSASLRequired = 10 AuthenticationSASLContinueRequired = 11 AuthenticationSASLFinalRequired = 12 AuthenticationOk = 0 )
const ( // TextCopy represents a textual copy format. TextCopy = CopyFormat(0) // BinaryCopy represents a binary copy format. BinaryCopy = CopyFormat(1) )
const ( // MessageTypeSize is the size of the message type. MessageTypeSize = 1 // MessageLengthSize is the size of the message length. MessageLengthSize = 4 // MessageHeaderSize is the size of the message header. MessageHeaderSize = MessageTypeSize + MessageLengthSize )
const ( ApplicationName = "application_name" ClientEncoding = "client_encoding" ServerEncoding = "server_ encoding" DateStyle = "DateStyle" TimeZone = "TimeZone" IntervalStyle = "IntervalStyle" )
const ( DefaultTransactiOnReadOnly = "default_transaction_read_only" InHotStandby = "in_hot_standby" IsSuperuser = "is_superuser" OntegerDatetimes = "integer_datetimes" )
on/off parameters.
const ( ServerVersion = "#server_version" StandardConformingStrings = "#standard_conforming_strings" )
const ( // PreparedStatementByte represents a prepared statement. PreparedStatementByte = 'S' // PreparedPortalByte represents a prepared portal. PreparedPortalByte = 'P' )
const ( TransactionIdle = 'I' TransactionBlock = 'T' TransactionFailed = 'E' )
const ( SSLEnabled = 'S' SSLDisabled = 'N' )
const ( StartUpUser = "user" StartUpPassword = "password" StartUpDatabase = "database" StartUpApplicationName = "application_name" StartUpClientEncoding = "client_encoding" )
const (
DateStyleISO = "ISO, MDY.S"
)
const (
EncodingUTF8 = "UTF8"
)
const (
NoneMessage = 0x00
)
const SSLRequestCode = 80877103
SSLRequestCode represents a SSLRequest message code.
Variables ¶
var ErrExist = errors.New("exist")
ErrExist is returned when the specified object is exist.
var ErrInvalid = errors.New("invalid")
ErrInvalid is returned when the message is invalid.
var ErrNotExist = errors.New("not exist")
ErrNotExist is returned when the specified object is not exist.
var ErrNotSupported = errors.New("not supported")
ErrNotSupported is returned when the message is not supported.
Functions ¶
func NewErrInvalidMessage ¶ added in v0.9.1
NewErrInvalidMessage eturns a new message not supported error.
func NewErrMessageNotSuppoted ¶
NewErrMessageNotSuppoted returns a new message not supported error.
func NewErrNotExist ¶
NewErrNotExist returns a new not exist error.
func WithRowFieldDataType ¶ added in v1.2.0
WithRowFieldDataType sets a data type.
func WithRowFieldFormatCode ¶ added in v1.2.0
WithRowFieldFormatCode sets a format code.
func WithRowFieldModifier ¶ added in v1.2.0
WithRowFieldModifier sets a type modifier.
func WithRowFieldNumber ¶ added in v1.2.0
WithRowFieldNumber sets a number.
func WithRowFieldObjectID ¶ added in v1.2.0
WithRowFieldObjectID sets a data type ID.
func WithRowFieldSize ¶ added in v1.2.0
WithRowFieldSize sets a data type size.
func WithRowFieldTableID ¶ added in v1.2.0
WithRowFieldTableID sets a table ID.
Types ¶
type BackendKeyData ¶
type BackendKeyData struct {
*ResponseMessage
}
BackendKeyData represents a parameter status response message.
func NewBackendKeyData ¶
func NewBackendKeyData() *BackendKeyData
NewBackendKeyData returns a parameter status response instance.
func NewBackendKeyDataWith ¶
func NewBackendKeyDataWith(processID int32, secretKey int32) (*BackendKeyData, error)
NewBackendKeyDataWith returns a parameter status response instance with the specified parameters.
type Bind ¶
type Bind struct { *RequestMessage PortalName string StatementName string Params BindParams }
Bind represents a bind message.
func NewBindWithReader ¶ added in v0.9.1
func NewBindWithReader(reader *MessageReader) (*Bind, error)
NewBind returns a new bind message.
type BindComplete ¶
type BindComplete struct {
*ResponseMessage
}
BindComplete represents a bind complete message.
func NewBindComplete ¶
func NewBindComplete() *BindComplete
NewBindComplete returns a new bind complete message instance.
type BindParams ¶
type BindParams []*BindParam
BindParams represents bind parameters.
func (BindParams) FindBindParam ¶
func (params BindParams) FindBindParam(id string) (*BindParam, error)
FindBindParam returns a bind parameter with specified id.
type Close ¶ added in v1.3.0
type Close struct { *RequestMessage Type PreparedType Name string }
Close represents a close message.
func NewCloseWithReader ¶ added in v1.3.0
func NewCloseWithReader(reader *MessageReader) (*Close, error)
NewCloseWithReader returns a new close message with the specified reader.
type CloseComplete ¶ added in v1.3.0
type CloseComplete struct {
*ResponseMessage
}
CloseComplete represents a close complete message.
func NewCloseComplete ¶ added in v1.3.0
func NewCloseComplete() *CloseComplete
NewCloseComplete returns a new close complete message instance.
type CommandComplete ¶
type CommandComplete struct {
*ResponseMessage
}
CommandComplete represents a command complete message.
func NewCommandComplete ¶
func NewCommandComplete() *CommandComplete
NewCommandComplete returns a new command complete message instance.
func NewCommandCompleteWith ¶
func NewCommandCompleteWith(tag string) (*CommandComplete, error)
NewInsertCompleteWith returns a new command complete message for insert query.
func NewCommitComplete ¶ added in v0.9.1
func NewCommitComplete() (*CommandComplete, error)
NewCommitComplete returns a new command complete message for commit query.
func NewCopyCompleteWith ¶ added in v0.9.1
func NewCopyCompleteWith(n int) (*CommandComplete, error)
NewCopyCompleteWith returns a new command complete message for copy query.
func NewDeleteCompleteWith ¶
func NewDeleteCompleteWith(n int) (*CommandComplete, error)
NewDeleteCompleteWith returns a new command complete message for delete query.
func NewEmptyComplete ¶ added in v1.4.0
func NewEmptyComplete() (*CommandComplete, error)
NewEmptyComplete returns a new command complete message for empty ping query.
func NewInsertCompleteWith ¶
func NewInsertCompleteWith(n int) (*CommandComplete, error)
NewInsertCompleteWith returns a new command complete message for insert query.
func NewSelectCompleteWith ¶
func NewSelectCompleteWith(n int) (*CommandComplete, error)
NewSelectCompleteWith returns a new command complete message for select query.
func NewUpdateCompleteWith ¶
func NewUpdateCompleteWith(n int) (*CommandComplete, error)
NewUpdateCompleteWith returns a new command complete message for update query.
type CopyData ¶ added in v0.9.1
type CopyData struct { *RequestMessage Data []string }
CopyData represents a copy data message.
func NewCopyDataWithReader ¶ added in v0.9.1
func NewCopyDataWithReader(reader *MessageReader) (*CopyData, error)
NewCopyDataWithReader returns a new copy data message with the specified reader.
type CopyDone ¶ added in v0.9.1
type CopyDone struct {
*RequestMessage
}
CopyDone represents a copy done message.
func NewCopyDoneWithReader ¶ added in v0.9.1
func NewCopyDoneWithReader(reader *MessageReader) (*CopyDone, error)
NewCopyDataWithReader returns a new copy data message with the specified reader.
type CopyFail ¶ added in v0.9.1
CopyFail represents a copy fail message.
func NewCopyFailWithReader ¶ added in v0.9.1
NewCopyFailWithReader returns a new copy fail message with the specified reader.
type CopyInResponse ¶ added in v0.9.1
type CopyInResponse struct { *ResponseMessage // contains filtered or unexported fields }
CopyInResponse represents a command complete message.
func NewCopyInResponseWith ¶ added in v0.9.1
func NewCopyInResponseWith(fmt CopyFormat) *CopyInResponse
NewCopyInResponse returns a new command complete message instance.
func (*CopyInResponse) AppendFormatCode ¶ added in v0.9.1
func (msg *CopyInResponse) AppendFormatCode(formatCode int16)
AppendFormatCode appends a format code.
func (*CopyInResponse) Bytes ¶ added in v0.9.1
func (msg *CopyInResponse) Bytes() ([]byte, error)
Bytes appends a length of the message content bytes, and returns the message bytes.
type DataRow ¶
type DataRow struct { *ResponseMessage Data []any }
DataRow represents a data row message.
func (*DataRow) AppendData ¶
AppendData appends a column value to the data row message.
type Describe ¶ added in v1.3.0
type Describe struct { *RequestMessage Type PreparedType Name string }
Describe represents a describe message.
func NewDescribeWithReader ¶ added in v1.3.0
func NewDescribeWithReader(reader *MessageReader) (*Describe, error)
NewDescribeWithReader returns a new describe message with the specified reader.
type EmptyQueryResponse ¶
type EmptyQueryResponse struct {
*ResponseMessage
}
EmptyQueryResponse represents an empty query response message.
func NewEmptyQueryResponse ¶
func NewEmptyQueryResponse() *EmptyQueryResponse
NewEmptyQueryResponse returns an empty query response message instance.
type ErrorResponse ¶
type ErrorResponse struct {
*ResponseMessage
}
ErrorResponse represents an error response message.
func NewErrorResponse ¶
func NewErrorResponse() *ErrorResponse
NewErrorResponse returns a new error response instance.
func NewErrorResponseWith ¶
func NewErrorResponseWith(err error) (*ErrorResponse, error)
NewErrorResponseWith returns a new error response instance with the specified error.
func (*ErrorResponse) AddCode ¶
func (msg *ErrorResponse) AddCode(code int32) error
AddCode adds an error code to the error response.
func (*ErrorResponse) AddError ¶
func (msg *ErrorResponse) AddError(err error) error
AddError adds an error message to the error response.
func (*ErrorResponse) AppendField ¶
func (msg *ErrorResponse) AppendField(t ErrorType, v string) error
AppendField appends an error field to the error response.
func (*ErrorResponse) Bytes ¶
func (msg *ErrorResponse) Bytes() ([]byte, error)
Bytes returns the message bytes after adding a null terminator.
type ErrorType ¶
type ErrorType byte
ErrorType represents a error response type.
const ( SeverityError ErrorType = 'S' CodeError ErrorType = 'C' MessageError ErrorType = 'M' DetailError ErrorType = 'D' HintError ErrorType = 'H' PositionError ErrorType = 'P' InternalPositionError ErrorType = 'p' InternalQueryError ErrorType = 'q' WhereError ErrorType = 'W' SchemaError ErrorType = 's' TableError ErrorType = 't' ColumnError ErrorType = 'c' DataTypeNameError ErrorType = 'd' ConstraintError ErrorType = 'n' FileError ErrorType = 'F' LineError ErrorType = 'L' RoutineError ErrorType = 'R' )
type Execute ¶ added in v1.3.0
type Execute struct { *RequestMessage PortalName string MaxRows int32 }
Execute represents an execute message.
func NewExecuteWithReader ¶ added in v1.3.0
func NewExecuteWithReader(reader *MessageReader) (*Execute, error)
NewExecute returns a new execute message.
type Flush ¶ added in v1.3.0
type Flush struct {
*RequestMessage
}
Flush represents a flush message.
func NewFlushWithReader ¶ added in v1.3.0
func NewFlushWithReader(reader *MessageReader) (*Flush, error)
NewFlush returns a new flush message.
type FormatCode ¶ added in v1.3.0
type FormatCode = system.FormatCode
FormatCode represents a format code.
const ( // TextFormat represents a text format code. TextFormat FormatCode = system.TextFormat // BinaryFormat represents a binary format code. BinaryFormat FormatCode = system.BinaryFormat )
type Message ¶ added in v0.9.1
type Message struct { *MessageReader Type Type Length int32 }
Message represents a message of PostgreSQL packet.
func NewMessageWithReader ¶ added in v0.9.1
func NewMessageWithReader(reader *MessageReader) (*Message, error)
NewMessageWithReader returns a new message with the specified reader.
func (*Message) MessageDataLength ¶ added in v0.9.1
MessageLength returns a message data length without the message header.
func (*Message) MessageLength ¶ added in v0.9.1
MessageLength returns a message length.
func (*Message) MessageType ¶ added in v0.9.1
MessageType returns a message type.
func (*Message) ReadMessageData ¶ added in v0.9.1
ReadMessageData reads all message data.
type MessageReader ¶ added in v0.9.1
func NewMessageReaderWith ¶ added in v0.9.1
func NewMessageReaderWith(reader io.Reader) *MessageReader
NewMessageReader returns a new message reader.
func (*MessageReader) IsPeekType ¶ added in v1.3.0
func (reader *MessageReader) IsPeekType(t Type) (bool, error)
IsPeekType returns true whether the peeked message type is the specified type.
func (*MessageReader) PeekType ¶ added in v0.9.1
func (reader *MessageReader) PeekType() (Type, error)
PeekType peeks a message type.
func (*MessageReader) ReadLength ¶ added in v0.9.1
func (reader *MessageReader) ReadLength() (int32, error)
ReadLength reads a message length.
func (*MessageReader) ReadType ¶ added in v0.9.1
func (reader *MessageReader) ReadType() (Type, error)
ReadType reads a message type.
type ParameterDescription ¶ added in v1.3.0
type ParameterDescription struct {
*ResponseMessage
}
ParameterDescription represents a parameter description response message.
func NewParameterDescription ¶ added in v1.3.0
func NewParameterDescription() *ParameterDescription
NewParameterDescription returns a parameter description response instance.
func NewParameterDescriptionWith ¶ added in v1.3.0
func NewParameterDescriptionWith(objectIDs ...ObjectID) (*ParameterDescription, error)
NewParameterDescriptionWith returns a parameter description response instance with the specified parameters.
type ParameterStatus ¶
type ParameterStatus struct {
*ResponseMessage
}
ParameterStatus represents a parameter status response message.
func NewParameterStatus ¶
func NewParameterStatus() *ParameterStatus
NewParameterStatus returns a parameter status response instance.
func NewParameterStatusWith ¶
func NewParameterStatusWith(name string, value string) (*ParameterStatus, error)
NewParameterStatusWith returns a parameter status response instance with the specified parameter status.
func (*ParameterStatus) AppendParameters ¶
func (msg *ParameterStatus) AppendParameters(s ...string) error
AppendParameters appends the specified parameters.
type Parse ¶
type Parse struct { *RequestMessage Name string Query string NumDataTypes int16 DataTypes []int32 }
Parse represents a parse message.
func NewParseWithReader ¶
func NewParseWithReader(reader *MessageReader) (*Parse, error)
NewParseWithReader returns a new parse message with the specified reader.
type ParseComplete ¶
type ParseComplete struct {
*ResponseMessage
}
ParseComplete represents a parser complete message.
func NewParseComplete ¶
func NewParseComplete() *ParseComplete
NewParseComplete returns a parser complete instance.
type Password ¶ added in v1.4.0
type Password struct { *RequestMessage Password string }
Password represents a password message.
func NewPasswordWithReader ¶ added in v1.4.0
func NewPasswordWithReader(reader *MessageReader) (*Password, error)
NewPasswordWithReader returns a new password message.
type PreparedType ¶ added in v1.3.0
type PreparedType int
PreparedType represents a prepared type.
const ( // PreparedStatement represents a prepared statement. PreparedStatement PreparedType = iota // PreparedPortal represents a prepared portal. PreparedPortal )
func NewPreparedTypeWithByte ¶ added in v1.3.0
func NewPreparedTypeWithByte(bt byte) (PreparedType, error)
NewPreparedTypeWithByte returns a new prepared type with the specified byte.
type Query ¶
type Query struct { *RequestMessage Query string BindParams }
Query represents a parse message.
func NewQueryWith ¶
NewQueryWith returns a new query message with specified parameters.
func NewQueryWithReader ¶
func NewQueryWithReader(reader *MessageReader) (*Query, error)
NewQueryWithReader returns a new query message with specified reader.
type Reader ¶
Reader represents a message reader.
func NewReaderWith ¶
NewReader returns a new message reader.
func (*Reader) ReadBytesUntil ¶ added in v1.3.0
func (*Reader) ReadString ¶
ReadString reads a string.
type ReadyForQuery ¶
type ReadyForQuery struct {
*ResponseMessage
}
ReadyForQuery represents a ready for query message.
func NewReadyForQuery ¶
func NewReadyForQuery() *ReadyForQuery
NewReadyForQuery returns a new ready for query message instance.
func NewReadyForQueryWith ¶
func NewReadyForQueryWith(s TransactionStatus) (*ReadyForQuery, error)
NewReadyForQueryWith returns a new error response instance with the specified error.
type RequestMessage ¶
type RequestMessage struct {
*Message
}
RequestMessage represents a frontend request.
func NewRequestMessageWithReader ¶ added in v0.9.1
func NewRequestMessageWithReader(reader *MessageReader) (*RequestMessage, error)
NewRequestMessageWithReader returns a new request message with the specified reader.
type Response ¶
type Response interface { // Type returns the message type. Type() Type // Bytes returns the message bytes. Bytes() ([]byte, error) }
Response represents a backend response message interface.
type ResponseMessage ¶
type ResponseMessage struct { *Writer // contains filtered or unexported fields }
ResponseMessage represents a backend response instance.
func NewAuthenticationCleartextPassword ¶ added in v1.4.0
func NewAuthenticationCleartextPassword() (*ResponseMessage, error)
NewAuthenticationCleartextPassword returns a new AuthenticationCleartextPassword message.
func NewAuthenticationMD5Password ¶ added in v1.4.0
func NewAuthenticationMD5Password(salt []byte) (*ResponseMessage, error)
NewAuthenticationMD5Password returns a new AuthenticationMD5Password message.
func NewAuthenticationOk ¶
func NewAuthenticationOk() (*ResponseMessage, error)
NewAuthenticationOk returns a new AuthenticationOk message.
func NewResponseMessage ¶
func NewResponseMessage() *ResponseMessage
NewResponseMessage returns a new request message instance.
func NewResponseMessageWith ¶
func NewResponseMessageWith(t Type) *ResponseMessage
NewResponseMessageWith returns a new response message with the specified message type.
func (*ResponseMessage) Bytes ¶
func (msg *ResponseMessage) Bytes() ([]byte, error)
Bytes appends a length of the message content bytes, and returns the message bytes.
func (*ResponseMessage) SetType ¶
func (msg *ResponseMessage) SetType(t Type)
SetType sets a message type.
func (*ResponseMessage) Type ¶
func (msg *ResponseMessage) Type() Type
Type returns the message type.
type Responses ¶
type Responses []Response
Responses represents a list of response.
func NewCommandCompleteResponsesWith ¶
NewCommandCompleteResponsesWith returns a new responses with the specified message.
func NewCopyCompleteResponsesWith ¶ added in v0.9.1
NewCopyCompleteResponsesWith returns a new responses with the specified message.
func NewDeleteCompleteResponsesWith ¶
NewDeleteCompleteResponsesWith returns a new responses with the specified message.
func NewEmptyCompleteResponses ¶ added in v1.4.0
NewEmptyCompleteResponses returns a new responses with the specified message.
func NewInsertCompleteResponsesWith ¶
NewInsertCompleteResponsesWith returns a new responses with the specified message.
func NewParameterStatusesWith ¶ added in v1.0.1
NewParameterStatusesWith returns parameter status response instances with the specified parameter statuses.
func NewResponsesWith ¶
NewResponsesWith returns a new responses with the specified responses.
func NewSelectCompleteResponsesWith ¶
NewSelectCompleteResponsesWith returns a new responses with the specified message.
func NewUpdateCompleteResponsesWith ¶
NewUpdateCompleteResponsesWith returns a new responses with the specified message.
func (Responses) HasErrorResponse ¶ added in v1.3.0
HasErrorResponse returns true whether this responses has an error response.
type RowDescription ¶
type RowDescription struct { *ResponseMessage // contains filtered or unexported fields }
RowDescription represents a row description message.
func NewRowDescription ¶
func NewRowDescription() *RowDescription
NewRowDescription returns a new row description message instance.
func (*RowDescription) AppendField ¶
func (msg *RowDescription) AppendField(field *RowField)
AppendField appends a field to the message.
func (*RowDescription) Bytes ¶
func (msg *RowDescription) Bytes() ([]byte, error)
Bytes appends a length of the message content bytes, and returns the message bytes.
func (*RowDescription) Field ¶ added in v1.0.0
func (msg *RowDescription) Field(n int) *RowField
Field returns a field at the specified index.
type RowField ¶
type RowField struct { Name string TableID int32 Number int16 ObjectID int32 DataTypeSize int16 TypeModifier int32 FormatCode int16 }
RowField represents a row description field.
func NewRowFieldWith ¶
func NewRowFieldWith(name string, opts ...RowFieldOption) *RowField
NewRowField returns a new row description field.
func (*RowField) WirteBytes ¶
WirteBytes appends a row field elements.
type RowFieldOption ¶
type RowFieldOption = func(*RowField)
RowFieldOption represents a row description field option.
type SSLRequest ¶ added in v1.0.1
type SSLRequest struct {
RequestCode int32
}
SSLRequest represents a SSLRequest message.
func NewSSLRequestWithReader ¶ added in v1.0.1
func NewSSLRequestWithReader(reader *MessageReader) (*SSLRequest, error)
NewSSLRequestWithReader returns a new SSLRequest message with the specified reader.
type SSLResponse ¶ added in v1.0.1
type SSLResponse struct {
Enabled byte
}
SSLResponse represents a SSLResponse message.
func NewSSLResponseWith ¶ added in v1.0.1
func NewSSLResponseWith(enabled rune) *SSLResponse
NewSSLResponse returns a new SSLResponse message.
func (*SSLResponse) Bytes ¶ added in v1.0.1
func (msg *SSLResponse) Bytes() ([]byte, error)
Bytes returns a byte array of the message.
func (*SSLResponse) Type ¶ added in v1.0.1
func (msg *SSLResponse) Type() Type
Type returns the message type.
type Startup ¶
type Startup struct { MajorVersion int MinorVersion int MessageLength int32 Parameters map[string]string }
Startup represents a startup message.
func NewStartupWithReader ¶
func NewStartupWithReader(reader *MessageReader) (*Startup, error)
NewStartupWithReader returns a new startup message with the specified reader.
func (*Startup) ApplicationName ¶
ApplicationName returns the application name.
func (*Startup) ClientEncoding ¶
ClientEncoding returns the client encoding.
type Sync ¶ added in v1.3.0
type Sync struct {
*RequestMessage
}
Sync represents a sync message.
func NewSyncWithReader ¶ added in v1.3.0
func NewSyncWithReader(reader *MessageReader) (*Sync, error)
NewSync returns a new sync message.
type Terminate ¶ added in v0.9.1
type Terminate struct {
*RequestMessage
}
Terminate represents a terminate message.
func NewTerminateWithReader ¶ added in v0.9.1
func NewTerminateWithReader(reader *MessageReader) (*Terminate, error)
NewTerminate returns a new terminate message.
type TransactionStatus ¶
type TransactionStatus = byte
TransactionStatus represents a transaction status.
type Type ¶
type Type byte
Type represents a message type.
const ( BindMessage Type = 'B' CancelRequestMessage Type = ' ' // Int32(16) CloseMessage Type = 'C' CopyFailMessage Type = 'f' DescribeMessage Type = 'D' ExecuteMessage Type = 'E' FlushMessage Type = 'H' FunctionCallMessage Type = 'F' GSSENCRequestMessage Type = ' ' // Int32(8) GSSResponseMessage Type = 'p' ParseMessage Type = 'P' PasswordMessage Type = 'p' QueryMessage Type = 'Q' SASLInitialResponseMessage Type = 'p' SASLResponseMessage Type = 'p' SSLRequestMessage Type = ' ' // Int32(8) SSLResponseMessage Type = ' ' StartupMessage Type = ' ' // Int32 SyncMessage Type = 'S' TerminateMessage Type = 'X' )
Frontend (F).
const ( AuthenticationOkMessage Type = 'R' AuthenticationKerberosV5Message Type = 'R' AuthenticationCleartextPasswordMessage Type = 'R' AuthenticationMD5PasswordMessage Type = 'R' AuthenticationGSSMessage Type = 'R' AuthenticationSSPIMessage Type = 'R' AuthenticationSASLMessage Type = 'R' AuthenticationSASLContinueMessage Type = 'R' AuthenticationSASLFinalMessage Type = 'R' BackendKeyDataMessage Type = 'K' BindCompleteMessage Type = '2' CloseCompleteMessage Type = '3' CommandCompleteMessage Type = 'C' CopyInResponseMessage Type = 'G' CopyOutResponseMessage Type = 'H' CopyBothResponseMessage Type = 'W' DataRowMessage Type = 'D' EmptyQueryResponseMessage Type = 'I' ErrorResponseMessage Type = 'E' FunctionCallResponseMessage Type = 'V' NegotiateProtocolVersionMessage Type = 'v' NoDataMessage Type = 'n' NoticeResponseMessage Type = 'N' NotificationResponseMessage Type = 'A' ParameterDescriptionMessage Type = 't' ParameterStatusMessage Type = 'S' ParseCompleteMessage Type = '1' PortalSuspendedMessage Type = 's' ReadyForQueryMessage Type = 'Z' RowDescriptionMessage Type = 'T' )
Backend (B).
type Writer ¶
Writer represents a message writer.
func (*Writer) AppendByte ¶
AppendByte appends the specified byte.
func (*Writer) AppendBytes ¶
AppendBytes appends the specified bytes.
func (*Writer) AppendFloat32 ¶
AppendFloat32 appends the specified float32 value.
func (*Writer) AppendFloat64 ¶
AppendFloat64 appends the specified float64 value.
func (*Writer) AppendInt16 ¶
AppendInt16 appends the specified int16 value.
func (*Writer) AppendInt32 ¶
AppendInt32 appends the specified int32 value.
func (*Writer) AppendInt64 ¶
AppendInt64 appends the specified int64 value.
func (*Writer) AppendInt8 ¶
AppendInt8 appends the specified int8 value.
func (*Writer) AppendString ¶
AppendString appends the specified string.
func (*Writer) AppendTerminator ¶
AppendTerminator appends a null terminator.
Source Files ¶
- authentication.go
- authentication_ok.go
- authentication_required.go
- backend_key_data.go
- bind.go
- bind_complete.go
- close.go
- close_complete.go
- command_complete.go
- copy_data.go
- copy_done.go
- copy_fail.go
- copy_in_response.go
- data_row.go
- data_type.go
- describe.go
- empty_query_response.go
- error_response.go
- errors.go
- execute.go
- flush.go
- format.go
- message.go
- message_reader.go
- no_data.go
- parameter_description.go
- parameter_status.go
- parse.go
- parse_complete.go
- password.go
- prepared.go
- query.go
- reader.go
- ready_for_query.go
- request_message.go
- response.go
- response_message.go
- responses.go
- row_description.go
- row_field.go
- ssl_request.go
- ssl_response.go
- startup.go
- sync.go
- terminate.go
- type.go
- writer.go