message

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TextCopy represents a textual copy format.
	TextCopy = CopyFormat(0)
	// BinaryCopy represents a binary copy format.
	BinaryCopy = CopyFormat(1)
)
View Source
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
)
View Source
const (
	ApplicationName = "application_name"
	ClientEncoding  = "client_encoding"
	ServerEncoding  = "server_ encoding"
	DateStyle       = "DateStyle"
	TimeZone        = "TimeZone"
	IntervalStyle   = "IntervalStyle"
)
View Source
const (
	DefaultTransactiOnReadOnly = "default_transaction_read_only"
	InHotStandby               = "in_hot_standby"
	IsSuperuser                = "is_superuser"
	OntegerDatetimes           = "integer_datetimes"
)

on/off parameters.

View Source
const (
	ServerVersion             = "#server_version"
	StandardConformingStrings = "#standard_conforming_strings"
)
View Source
const (
	TransactionIdle   = 'I'
	TransactionBlock  = 'T'
	TransactionFailed = 'E'
)
View Source
const (
	SSLEnabled  = 'S'
	SSLDisabled = 'N'
)
View Source
const (
	StartUpUser            = "user"
	StartUpDatabase        = "database"
	StartUpApplicationName = "application_name"
	StartUpClientEncoding  = "client_encoding"
)
View Source
const (
	DateStyleISO = "ISO, MDY.S"
)
View Source
const (
	EncodingUTF8 = "UTF8"
)
View Source
const (
	NoneMessage = 0x00
)

Variables

View Source
var ErrExist = errors.New("exist")

ErrExist is returned when the specified object is exist.

View Source
var ErrInvalid = errors.New("invalid")

ErrInvalid is returned when the message is invalid.

View Source
var ErrNotExist = errors.New("not exist")

ErrNotExist is returned when the specified object is not exist.

View Source
var ErrNotSupported = errors.New("not supported")

ErrNotSupported is returned when the message is not supported.

Functions

func NewErrExist

func NewErrExist(v any) error

NewErrExist returns a new exist error.

func NewErrInvalidMessage added in v0.9.1

func NewErrInvalidMessage(t Type) error

NewErrInvalidMessage eturns a new message not supported error.

func NewErrMessageNotSuppoted

func NewErrMessageNotSuppoted(t Type) error

NewErrMessageNotSuppoted returns a new message not supported error.

func NewErrNotExist

func NewErrNotExist(v any) error

NewErrNotExist returns a new not exist error.

func WithDataTypeID

func WithDataTypeID(dataTypeID int32) func(*RowField)

WithDataTypeID sets a data type ID.

func WithDataTypeSize

func WithDataTypeSize(dataTypeSize int16) func(*RowField)

WithDataTypeSize sets a data type size.

func WithFormatCode

func WithFormatCode(formatCode int16) func(*RowField)

WithFormatCode sets a format code.

func WithNumber

func WithNumber(number int16) func(*RowField)

WithNumber sets a number.

func WithTableID

func WithTableID(tableID int32) func(*RowField)

WithTableID sets a table ID.

func WithTypeModifier

func WithTypeModifier(typeModifier int32) func(*RowField)

WithTypeModifier sets a type modifier.

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
	Portal    string
	Name      string
	NumParams int16
	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 BindParam

type BindParam struct {
	Type BindParamType

	Value any
	// contains filtered or unexported fields
}

BindParam represents a bind parameter.

type BindParamType

type BindParamType int16

BindParamType represents a bind parameter type.

const (
	// BindParamTypeString represents a string type.
	BindParamTypeString BindParamType = 0
	// BindParamTypeBinary represents a binary type.
	BindParamTypeBinary BindParamType = 1
)

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 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 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

type CopyFail struct {
	MessageLength int32
	Message       string
}

CopyFail represents a copy fail message.

func NewCopyFailWithReader added in v0.9.1

func NewCopyFailWithReader(reader *Reader) (*CopyFail, error)

NewCopyFailWithReader returns a new copy fail message with the specified reader.

type CopyFormat added in v0.9.1

type CopyFormat = int8

CopyFormat represents a copy format.

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 NewDataRow

func NewDataRow() *DataRow

NewDataRow returns a new data row message instance.

func (*DataRow) AppendData

func (msg *DataRow) AppendData(rowField *RowField, v any) error

AppendData appends a column value to the data row message.

func (*DataRow) Bytes

func (msg *DataRow) Bytes() ([]byte, error)

Bytes appends a length of the message content bytes, and returns the message bytes.

type DataType added in v1.0.0

type DataType = system.DataType

DataType represents a data type.

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 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

func (msg *Message) MessageDataLength() int32

MessageLength returns a message data length without the message header.

func (*Message) MessageLength added in v0.9.1

func (msg *Message) MessageLength() int32

MessageLength returns a message length.

func (*Message) MessageType added in v0.9.1

func (msg *Message) MessageType() Type

MessageType returns a message type.

func (*Message) ReadMessageData added in v0.9.1

func (msg *Message) ReadMessageData() ([]byte, error)

ReadMessageData reads all message data.

type MessageReader added in v0.9.1

type MessageReader struct {
	*Reader
	Type   Type
	Length int32
}

func NewMessageReaderWith added in v0.9.1

func NewMessageReaderWith(reader *bufio.Reader) *MessageReader

func (*MessageReader) PeekType added in v0.9.1

func (reader *MessageReader) PeekType() (Type, error)

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 NoData

type NoData struct {
	*ResponseMessage
}

NoData represents a no data message.

func NewNoData

func NewNoData() *NoData

NewNoData returns a new no data message instance.

type OID added in v1.0.2

type OID = system.OID

OID represents a object identifier.

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 Query

type Query struct {
	*RequestMessage
	Query string
	BindParams
}

Query represents a parse message.

func NewQueryWith

func NewQueryWith(parseMsg *Parse, bindMsg *Bind) (*Query, error)

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

type Reader struct {
	*bufio.Reader
}

Reader represents a message reader.

func NewReaderWith

func NewReaderWith(reader *bufio.Reader) *Reader

NewReader returns a new message reader.

func (*Reader) PeekInt32 added in v1.0.1

func (reader *Reader) PeekInt32() (int32, error)

PeekInt32 reads a 32-bit integer.

func (*Reader) ReadBytes added in v0.9.1

func (reader *Reader) ReadBytes(buf []byte) (int, error)

ReadByte reads a byte array data into the specified buffer.

func (*Reader) ReadInt16

func (reader *Reader) ReadInt16() (int16, error)

ReadInt16 reads a 16-bit integer.

func (*Reader) ReadInt32

func (reader *Reader) ReadInt32() (int32, error)

ReadInt32 reads a 32-bit integer.

func (*Reader) ReadString

func (reader *Reader) ReadString() (string, error)

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 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

func NewCommandCompleteResponsesWith(msg string) (Responses, error)

NewCommandCompleteResponsesWith returns a new responses with the specified message.

func NewCopyCompleteResponsesWith added in v0.9.1

func NewCopyCompleteResponsesWith(n int) (Responses, error)

NewCopyCompleteResponsesWith returns a new responses with the specified message.

func NewDeleteCompleteResponsesWith

func NewDeleteCompleteResponsesWith(n int) (Responses, error)

NewDeleteCompleteResponsesWith returns a new responses with the specified message.

func NewInsertCompleteResponsesWith

func NewInsertCompleteResponsesWith(n int) (Responses, error)

NewInsertCompleteResponsesWith returns a new responses with the specified message.

func NewParameterStatusesWith added in v1.0.1

func NewParameterStatusesWith(m map[string]string) (Responses, error)

NewParameterStatusesWith returns parameter status response instances with the specified parameter statuses.

func NewResponses

func NewResponses() Responses

NewResponses returns a new empty responses.

func NewResponsesWith

func NewResponsesWith(responses ...Response) Responses

NewResponsesWith returns a new responses with the specified responses.

func NewSelectCompleteResponsesWith

func NewSelectCompleteResponsesWith(n int) (Responses, error)

NewSelectCompleteResponsesWith returns a new responses with the specified message.

func NewUpdateCompleteResponsesWith

func NewUpdateCompleteResponsesWith(n int) (Responses, error)

NewUpdateCompleteResponsesWith returns a new responses with the specified message.

func (Responses) Append

func (responses Responses) Append(res Response) Responses

Append appends the specified response to this responses.

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
	DataTypeID   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

func (field *RowField) WirteBytes(w *Writer) error

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

func (msg *Startup) ApplicationName() (string, bool)

ApplicationName returns the application name.

func (*Startup) ClientEncoding

func (msg *Startup) ClientEncoding() (string, bool)

ClientEncoding returns the client encoding.

func (*Startup) Database

func (msg *Startup) Database() (string, bool)

Database returns the database name.

func (*Startup) User

func (msg *Startup) User() (string, bool)

User returns the user name.

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).

const (
	CopyDataMessage Type = 'd'
	CopyDoneMessage Type = 'c'
)

Both (F & B).

func (Type) String added in v0.9.1

func (t Type) String() string

type Writer

type Writer struct {
	*bytes.Buffer
	*bufio.Writer
}

Writer represents a message writer.

func NewWriter

func NewWriter() *Writer

NewWriter returns a new message writer.

func (*Writer) AppendByte

func (writer *Writer) AppendByte(c byte) error

AppendByte appends the specified byte.

func (*Writer) AppendBytes

func (writer *Writer) AppendBytes(p []byte) error

AppendBytes appends the specified bytes.

func (*Writer) AppendFloat32

func (writer *Writer) AppendFloat32(v float32) error

AppendFloat32 appends the specified float32 value.

func (*Writer) AppendFloat64

func (writer *Writer) AppendFloat64(v float64) error

AppendFloat64 appends the specified float64 value.

func (*Writer) AppendInt16

func (writer *Writer) AppendInt16(v int16) error

AppendInt16 appends the specified int16 value.

func (*Writer) AppendInt32

func (writer *Writer) AppendInt32(v int32) error

AppendInt32 appends the specified int32 value.

func (*Writer) AppendInt64

func (writer *Writer) AppendInt64(v int64) error

AppendInt64 appends the specified int64 value.

func (*Writer) AppendInt8

func (writer *Writer) AppendInt8(v int8) error

AppendInt8 appends the specified int8 value.

func (*Writer) AppendString

func (writer *Writer) AppendString(s string) error

AppendString appends the specified string.

func (*Writer) AppendTerminator

func (writer *Writer) AppendTerminator() error

AppendTerminator appends a null terminator.

func (*Writer) Bytes

func (writer *Writer) Bytes() ([]byte, error)

Bytes returns the message bytes.

Jump to

Keyboard shortcuts

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