intervalAssignment registers all assignment casts. This comprises only the source types.
(builtInCasts map[id.Cast]casts.Cast)
| 34 | |
| 35 | // intervalAssignment registers all assignment casts. This comprises only the source types. |
| 36 | func intervalAssignment(builtInCasts map[id.Cast]casts.Cast) { |
| 37 | framework.MustAddAssignmentTypeCast(builtInCasts, framework.TypeCast{ |
| 38 | FromType: pgtypes.Interval, |
| 39 | ToType: pgtypes.Time, |
| 40 | Function: func(ctx *sql.Context, val any, _, targetType *pgtypes.DoltgresType) (any, error) { |
| 41 | dur := val.(duration.Duration) |
| 42 | // the month and day of the duration are excluded |
| 43 | return timeofday.FromInt(dur.Nanos() / functions.NanosPerMicro), nil |
| 44 | }, |
| 45 | }) |
| 46 | } |
| 47 | |
| 48 | // intervalImplicit registers all implicit casts. This comprises only the source types. |
| 49 | func intervalImplicit(builtInCasts map[id.Cast]casts.Cast) { |
no test coverage detected