Functions
What is a Function?
In Keep’s context, functions extend the power of context injection. For example, if a step returns a list, you can use the keep.len
function to count and use the number of results instead of the actual results.
To use a keep function, prefix it with keep.
, for example, use keep.len
and not len
condition:
- type: threshold
# Use the len of the results instead of the results
value: "keep.len({{ steps.db-no-space.results }})"
compare_to: 10
How to create a new function?
Keep functions are designed to be easily extendible!
To create a new function, all you have to do is to add it to the functions directory __init__.py
file.