encode method
Implementation
Future<EncodedValue?> encode(TypedValue input, CodecContext context) async {
// check for codec
final typeOid = input.type.oid;
final codec = typeOid == null ? null : _codecs[typeOid];
if (codec != null) {
final r = await codec.encode(input, context);
if (r != null) {
return r;
}
}
// fallback encoders
for (final encoder in _encoders) {
final encoded = await encoder(input, context);
if (encoded != null) {
return encoded;
}
}
throw PgException("Could not infer type of value '${input.value}'.");
}