Source File
parse.go
Belonging Package
github.com/jackc/pgproto3/v2
func (*Parse) () {}
func ( *Parse) ( []byte) error {
* = Parse{}
:= bytes.NewBuffer()
, := .ReadBytes(0)
if != nil {
return
}
.Name = string([:len()-1])
, = .ReadBytes(0)
if != nil {
return
}
.Query = string([:len()-1])
if .Len() < 2 {
return &invalidMessageFormatErr{messageType: "Parse"}
}
:= int(binary.BigEndian.Uint16(.Next(2)))
for := 0; < ; ++ {
if .Len() < 4 {
return &invalidMessageFormatErr{messageType: "Parse"}
}
.ParameterOIDs = append(.ParameterOIDs, binary.BigEndian.Uint32(.Next(4)))
}
return nil
}
func ( *Parse) ( []byte) []byte {
= append(, 'P')
:= len()
= pgio.AppendInt32(, -1)
= append(, .Name...)
= append(, 0)
= append(, .Query...)
= append(, 0)
= pgio.AppendUint16(, uint16(len(.ParameterOIDs)))
for , := range .ParameterOIDs {
= pgio.AppendUint32(, )
}
pgio.SetInt32([:], int32(len([:])))
return
}
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |