-
Notifications
You must be signed in to change notification settings - Fork 95
Description
Motivation
Vanus Functions are a series of pre-built functions worked within Vanus transformer. By choosing a function, users can specify the way that events will be changed.
It will be a good start if you decide to contribute to Vanus codes.
Details
For example, if users' original event looks like this:
{
"specversion" : "1.0",
"type" : "com.example.someevent",
"source" : "/mycontext",
"subject": null,
"id" : "C234-1234-1234",
"time" : "2018-04-05T17:31:00Z",
"comexampleextension1" : "value",
"comexampleothervalue" : 5,
"datacontenttype" : "application/json",
"data" : {
"appinfoA" : "abc",
"appinfoB" : 123,
"appinfoC" : true
}
}
Now we can make some changes to the original event by creating a function pipeline. All functions will be executed by the order of functions defined in the pipeline. Each function consists of a function name
and an array of function parameters
.
For example, the create
function below will create a new json node with the key "data.source", and the value of JSON node "$.source". And the delete
function below will delete the json node with the key "$.data.appinfoA".
"pipeline":[
{"command":["create","$.data.source","$.source"]},
{"command":["delete","$.data.appinfoA"]}
]
Function List
structs
strings
- [Good First Issues]: implement function "capitalize_word" - 8 points #373
- [Good First Issues]: implement function "capitalize_sentence" - 5 points #374
- [Good First Issues]: implement function "replace_string" - 8 points #375
- [Good First Issues]: implement function "replace_between_positions" - 8 points #376
- [Good First Issues]: implement function "convert_timezone" - 7 points #438
- [Good First Issues]: implement function "now" - 4 points #430
- [Good First Issues]: implement function "today" - 4 points #462
- [Good First Issues]: implement function "check_custom_values" - 7 points #428
- [Good First Issues]: implement function "check_missing" - 7 points #427
- [Good First Issues]: implement function "extract_between_delimiters" - 7 points #426
- [Good First Issues]: implement function "extract_pattern" - 7 points #425
- [Good First Issues]: implement function "extract_between_positions" - 7 points #422
- [Good First Issues]: implement function "replace_between_delimiters" - 7 points #421
array
datetime
math
condition
How to join the event
If you want to implement a specific function, please leave a comment in corresponding issues like:
I'd like to implement this function, please assign this issue to me.
Vanus community will assign the issue to you on time.
Submit a pull request to suggest your changes.