frame

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeAuthRequest          = 'R'
	TypeParameterStatus      = 'S'
	TypeBackendKeyData       = 'K'
	TypeReadyForQuery        = 'Z'
	TypeParseCompletion      = '1'
	TypeParameterDescription = 't'
	TypeRowDescription       = 'T'
	TypeDataRow              = 'D'
	TypeCommandCompletion    = 'C'
	TypeError                = 'E'
	TypeNotification         = 'A'
	TypeCloseComplete        = '3'
	TypeEmptyQueryResponse   = 'I'
	TypeNoData               = 'n'
	TypeNoticeResponse       = 'N'
)
View Source
const (
	TransactionStatusNoReady             = 'N'
	TransactionStatusIdle                = 'I'
	TransactionStatusIdleInTransaction   = 'T'
	TransactionStatusInFailedTransaction = 'E'
)
View Source
const (
	PgTypeBool             = 16
	PgTypeBytea            = 17
	PgTypeChar             = 18
	PgTypeName             = 19
	PgTypeInt8             = 20
	PgTypeInt2             = 21
	PgTypeInt2vector       = 22
	PgTypeInt4             = 23
	PgTypeRegproc          = 24
	PgTypeText             = 25
	PgTypeOid              = 26
	PgTypeTid              = 27
	PgTypeXid              = 28
	PgTypeCid              = 29
	PgTypeOidvector        = 30
	PgTypePgDdlCommand     = 32
	PgTypePgType           = 71
	PgTypePgAttribute      = 75
	PgTypePgProc           = 81
	PgTypePgClass          = 83
	PgTypeJson             = 114
	PgTypeXml              = 142
	PgTypeArrXml           = 143
	PgTypePgNodeTree       = 194
	PgTypeArrJson          = 199
	PgTypeSmgr             = 210
	PgTypeIndexAmHandler   = 325
	PgTypePoint            = 600
	PgTypeLseg             = 601
	PgTypePath             = 602
	PgTypeBox              = 603
	PgTypePolygon          = 604
	PgTypeLine             = 628
	PgTypeArrLine          = 629
	PgTypeCidr             = 650
	PgTypeArrCidr          = 651
	PgTypeFloat4           = 700
	PgTypeFloat8           = 701
	PgTypeAbstime          = 702
	PgTypeReltime          = 703
	PgTypeTinterval        = 704
	PgTypeUnknown          = 705
	PgTypeCircle           = 718
	PgTypeArrCircle        = 719
	PgTypeMacaddr8         = 774
	PgTypeArrMacaddr8      = 775
	PgTypeMoney            = 790
	PgTypeArrMoney         = 791
	PgTypeMacaddr          = 829
	PgTypeInet             = 869
	PgTypeArrBool          = 1000
	PgTypeArrBytea         = 1001
	PgTypeArrChar          = 1002
	PgTypeArrName          = 1003
	PgTypeArrInt2          = 1005
	PgTypeArrInt2vector    = 1006
	PgTypeArrInt4          = 1007
	PgTypeArrRegproc       = 1008
	PgTypeArrText          = 1009
	PgTypeArrTid           = 1010
	PgTypeArrXid           = 1011
	PgTypeArrCid           = 1012
	PgTypeArrOidvector     = 1013
	PgTypeArrBpchar        = 1014
	PgTypeArrVarchar       = 1015
	PgTypeArrInt8          = 1016
	PgTypeArrPoint         = 1017
	PgTypeArrLseg          = 1018
	PgTypeArrPath          = 1019
	PgTypeArrBox           = 1020
	PgTypeArrFloat4        = 1021
	PgTypeArrFloat8        = 1022
	PgTypeArrAbstime       = 1023
	PgTypeArrReltime       = 1024
	PgTypeArrTinterval     = 1025
	PgTypeArrPolygon       = 1027
	PgTypeArrOid           = 1028
	PgTypeAclitem          = 1033
	PgTypeArrAclitem       = 1034
	PgTypeArrMacaddr       = 1040
	PgTypeArrInet          = 1041
	PgTypeBpchar           = 1042
	PgTypeVarchar          = 1043
	PgTypeDate             = 1082
	PgTypeTime             = 1083
	PgTypeTimestamp        = 1114
	PgTypeArrTimestamp     = 1115
	PgTypeArrDate          = 1182
	PgTypeArrTime          = 1183
	PgTypeTimestamptz      = 1184
	PgTypeArrTimestamptz   = 1185
	PgTypeInterval         = 1186
	PgTypeArrInterval      = 1187
	PgTypeArrNumeric       = 1231
	PgTypePgDatabase       = 1248
	PgTypeArrCstring       = 1263
	PgTypeTimetz           = 1266
	PgTypeArrTimetz        = 1270
	PgTypeBit              = 1560
	PgTypeArrBit           = 1561
	PgTypeVarbit           = 1562
	PgTypeArrVarbit        = 1563
	PgTypeNumeric          = 1700
	PgTypeRefcursor        = 1790
	PgTypeArrRefcursor     = 2201
	PgTypeRegprocedure     = 2202
	PgTypeRegoper          = 2203
	PgTypeRegoperator      = 2204
	PgTypeRegclass         = 2205
	PgTypeRegtype          = 2206
	PgTypeArrRegprocedure  = 2207
	PgTypeArrRegoper       = 2208
	PgTypeArrRegoperator   = 2209
	PgTypeArrRegclass      = 2210
	PgTypeArrRegtype       = 2211
	PgTypeRecord           = 2249
	PgTypeCstring          = 2275
	PgTypeAny              = 2276
	PgTypeAnyarray         = 2277
	PgTypeVoid             = 2278
	PgTypeTrigger          = 2279
	PgTypeLanguageHandler  = 2280
	PgTypeInternal         = 2281
	PgTypeOpaque           = 2282
	PgTypeAnyelement       = 2283
	PgTypeArrRecord        = 2287
	PgTypeAnynonarray      = 2776
	PgTypePgAuthid         = 2842
	PgTypePgAuthMembers    = 2843
	PgTypeArrTxidSnapshot  = 2949
	PgTypeUuid             = 2950
	PgTypeArrUuid          = 2951
	PgTypeTxidSnapshot     = 2970
	PgTypeFdwHandler       = 3115
	PgTypePgLsn            = 3220
	PgTypeArrPgLsn         = 3221
	PgTypeTsmHandler       = 3310
	PgTypePgNdistinct      = 3361
	PgTypePgDependencies   = 3402
	PgTypeAnyenum          = 3500
	PgTypeTsvector         = 3614
	PgTypeTsquery          = 3615
	PgTypeGtsvector        = 3642
	PgTypeArrTsvector      = 3643
	PgTypeArrGtsvector     = 3644
	PgTypeArrTsquery       = 3645
	PgTypeRegconfig        = 3734
	PgTypeArrRegconfig     = 3735
	PgTypeRegdictionary    = 3769
	PgTypeArrRegdictionary = 3770
	PgTypeJsonb            = 3802
	PgTypeArrJsonb         = 3807
	PgTypeAnyrange         = 3831
	PgTypeEventTrigger     = 3838
	PgTypeInt4range        = 3904
	PgTypeArrInt4range     = 3905
	PgTypeNumrange         = 3906
	PgTypeArrNumrange      = 3907
	PgTypeTsrange          = 3908
	PgTypeArrTsrange       = 3909
	PgTypeTstzrange        = 3910
	PgTypeArrTstzrange     = 3911
	PgTypeDaterange        = 3912
	PgTypeArrDaterange     = 3913
	PgTypeInt8range        = 3926
	PgTypeArrInt8range     = 3927
	PgTypePgShseclabel     = 4066
	PgTypeRegnamespace     = 4089
	PgTypeArrRegnamespace  = 4090
	PgTypeRegrole          = 4096
	PgTypeArrRegrole       = 4097
	PgTypePgSubscription   = 6101
)
View Source
const (
	AuthTypeOk              uint32 = 0
	AuthTypePwd             uint32 = 3
	AuthTypeMd5             uint32 = 5
	AuthTypeSASL            uint32 = 10
	AuthTypeSASLContinue    uint32 = 11
	AuthSASLSCRAMSHA256     string = "SCRAM-SHA-256"
	AuthSASLSCRAMSHA256PLUS string = "SCRAM-SHA-256-PLUS"
)
View Source
const (
	CopyFormatText   uint8 = 0
	CopyFormatBinary uint8 = 1
)

Variables

View Source
var PgTypeMap = map[PgType]string{}/* 172 elements not displayed */

Functions

This section is empty.

Types

type AuthRequest

type AuthRequest struct {
	*Data
}

func (*AuthRequest) GetMd5Salt

func (ar *AuthRequest) GetMd5Salt() []byte

func (*AuthRequest) GetSASLAuthData

func (ar *AuthRequest) GetSASLAuthData() []byte

func (*AuthRequest) GetSASLAuthMechanism

func (ar *AuthRequest) GetSASLAuthMechanism() string

func (*AuthRequest) GetType

func (ar *AuthRequest) GetType() uint32

type AuthResponse

type AuthResponse struct {
	*Data
}

func NewAuthResponse

func NewAuthResponse() *AuthResponse

func (*AuthResponse) Md5Pwd

func (ar *AuthResponse) Md5Pwd(user, pwd, salt string)

func (*AuthResponse) Password

func (ar *AuthResponse) Password(str string)

type AuthSASLInitialResponse

type AuthSASLInitialResponse struct {
	*Data
}

func NewAuthSASLInitialResponse

func NewAuthSASLInitialResponse() *AuthSASLInitialResponse

func (*AuthSASLInitialResponse) AuthResponse

func (ar *AuthSASLInitialResponse) AuthResponse(str string)

func (*AuthSASLInitialResponse) Mechanism

func (ar *AuthSASLInitialResponse) Mechanism(str string)

type AuthSASLResponse

type AuthSASLResponse struct {
	*Data
}

func NewAuthSASLResponse

func NewAuthSASLResponse() *AuthSASLResponse

func (*AuthSASLResponse) AuthResponse

func (ar *AuthSASLResponse) AuthResponse(raw []byte)

type BackendKeyData

type BackendKeyData struct {
	*Data
	Pid uint32
	Key uint32
}

func (*BackendKeyData) Decode

func (bkd *BackendKeyData) Decode()

type BindCompletion

type BindCompletion struct {
	*Data
}

type CloseComplete

type CloseComplete struct {
	*Data
}

type Column

type Column struct {
	Name         string
	TableOid     uint32
	Index        uint16
	TypeOid      uint32
	Length       uint16
	TypeModifier uint32
	Format       uint16
}

type CommandCompletion

type CommandCompletion struct {
	*Data
}

func (*CommandCompletion) Affected

func (cc *CommandCompletion) Affected() (n int)

type CopyCompletion

type CopyCompletion struct {
	*Data
}

type CopyData

type CopyData struct {
	*Data
}

type CopyFail

type CopyFail struct {
	*Data
}

type CopyFormat

type CopyFormat uint8

type CopyInResponse

type CopyInResponse struct {
	*Data
	Format       CopyFormat
	ColumnLength uint16
}

func (*CopyInResponse) Decode

func (cir *CopyInResponse) Decode()

type CopyOutResponse

type CopyOutResponse struct {
	*Data
	Format        CopyFormat
	ColumnLength  uint16
	ColumnFormats []CopyFormat
}

func (*CopyOutResponse) Decode

func (cor *CopyOutResponse) Decode()

type Data

type Data struct {
	Name byte
	// contains filtered or unexported fields
}

func NewBind

func NewBind(stat string, args []driver.Value) *Data

func NewCancelRequest

func NewCancelRequest(pid, key uint32) *Data

func NewCloseStat

func NewCloseStat(stat string) *Data

func NewDescribe

func NewDescribe(stat string) *Data

func NewExecute

func NewExecute() *Data

func NewFlush

func NewFlush() *Data

func NewParse

func NewParse(sid, query string) *Data

func NewSSLRequest

func NewSSLRequest() *Data

func NewSimpleQuery

func NewSimpleQuery(stat string) *Data

func NewSync

func NewSync() *Data

func NewTermination

func NewTermination() *Data

func (*Data) Length

func (f *Data) Length() uint32

func (*Data) Payload

func (f *Data) Payload() []byte

func (*Data) Type

func (f *Data) Type() byte

func (*Data) WriteUint8

func (f *Data) WriteUint8(uint uint8)

type DataRow

type DataRow struct {
	*Data
	Count   uint16
	DataArr [][]byte
}

func (*DataRow) Decode

func (dr *DataRow) Decode()

type Decoder

type Decoder struct {
	*bufio.Reader
}

func NewDecoder

func NewDecoder(c net.Conn) *Decoder

func (*Decoder) Receive

func (d *Decoder) Receive() (data *Data, err error)

type EmptyQueryResponse

type EmptyQueryResponse struct {
	*Data
}

type Encoder

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

func NewEncoder

func NewEncoder(c net.Conn) *Encoder

func (*Encoder) Buff

func (e *Encoder) Buff(f *Data) (err error)

func (*Encoder) Flush

func (e *Encoder) Flush() (err error)

func (*Encoder) Send

func (e *Encoder) Send(f *Data) (err error)

type Error

type Error struct {
	*Data
	Error PgError
}

func (*Error) Decode

func (e *Error) Decode()

func (*Error) String

func (e *Error) String() string

type Frame

type Frame interface {
	Type() byte
	Length() uint32
	Payload() []byte
}

type NoData

type NoData struct {
	*Data
}

type NoticeResponse

type NoticeResponse struct {
	Error
}

func (NoticeResponse) Log

func (nr NoticeResponse) Log()

type Notification

type Notification struct {
	*Data
	Pid       uint32
	Condition string
	Text      string
}

func (*Notification) Decode

func (n *Notification) Decode()

type ParameterDescription

type ParameterDescription struct {
	*Data
	Count    uint16
	TypeOIDs []uint32
}

func (*ParameterDescription) Decode

func (pd *ParameterDescription) Decode()

type ParameterStatus

type ParameterStatus struct {
	*Data
	Name  string
	Value string
}

func (*ParameterStatus) Decode

func (ps *ParameterStatus) Decode()

type ParseCompletion

type ParseCompletion struct {
	*Data
}

type PgError

type PgError struct {
	LocalError       string `json:"local_error,omitempty"`
	Fail             string `json:"error,omitempty"`
	Code             string `json:"code,omitempty"`
	Message          string `json:"message,omitempty"`
	Detail           string `json:"detail,omitempty"`
	Hint             string `json:"hint,omitempty"`
	Position         string `json:"position,omitempty"`
	InternalPosition string `json:"internal_position,omitempty"`
	InternalQuery    string `json:"internal_query,omitempty"`
	Where            string `json:"where,omitempty"`
	Schema           string `json:"schema,omitempty"`
	Table            string `json:"table,omitempty"`
	Column           string `json:"Column,omitempty"`
	DateType         string `json:"date_type,omitempty"`
	Constraint       string `json:"constraint,omitempty"`
	File             string `json:"file,omitempty"`
	Line             string `json:"line,omitempty"`
	Routine          string `json:"routine,omitempty"`
}

func (PgError) Error

func (e PgError) Error() string

type PgType

type PgType uint32

type ReadyForQuery

type ReadyForQuery struct {
	*Data
}

type RowDescription

type RowDescription struct {
	*Data
	Count   uint16
	Columns []Column
}

func (*RowDescription) Decode

func (rd *RowDescription) Decode()

type SSLRequest

type SSLRequest Data

type Startup

type Startup struct {
	*Data
}

func NewStartup

func NewStartup() *Startup

func (*Startup) AddParam

func (sf *Startup) AddParam(name, value string)

type TransactionStatus

type TransactionStatus byte

type Type

type Type byte

Jump to

Keyboard shortcuts

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