Add EncodeText support for CompositeType

non-blocking
Jack Christensen 2020-05-12 15:45:16 -05:00
parent e45ef46424
commit eebc6975de
1 changed files with 16 additions and 0 deletions

View File

@ -198,6 +198,22 @@ func (dst *CompositeType) DecodeText(ci *ConnInfo, buf []byte) error {
return nil
}
func (src CompositeType) EncodeText(ci *ConnInfo, buf []byte) (newBuf []byte, err error) {
switch src.status {
case Null:
return nil, nil
case Undefined:
return nil, errUndefined
}
b := NewCompositeTextBuilder(ci, buf)
for _, f := range src.fields {
b.AppendEncoder(f)
}
return b.Finish()
}
type CompositeBinaryScanner struct {
ci *ConnInfo
rp int