You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not sure if this is on purpose or was just an oversight (if it is purpose please feel free to close this), but EnumArray does not implement ValueTranscoder so users must implement their own custom type with func's EncodeText and DecodeText utilizing EnumArray::DecodeText and EnumArray::EncodeText under the hood. This makes it much more difficult to do binary encoding/decoding (user's must fully implement everything for their custom types) or register data types in pgx simply using a line like: conn.ConnInfo().RegisterDataType(pgtype.DataType{Value: pgtype.NewArrayType("pg_enum_typname", 1234, func() pgtype.ValueTranscoder { return &pgtype.EnumArray{} }), Name: "pg_enum_typname", OID: oid})
The text was updated successfully, but these errors were encountered:
Ahh, that makes sense. So the ValueTranscoder is meant to operate on a singular element of the array vs the entire array. Unfortunately it looks like GenericText can't be used directly as a ValueTranscoder as it also doesn't implement the binary format.
Not sure if this is on purpose or was just an oversight (if it is purpose please feel free to close this), but
EnumArray
does not implementValueTranscoder
so users must implement their own custom type with func'sEncodeText
andDecodeText
utilizingEnumArray::DecodeText
andEnumArray::EncodeText
under the hood. This makes it much more difficult to do binary encoding/decoding (user's must fully implement everything for their custom types) or register data types inpgx
simply using a line like:conn.ConnInfo().RegisterDataType(pgtype.DataType{Value: pgtype.NewArrayType("pg_enum_typname", 1234, func() pgtype.ValueTranscoder { return &pgtype.EnumArray{} }), Name: "pg_enum_typname", OID: oid})
The text was updated successfully, but these errors were encountered: