Source File
data_row.go
Belonging Package
github.com/jackc/pgproto3/v2
func (*DataRow) () {}
func ( *DataRow) ( []byte) error {
if len() < 2 {
return &invalidMessageFormatErr{messageType: "DataRow"}
}
:= 0
:= int(binary.BigEndian.Uint16([:]))
+= 2
if == -1 {
.Values[] = nil
} else {
if len([:]) < {
return &invalidMessageFormatErr{messageType: "DataRow"}
}
.Values[] = [ : + : +]
+=
}
}
return nil
}
func ( *DataRow) ( []byte) []byte {
= append(, 'D')
:= len()
= pgio.AppendInt32(, -1)
= pgio.AppendUint16(, uint16(len(.Values)))
for , := range .Values {
if == nil {
= pgio.AppendInt32(, -1)
continue
}
= pgio.AppendInt32(, int32(len()))
= append(, ...)
}
pgio.SetInt32([:], int32(len([:])))
return
}
func ( DataRow) () ([]byte, error) {
:= make([]map[string]string, len(.Values))
for , := range .Values {
if == nil {
continue
}
var bool
for , := range {
if < 32 {
= true
break
}
}
if {
[] = map[string]string{"binary": hex.EncodeToString()}
} else {
[] = map[string]string{"text": string()}
}
}
return json.Marshal(struct {
string
[]map[string]string
}{
: "DataRow",
: ,
})
![]() |
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. |