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

Method RegisterType

pgtype/pgtype.go:273–283  ·  pgtype/pgtype.go::Map.RegisterType

RegisterType registers a data type with the [Map]. t must not be mutated after it is registered.

(t *Type)

Source from the content-addressed store, hash-verified

271
272// RegisterType registers a data type with the [Map]. t must not be mutated after it is registered.
273func (m *Map) RegisterType(t *Type) {
274 m.oidToType[t.OID] = t
275 m.nameToType[t.Name] = t
276 m.oidToFormatCode[t.OID] = t.Codec.PreferredFormat()
277
278 // Invalidated by type registration
279 m.reflectTypeToType = nil
280 for k := range m.memoizedEncodePlans {
281 delete(m.memoizedEncodePlans, k)
282 }
283}
284
285// RegisterDefaultPgType registers a mapping of a Go type to a PostgreSQL type name. Typically the data type to be
286// encoded or decoded is determined by the PostgreSQL OID. But if the OID of a value to be encoded or decoded is

Callers 15

CopyMethod · 0.95
RegisterTypesMethod · 0.95
TestDomainTypeFunction · 0.80
TestLoadRangeTypeFunction · 0.80
TestLoadMultiRangeTypeFunction · 0.80
LoadTypesMethod · 0.80
TestConnCopyFromEnumFunction · 0.80
tsvectorConnTestRunnerFunction · 0.80

Calls 1

PreferredFormatMethod · 0.65