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

Function boolExplicit

server/cast/bool.go:34–46  ·  view source on GitHub ↗

boolExplicit registers all explicit casts. This comprises only the source types.

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

Source from the content-addressed store, hash-verified

32
33// boolExplicit registers all explicit casts. This comprises only the source types.
34func boolExplicit(builtInCasts map[id.Cast]casts.Cast) {
35 framework.MustAddExplicitTypeCast(builtInCasts, framework.TypeCast{
36 FromType: pgtypes.Bool,
37 ToType: pgtypes.Int32,
38 Function: func(ctx *sql.Context, val any, _, targetType *pgtypes.DoltgresType) (any, error) {
39 if val.(bool) {
40 return int32(1), nil
41 } else {
42 return int32(0), nil
43 }
44 },
45 })
46}
47
48// boolAssignment registers all assignment casts. This comprises only the source types.
49func boolAssignment(builtInCasts map[id.Cast]casts.Cast) {

Callers 1

initBoolFunction · 0.85

Calls 1

MustAddExplicitTypeCastFunction · 0.92

Tested by

no test coverage detected