A Codec converts between Go and PostgreSQL values. A Codec must not be mutated after it is registered with a [Map].
| 158 | |
| 159 | // A Codec converts between Go and PostgreSQL values. A Codec must not be mutated after it is registered with a [Map]. |
| 160 | type Codec interface { |
| 161 | // FormatSupported returns true if the format is supported. |
| 162 | FormatSupported(int16) bool |
| 163 | |
| 164 | // PreferredFormat returns the preferred format. |
| 165 | PreferredFormat() int16 |
| 166 | |
| 167 | // PlanEncode returns an EncodePlan for encoding value into PostgreSQL format for oid and format. If no plan can be |
| 168 | // found then nil is returned. |
| 169 | PlanEncode(m *Map, oid uint32, format int16, value any) EncodePlan |
| 170 | |
| 171 | // PlanScan returns a ScanPlan for scanning a PostgreSQL value into a destination with the same type as target. If |
| 172 | // no plan can be found then nil is returned. |
| 173 | PlanScan(m *Map, oid uint32, format int16, target any) ScanPlan |
| 174 | |
| 175 | // DecodeDatabaseSQLValue returns src decoded into a value compatible with the sql.Scanner interface. |
| 176 | DecodeDatabaseSQLValue(m *Map, oid uint32, format int16, src []byte) (driver.Value, error) |
| 177 | |
| 178 | // DecodeValue returns src decoded into its default format. |
| 179 | DecodeValue(m *Map, oid uint32, format int16, src []byte) (any, error) |
| 180 | } |
| 181 | |
| 182 | type nullAssignmentError struct { |
| 183 | dst any |
no outgoing calls
no test coverage detected