2
0

Allow types to specify preference format result and param formats

This will be useful for array and composite types that may have to
support elements that may not support binary encoding.

It also is slightly more convenient for text-ish types to have a default
format of text.
This commit is contained in:
Jack Christensen
2020-05-10 14:05:16 -05:00
parent cc4d1eafe0
commit 8cd94a14c7
8 changed files with 86 additions and 2 deletions
+8
View File
@@ -128,6 +128,10 @@ func (src *enumType) AssignTo(dst interface{}) error {
return errors.Errorf("cannot decode %#v into %T", src, dst)
}
func (enumType) PreferredResultFormat() int16 {
return TextFormatCode
}
func (dst *enumType) DecodeText(ci *ConnInfo, src []byte) error {
if src == nil {
dst.status = Null
@@ -152,6 +156,10 @@ func (dst *enumType) DecodeBinary(ci *ConnInfo, src []byte) error {
return dst.DecodeText(ci, src)
}
func (enumType) PreferredParamFormat() int16 {
return TextFormatCode
}
func (src enumType) EncodeText(ci *ConnInfo, buf []byte) ([]byte, error) {
switch src.status {
case Null: