MCPcopy
hub / github.com/jackc/pgx / Codec

Interface Codec

pgtype/pgtype.go:160–180  ·  pgtype/pgtype.go::Codec

A Codec converts between Go and PostgreSQL values. A Codec must not be mutated after it is registered with a [Map].

Source from the content-addressed store, hash-verified

158
159// A Codec converts between Go and PostgreSQL values. A Codec must not be mutated after it is registered with a [Map].
160type 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
182type nullAssignmentError struct {
183 dst any

Callers 30

FormatSupportedMethod · 0.65
FormatSupportedMethod · 0.65
FormatSupportedMethod · 0.65
FormatSupportedMethod · 0.65
FormatSupportedMethod · 0.65
PreferredFormatMethod · 0.65
PreferredFormatMethod · 0.65
RegisterTypeMethod · 0.65
ValueMethod · 0.65
ValueMethod · 0.65
ValueMethod · 0.65
PlanEncodeMethod · 0.65

Implementers 15

ByteaCodecpgtype/bytea.go
Float8Codecpgtype/float8.go
BoolCodecpgtype/bool.go
DateCodecpgtype/date.go
BitsCodecpgtype/bits.go
NumericCodecpgtype/numeric.go
HstoreCodecpgtype/hstore.go
TimestampCodecpgtype/timestamp.go
MacaddrCodecpgtype/macaddr.go
Int2Codecpgtype/int.go
Int4Codecpgtype/int.go
Int8Codecpgtype/int.go

Calls

no outgoing calls

Tested by

no test coverage detected