MCPcopy Create free account
hub / github.com/dolthub/doltgresql / regclassAssignment

Function regclassAssignment

server/cast/regclass.go:33–48  ·  view source on GitHub ↗

regclassAssignment registers all assignment casts. This comprises only the source types.

(builtInCasts map[id.Cast]casts.Cast)

Source from the content-addressed store, hash-verified

31
32// regclassAssignment registers all assignment casts. This comprises only the source types.
33func regclassAssignment(builtInCasts map[id.Cast]casts.Cast) {
34 framework.MustAddAssignmentTypeCast(builtInCasts, framework.TypeCast{
35 FromType: pgtypes.Regclass,
36 ToType: pgtypes.Int32,
37 Function: func(ctx *sql.Context, val any, _, targetType *pgtypes.DoltgresType) (any, error) {
38 return int32(id.Cache().ToOID(val.(id.Id))), nil
39 },
40 })
41 framework.MustAddAssignmentTypeCast(builtInCasts, framework.TypeCast{
42 FromType: pgtypes.Regclass,
43 ToType: pgtypes.Int64,
44 Function: func(ctx *sql.Context, val any, _, targetType *pgtypes.DoltgresType) (any, error) {
45 return int64(id.Cache().ToOID(val.(id.Id))), nil
46 },
47 })
48}
49
50// regclassImplicit registers all implicit casts. This comprises only the source types.
51func regclassImplicit(builtInCasts map[id.Cast]casts.Cast) {

Callers 1

initRegclassFunction · 0.85

Calls 3

CacheFunction · 0.92
ToOIDMethod · 0.80

Tested by

no test coverage detected