convert
Runs a value through the first converter that claims it.
Where the target OID was not known and the converter named a default type for the value, the result is wrapped in PgTyped so the type reaches the server with it.
A value nothing claims is returned untouched — correct for a scalar the codec already accepts. Where the target OID is known and its codec cannot accept that class, nothing downstream can either, so this fails here rather than one layer down as an encoding error: failing at this point is what keeps the attribute name or element index in the exception's path, since by the time the codec runs the structure the value sat in is gone.
Return
A value a registered codec can encode.
Parameters
The value being sent.
The OID the server expects, or 0 when it is not known.
Passed on to the converters.
Throws
NO_CONVERTER_FOUND if nothing claims the value and the codec bound to expectedOid cannot accept its class.