Skip to main content

Ext Macros

Ext macros are a related set of functions, macros, or other features which may not be covered by the core CEL spec from the cel-go/ext package.

Encoders

base64.decode() -> bytes

Decodes base64-encoded string to bytes.

This function will return an error if the string input is not base64-encoded.

Signatures

  • base64.decode(<string>) -> <bytes>

Example

Loading…

base64.encode() -> string

Encodes bytes to a base64-encoded string.

Signatures

  • base64.encode(<bytes>) -> <string>

Example

Loading…

Lists

list.join() -> string

Returns a new string with the elements of the list concatenated. Optionally, a separator can be specified to insert between elements.

Signatures

  • <list<string>>.join(<string?>) -> <string>

Example

Loading…

list.filter() -> list

Returns a new list containing elements that satisfy a provided condition.

Signatures

  • <list<T>>.filter(<function(T) -> bool>) -> <list<T>>

Example

Loading…

list.slice() -> list

Returns a new sub-list using the indexes provided.

Signatures

  • <list>.slice(<int>, <int>) -> <list>

Example

Loading…

Strings

string.indexOf() -> int

Returns the index of the first occurrence of a substring within the string. The function also accepts an optional position argument to start the search.

Signatures

  • <string>.indexOf(<string>, <int?>) -> <int>

Example

Loading…

string.split() -> list

Splits a string into a list of substrings using a specified separator. Optionally, a maximum number of splits can be defined.

Signatures

  • <string>.split(<string?>, <int?>) -> list<string>

Example

Loading…

string.replace() -> string

Replaces occurrences of a substring with another string. Optionally, limits the number of replacements.

Signatures

  • <string>.replace(<string>, <string>, <int?>) -> <string>

Example

Loading…