Type conversions#
CEL provides functions to convert values between types.
Numeric conversions#
Convert between numeric types using int(), uint(), and double().
Converting a negative value to uint produces an error.
String conversions#
Convert values to strings using string().
Parse strings to numbers using int(), uint(), or double().
Strings must contain decimal digits only (no hex or type suffixes).
Special floating-point values can be parsed from strings.
Invalid strings produce an error.
Bytes conversions#
Convert between strings and bytes.
Converting bytes to string requires valid UTF-8.
Time conversions#
Convert timestamps to Unix epoch seconds.
Convert durations to nanoseconds.
Dynamic type#
dyn() marks a value as dynamically typed,
deferring type checking to runtime.
This is useful when the ternary operator branches have different types.
See also#
- Booleans and numbers - Numeric types
- Strings and bytes - String and bytes types
- Time - Timestamps and durations