boolExplicit registers all explicit casts. This comprises only the source types.
(builtInCasts map[id.Cast]casts.Cast)
| 32 | |
| 33 | // boolExplicit registers all explicit casts. This comprises only the source types. |
| 34 | func 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. |
| 49 | func boolAssignment(builtInCasts map[id.Cast]casts.Cast) { |
no test coverage detected