- Data Access
- Database
- Conditions and Looping
- Execution Control
- Text
- __template - String Template from Value
- __template_wrap - TBD
- __format - Format Strings from Map
- __template_short - String Template from Value
- __string_append - String Append
- __string_clear - String Clear
- __concat - String Concatenate
- __upper - String Uppercase
- __lower - String Lowercase
- __split - String Split
- __json_decode - JSON Decode
- __json_encode - JSON Encode
- __base64_decode - Base64 Decode
- __base64_encode - Base64 Encode
- __html_encode - HTML Encode
- __num_to_string - Number to String
- Maps
- Array
- __array_append - Array Append
- __array_remove - Array Remove
- __array_index - Array Index
- __array_slice - Array Slice
- __array_contains - Array Contains
- __array_map_remap - Array Map Remap
- __array_map_find - Array Map Find
- __array_map_find_update - Array Map Find Update
- __array_map_template - Array Map Template
- __array_map_to_map - Array Map To Map
- __array_map_key_set - Array Map Key Set
- __array_divide - Array Divide
- Time
- Math
- Rendering
- Networking
- User
- Special
- Debugging
- Comments
Go: UDN_Get
Input: Ignored
Args:
- string :: If quoted, this can contain dots, of each arg will become part of a "dotted string" to access the global data
- string (optional, variadic) :: Any number of args can be provided, all strings
Output: list of maps :: []map[string]interface
Example:
__input.Testing123.__set.temp.testing.__get.temp.testing
Result:
Testing123
Alternate Example, single dotted string uses the same Global Data:
__input.Testing123.__set.temp.testing.__get.'temp.testing'
Side Effect: None
Related Functions: __set
Go: UDN_Set
Input: Ignored
Args:
- string :: If quoted, this can contain dots, of each arg will become part of a "dotted string" to access the global data
- string (optional, variadic) :: Any number of args can be provided, all strings
- Any :: The final data can be any value, and is set into the location
Output: list of maps :: []map[string]interface
Example:
__input.Testing123.__set.temp.testing.__get.temp.testing
Result:
Testing123
Alternate Example, single dotted string uses the same Global Data:
__input.Testing123.__set.'temp.testing'.__get.temp.testing
Side Effect: None
Related Functions: __get
Go: UDN_GetIndex
Note: similar to __get, however the global udn_data is not used. Data comes directly from input
Input: Any
Args:
- string :: If quoted, this can contain dots, of each arg will become part of a "dotted string" to access the input data
- string (optional, variadic) :: Any number of args can be provided, all strings
Output: Any depending on what is specified
Example:
__input.{key1=value1}.__get_index.key1
Result:
value1
Alternate Example:
__input.[{key1=value1}, {key2=value2}].__get_index.1.key2
Result:
value2
Side Effect: None
Related Functions: __set_index
Go: UDN_SetIndex
Note: similar to __set, however data is not stored in the global udn_data. Output is directly piped out to result and not stored. Data comes directly from input and is modified and piped out.
Input: Any
Args:
- string :: If quoted, this can contain dots, of each arg will become part of a "dotted string" to access the input data
- string :: The last argument is the value that is set to the specified location in the input string
Output: The updated input string with the specified updated value
Example:
__input.{key1=value1}.__set_index.key1.value2
Result:
{key1: value2}
Alternate Example:
__input.[{key1=value1}, {key2=value2}].__set_index.1.key2.value3
Result:
[{key1=value1, key2=value3}]
Side Effect: None
Related Functions: __get_index
Takes an array of N strings, which are dotted for udn_data accessing. The first value that isnt nil is returned. nil is returned if they all are.
Go: UDN_Get
Input: Ignored
Args:
- string :: Dotted string ('location.goes.here')
- string (optional, variadic) :: Any number of args can be provided, same as the first argument
Output: Any
Example:
__input.'Hello World'.__set.special.field.__get_first.'not.a.real.place'.'special.field'
Result:
Hello World
Side Effect: None
Just like __get, except uses a portion of the Global Data space behind a UUID for this ProcessSchemaUDNSet() or __function call. It allows names to be re-used, which they cannot be in the normal Global Data space, as it is global.
Go: UDN_GetTemp
Input: Ignored
Args:
- string :: If quoted, this can contain dots, of each arg will become part of a "dotted string" to access the global data
- string (optional, variadic) :: Any number of args can be provided, all strings
Output: Any
Example:
__input.Testing123.__set_temp.temp.testing.__get_temp.temp.testing
Result:
Testing123
Alternate Example, single dotted string uses the same Global Data:
__input.Testing123.__set_temp.'temp.testing'.__get_temp.temp.testing
Side Effect: None
Related Functions: __set_temp
Just like __set, except uses a portion of the Global Data space behind a UUID for this ProcessSchemaUDNSet() or __function call. It allows names to be re-used, which they cannot be in the normal Global Data space, as it is global.
Go: UDN_SetTemp
Input: Ignored
Args:
- string :: If quoted, this can contain dots, of each arg will become part of a "dotted string" to access the global data
- string (optional, variadic) :: Any number of args can be provided, all strings
- Any :: The final data can be any value, and is set into the location
Output: list of maps :: []map[string]interface
Example:
__input.Testing123.__set_temp.testing.__get_temp.testing
Result:
Testing123
Alternate Example, single dotted string uses the same Global Data:
__input.Testing123.__set_'temp.testing'.__get_temp.testing
Side Effect: None
Related Functions: __get_temp
Given arg[0], increment value by 1. Output incremented value (float64/int64)
Go: UDN_Increment
Input: int (starting value)
Args:
- int (value to be incremented by, default is 1 if not provided)
Output: int - incremented value
Example:
__input.99.__increment
Result:
100
Alternate Example,
__input.99.__increment.2
Result:
101
Side Effect: None
Related Functions: __decrement
Given arg[0], decrement value by 1. Output decremented value (float64/int64)
Go: UDN_Decrement
Input: int
Args:
- int - value to be incremented by (default is 0 if not provided)
Output: int - decremented value
Example:
__input.100.__decrement
Result:
99
Example:
__input.100.__decrement.2
Result:
98
Side Effect: None
Related Functions: __increment
See docs on Dataman for more details: https://docs.google.com/document/d/1YDbwuQPpObAK06nnDd-v-rded3ma25AUToZ5iuewTiU/edit#
Just like __set, except uses a portion of the Global Data space behind a UUID for this ProcessSchemaUDNSet() or __function call. It allows names to be re-used, which they cannot be in the normal Global Data space, as it is global.
Go: UDN_DataGet
Input: Ignored
Args:
- string :: Table/Collection name
- int :: Record ID. Primary key.
- options :: Options. Example: {"db": "eventsum"}
Output: Map :: map[string]interface
Example:
__data_get.web_widget_type.1
Result:
{_id: 1, name: "Base Page"}
Side Effect: None
Related Functions: __data_set, __data_filter, __query
Just like __set, except uses a portion of the Global Data space behind a UUID for this ProcessSchemaUDNSet() or __function call. It allows names to be re-used, which they cannot be in the normal Global Data space, as it is global.
Go: UDN_DataSet
Input: Ignored
Args:
- string :: Table/Collection name
- map :: Record field data to put back in
- options :: Options. Example: {"db": "eventsum"}
Output: Map :: map[string]interface
Example:
__data_set.web_widget_type.{_id=1,name='Base Page'}
Result:
{_id: 1, name: "Base Page"}
Side Effect: None
Related Functions: __data_get, __data_filter
Just like __set, except uses a portion of the Global Data space behind a UUID for this ProcessSchemaUDNSet() or __function call. It allows names to be re-used, which they cannot be in the normal Global Data space, as it is global.
Go: UDN_DataFilter
Input: Ignored
Args:
- string :: If quoted, this can contain dots, of each arg will become part of a "dotted string" to access the global data
- string (optional, variadic) :: Any number of args can be provided, all strings
- Any :: The final data can be any value, and is set into the location
- options :: Options. Example: {"db": "eventsum"}
Output: list of maps :: []map[string]interface
Example:
__data_filter.web_widget_type.{name=(__input.['=', 'Base Page'])}
- Note that it is necessary to create a list first to adhere to the dataman requirements
Result:
[{_id: 1, name: "Base Page"}]
Side Effect: None
Related Functions: __data_get, __data_set
PARTIALLY DEPRICATED: Only use __query
when __data_get
and __data_filter
absolutely wont work. Dataman makes working with data much more consistent and also takes care of integrite problems. Especially only use Dataman for writing data, as there are additional constraints.
Go: UDN_QueryById
Input: Ignored
Args:
- int :: datasource_query.id record primary key
- map (optional) :: data arguments for the query, are short templated into the stored SQL
Output: list of maps :: []map[string]interface
Example:
__query.25
Side Effect: None
Related Functions: __data_get, __data_filter
Go: UDN_IfCondition
Input: Any
Args: None
Output: Last Output Function Result
Example:
__if.1.__debug_output.__end_if
Related Functions: __else_if
End Block: __end_if
Side Effect: Loops over all functions in the block (between __if and matching __end_if)
Go: UDN_ElseCondition
Input: Any
Args: None
Output: Last Output Function Result
Example:
__if.0.__debug_output.__else_if.__debug_output.__end_if
Side Effect: Loops over all functions in the block (between __else_if and matching __end_if or next __else_if)
Go: nil
Input: Any
Args: None
Output: Last Output Function Result
Example:
__if.1.__debug_output.__end_if
Side Effect: None
Related Functions: __if
Go: UDN_Not
Input: Boolean value: true, 1, "1", false, 0, "0"
Args:
- Boolean, String, Integer: true, false, "1", "0", 1, 0
Output: Boolean: "1", "0"
Example:
__if.(__not.0).__debug_output.__end_if
Side Effect: None
Related Functions: __not_nil, __if
Go: UDN_NotNil
Input: nil or Not
Args: None
Output: Boolean: "1", "0"
Example:
__if.(__get.thing.that.exists.__not_nil).__debug_output.__end_if
Side Effect: None
Related Functions: __not, __is_nil, __if
Go: UDN_NotNil
Input: nil or Not
Args: None
Output: Boolean: "1", "0"
Example:
__if.(__get.thing.that.doesnt.exist.__is_nil).__debug_output.__end_if
Side Effect: None
Related Functions: __not, __not_nil, __if
Go: UDN_Iterate
Input: Any
Args: None
Output: First Element of Array
Example:
__iterate.__debug_output.__end_iterate
End Block: __end_iterate
Side Effect: Loops over all functions in the block (between __iterate and matching __end_iterate)
Go: nil
Input: Any
Args: None
Output: Array of All iterate block runs
Example:
Side Effect: None
Related Functions: __iterate
Go: UDN_While
Input: None
Args: None
- String :: UDN code that is executed, and then checked like an __if result, which becomes boolean each while loop, breaking the while on a False result
- Int :: Maximum number of times the while should execute. Must be positive integer, 0/-1 will never execute. Ensures it does not infinitely loop.
Output: None
Example:
__input.10__set_temp_counter.__while.(__not.(__compare.(__get_temp.counter).0)).__math.input.(__get_temp.counter).__decrement.__set_temp.counter.__debug_output.__end_iterate
End Block: __end_while
Side Effect: Loops over all functions in the block (between __while and matching __end_while), as long as the condition is true, up to the maximum number of times (arg 1)
Go: nil
Input: Any
Args: None
Output: Array of All while block runs
Side Effect: None
Related Functions: __while
Go: UDN_CompareEqual
Input: Ignored
Args:
- Any :: Converted to a string for comparison
- Any :: Converted to a string for comparison
Output: Boolean: "1", "0"
Example:
__if.(__compare_equal.Tom.Jerry).__input.1.__else.__input.0.__end_if
Returns:
0
Related Functions: __compare_not_equal, __if
Side Effect: None
Go: UDN_CompareNotEqual
Input: Ignored
Args:
- Any :: Converted to a string for comparison
- Any :: Converted to a string for comparison
Output: Boolean: "1", "0"
Example:
__if.(__compare_not_equal.Tom.Jerry).__input.1.__else.__input.0.__end_if
Returns:
1
Related Functions: __compare_equal, __if
Side Effect: None
Go: UDN_Input
Input: Any
Args:
- Any (optional) :: This overrides the Input coming into this function
Output: Any. Passes through Input or Arg[0]
Example:
__input.Testing123.__set.temp.testing.__get.temp.testing
Result:
Testing123
Side Effect: None
Go: UDN_InputGet
Input: Map ::: map[string]interface
Args:
- string :: Index of the field for the Input
Output: Any. Passes through Input or Arg[0]
Example:
__input.{name=Bob}.__input_get.name
Result:
Bob
Side Effect: None
This uses the udn_stored_function.name as the first argument, and then uses the current input to pass to the function, returning the final result of the function. Uses the web_site.udn_stored_function_domain_id to determine the stored function
Go: UDN_StoredFunction
Input: Any
Args:
- string :: Index of the field for the Input
- Any (options, variadic) :: Any arguments from this point are stored as an Array in the Global Data location "function_arg"
Output: Any
Example:
__function.test_function.arg0.arg1.arg2
Result:
Anything!!!
Side Effect: Any
Related Functions: __execute
Execute a single UDN string. Combines the 2-tuple normally used to a single string. Also removes the concurrency blocks, making it a single string and not a next JSON array of 2-tuple strings.
Go: UDN_Execute
Input: Ignored
Args:
- string :: UDN code in a single string (Source/Target not separated)
Output: Any
Example:
__execute.'__input.Testing123'
Result:
Testing123
Side Effect: Any
Related Functions: __function
Go: UDN_StringTemplateFromValue
Input: Map :: map[string]interface{}
Args:
- string :: Text to be templated, using Go's text/template function
- Map (optional) :: Overrides the Input map value, if present
Output: string
Example:
__input.{name="Bob"}.__template.'Name: {{index .Map "name"}}'
Returns:
"Name: Bob"
Related Functions: __template_wrap, __template_short, __format, __template_map
Side Effect: None
Takes N-2 tuple args, after 0th arg, which is the wrap_key, (also supports a single arg templating, like __template, but not the main purpose). For each N-Tuple, the new map data gets "value" set by the previous output of the last template, creating a rolling "wrap" function.
NOTE(g): I dont know how this function is used at this point. It was useful, but I dont see an example to explain it. It's extremely overloaded, but powerful.
Go: UDN_StringTemplateMultiWrap
Input: Map :: map[string]interface{}
Args:
- string :: Text to be templated, using Go's text/template function
- Map (optional) :: Overrides the Input map value, if present
Output: string
Example:
__input.{name=Bob,job=Programmer}.__template_wrap.'Name: {{index .Map "name"}}'.{name=Bob}.'Job: {{index .Map "job"}}'.{job=Programmer}
Returns:
"Name: Bob"
Related Functions: __template, __template_short, __format, __template_map
Side Effect: None
Like format, for templating. Takes 3*N Args: (key,text,map), any number of times. Performs template and assigns key into the input map
Go: UDN_MapTemplate
Input: Ignored
Args:
- String :: Set key. This is where we will set the value once templated.
- String :: Template text. This is the text to be templated.
- Map :: This is the data to be templated into the 2nd arg.
Output: Passed Through Input
Example:
__template_map.'location.saved'.'Name: {{index .Map "name"}}'.{name=Bob}.__get.location.saved
Returns:
"Name: Bob"
Related Functions: __template_wrap, __template_short, __format, __template
Side Effect: None
Updates a map with keys and string formats. Uses the map to format the strings. Takes N args, doing each arg in sequence, for order control
Go: UDN_MapStringFormat
Input: Map :: map[string]interface
Args:
- String :: Set key. This is where we will set the value once templated.
- String :: Format string. This is the data to be templated into the 0th arg location.
*** Optional and Repetable Args ***
- String (optional, variadic) :: Set key. Indefinite pairs of String/Map args
- Map (optional, variadic) :: Format string. Indefinite pairs of String/Map args
*** End Optional and Repetable Args ***
Output: Passed Through Input
Example:
__input.{name=Bob,job=Programmer}.__format.'location.saved.name'.'Name: {index .Map "name"}'.'location.saved.job'.'Job: {index .Map "job"}.__get.location.saved.name'
Returns:
"Name: Bob"
Related Functions: __template_wrap, __template_short, __format, __template
Side Effect: None
Like __template, but uses {{{name}} instead of {index .Map "name"}
Go: UDN_StringTemplateFromValueShort
Input: Map :: map[string]interface
Args:
- String :: Set key. This is where we will set the value once templated.
- Map (optional) :: This overrides the Input, if present
Output: String
Example:
__input.{name=Bob,job=Programmer}.__template_short.'Name: {{{name}}}'
Returns:
"Name: Bob"
Related Functions: __template_wrap, __template_short, __format, __template
Side Effect: None
Appends to an existing string, or creates a string if nil (not present in Global Data). Args work like __get
Go: UDN_StringAppend
Input: String
Args:
- string :: If quoted, this can contain dots, of each arg will become part of a "dotted string" to access the global data
- string (optional, variadic) :: Any number of args can be provided, all strings
Output: String
Example:
__input.'The Quick '.__set.temp.test.__input.'Brown Fox'.__string_append.temp.test.__get.temp.test
Returns:
"The Quick Brown Fox"
Related Functions: __string_clear, __concat
Side Effect: None
This is only needed when re-using a Global Data label, you can start appending to an non-existent location and it will start it with an empty string.
Go: UDN_StringClear
Input: String
Args:
- string :: If quoted, this can contain dots, of each arg will become part of a "dotted string" to access the global data
- string (optional, variadic) :: Any number of args can be provided, all strings
Output: String
Example:
__string_clear.temp.test
Related Functions: __string_append
Side Effect: None
TODO(g): Not Yet Implemented
Go: UDN_StringConcat
Input: String
Args:
- string :: If quoted, this can contain dots, of each arg will become part of a "dotted string" to access the global data
- string (optional, variadic) :: Any number of args can be provided, all strings
Output: String
Example:
Returns:
Related Functions: __string_clear, __string_append
Side Effect: None
Go: UDN_StringUpper
Input: String
Args:
- string :: string that will be set to uppercase
Output: String (upper case)
Example:
"__upper.hElLo"
Returns:
HELLO
Related Functions: __lower
Side Effect: None
Go: UDN_StringLower
Input: String
Args:
- string :: string that will be set to lowercase
Output: String (lower case)
Example:
"__lower.hElLo"
Returns:
hello
Related Functions: __upper
Side Effect: None
Go: UDN_StringSplit
Input: String that will be split
Args:
- string :: string that is used as the separator
Output: List (of strings)
Example:
"__input.'hello.world.how.are.you'.__split.'.'"
Returns:
[hello, world, how, are, you]
Related Functions: __concat, __string_append
Side Effect: None
Decodes a string to Go data: map[string]interface is assumed if using Global Data
Go: UDN_JsonDecode
Input: String
Args: None
Output: Map :: map[string]interface
Example:
__input.'{"a": 1}'.__json_decode
Returns:
{a: 1}
Related Functions: __json_encode
Side Effect: None
Encodes Go data into a JSON string
Go: UDN_JsonDecode
Input: Any
Args: None
Output: String
Example:
__input.{a=1}.__json_encode
Returns:
{"a": "1"}
Related Functions: __json_decode
Side Effect: None
Decodes a string from base64 into a normal string
Go: UDN_JsonDecode
Input: String
Args: None
Output: Map :: map[string]interface
Example:
__input.'todo'.__base64_decode
Returns:
todo
Related Functions: __base64_encode
Side Effect: None
Encodes a string into base64, needed for passing around in web pages where quoting issues or spacing won't allow regular text, or binary transmission
Go: UDN_JsonDecode
Input: Any
Args: None
Output: String
Example:
__input.todo.__json_encode
Returns:
todo
Related Functions: __base64_decode
Side Effect: None
Escapes HTML characters
Go: UDN_HtmlEncode
Input: String
Args: None
Output: String
Example:
__input.'1 < 2'.__html_encode
Returns:
1 < 2
Side Effect: None
Given input number (int/int64/float64) and optional precision (int), outputs string (with specified precision/ original number)
Go: UDN_NumberToString
Input: number (int/int64/float64)
Args:
- int (optional) :: arithmetic precision (number of decimal places)
Output: string (with specified precision/original number)
Example:
__math.input.'999.99'.__num_to_string.4
Returns:
"999.9900"
Alternate Example, no argument/precision specified:
__math.input.999.__num_to_string
Returns:
"999"
Side Effect: None
Sets N keys, like __format, but with no formatting
Go: UDN_MapKeySet
Input: Map
Args:
- String (variadic) :: Key/field to set in the Map
- Any (variadic) :: Value to set in the Map key/field
Output: Map
Example:
__input.{name=Bob}.__map_key_set.job.Programmer
Result:
{name=Bob,job=Programmer}
Side Effect: None
Related Functions: __map_key_delete
Deletes N keys
Go: UDN_MapKeySet
Input: Map
Args:
- String (variadic) :: Key/field to delete in the Map
Output: Map
Example:
__input.{name=Bob,job=Programming}.__map_key_delete.job
Result:
{name=Bob}
Side Effect: None
Related Functions: __map_key_set
Creates a new Map which is a copy/clone of the current one, so you can modify it without changing the original
Go: UDN_MapCopy
Input: Map
Args:
- String (variadic) :: Key/field to delete in the Map
Output: Map
Example:
__input.{name=Bob,job=Programming}.__map_copy
Result:
{name=Bob,job=Programming}
Side Effect: None
Creates a new Map which is a copy/clone of the current one, so you can modify it without changing the original
Go: UDN_MapUpdate
Input: Map
Args:
- String (variadic) :: Key/field to delete in the Map
Output: Map
Example:
__input.{name=Bob}.__map_update.{job=Programming}
Result:
{name=Bob,job=Programming}
Side Effect: None
Creates a new Map which has keys that are templated versions of the previos map. The values remain the same.
This is useful for things such as prefixing a UUID in front of keys, so that they can be injected into HTML pages.
Go: UDN_MapTemplateKey
Input: Map
Args:
- String :: Template string (text/template)
- Map :: Map of values to use for templating. A "key" key will be added with each key's string, so that it can be used in the templating process.
- Map (optional) :: Map that overrides input Map.
Output: Map
Example:
__input.{name=Bob}.__map_template_key.'{{uuid}}_{{key}}'.{uuid=1234}
Result:
{1234_name=Bob}
Side Effect: None
Given a list of maps, group by an aggregate field
Go: UDN_GroupBy
Input: None
Args:
- string :: method to group on
- list of maps :: source of data to operate on
- string :: aggregated field
- string :: field to group on
Grouping methods:
- sum
- count
Output: Aggregated map
Example:
__input.[{order_id:101,category:monitor,cost:(__math.input.80)},{order_id:102,category:monitor,cost:(__math.input.82)},{order_id:103,category:laptop,cost:(__math.input.100)}].__set.data,
__group_by.sum.(__get.data).cost.category.__set.set_api_result
Result:
[{category:monitor,cost:162},{category:laptop,cost:100}]
Side Effect: None
Appends the input into the specified target location (args)
Go: UDN_ArrayAppend
Input: Item to append into the array
Args:
- Any :: Target array name
Output: Array
Example:
__input.[1,2,3].__set.test
__input.4.__array_append.test
Result:
[1,2,3,4]
Side Effect: None
Removes first entry of the element (input)
Go: UDN_ArrayRemove
Input: Item to remove from the array
Args:
- Map :: Target array name
Output: Array
Example:
__input["Alice", "Bob"].__set.test.array.__input.["Alice"].__array_remove.test_array
Result:
["Bob"]
Side Effect: None
Returns the index (int) of the first entry in the array of the input element
Go: UDN_ArrayIndex
Input: Item to find the index of in the array
Args:
- Map :: Target array name
Output: Array
Example:
__input["Alice", "Bob"].__set.test.array.__input.["Bob"].__array_remove.test_array
Result:
0
Side Effect: None
Splits the array based on the start and end index (args)
Go: UDN_ArraySlice
Input: Array
Args:
- Int :: Start index (can be positive or negative)
- Int :: End index (can be positive or negative) - if end index not provided then end index is assumed to be end of array
Note: for positive indices the end index is non-inclusive. For negative indices the start index is non inclusive. Also, for positive indices the first element of the array is at 0. For negative indices the last element is at -1.
Output: Array Slice based on start & end index
Example:
__input.[1,2,3,4,5,6].__array_slice.0.6
Result:
[1,2,3,4,5,6]
Example 2:
__input.[1,2,3,4,5,6].__array_slice.-2.-1
Result:
[6]
Example 3:
__input.[1,2,3,4,5,6].__array_slice.-7.-1
Result:
[1,2,3,4,5,6]
Side Effect: None
Breaks an array up into a set of arrays, based on a divisor. Ex: divide=4, a 14 item array will be 4 arrays, of 4/4/4/2 items each.
Go: UDN_ArrayDivide
Input: Array
Args:
- Integer :: "Columns" to break up the "Row" of the Array, into many "Rows" of max "Column"
Output: Array
Example:
__input.[1,2,3,4].__array_divide.2
Result:
[[1,2],[3,4]]
Side Effect: None
Returns boolean, if the array specified by args contains all the elements in the input (single or array of elements)
Go: UDN_ArrayContains
Input: Item or Array of Items to see if they all exist in the specified array
Args:
- Map :: Target array name
Output: Bool
Example:
__input["Alice", "Bob"].__set.test.array.__input.["Bob"].__array_remove.test_array
Result:
0
Side Effect: None
Takes an array of maps, and makes a new array of maps, based on the arg[0] (map) mapping (key_new=key_old)
Go: UDN_ArrayMapRemap
Input: Array of Maps
Args:
- Map :: Keys of this map will be replaced in every Map in the Array with the value
Output: Array of Maps
Example:
__input.[{age=10},{age=20}].__array_map_remap.{age=8}
Result:
[{age=8},{age=8}]
Side Effect: None
Takes an array of maps, and returns the first entry that matches all key values of the arg0 map, or nil
Go: UDN_ArrayMapFind
Input: Array of Maps
Args:
- Map :: This is a key/value map to check against the array of maps, returning the first map which matches all keys/values.
Output: Map
Example:
__input.[{age=10,name=Joe},{age=20,name=Bob}].__array_map_find.{age=10}
Result:
{age=10,name=Joe}
Side Effect: None
Takes an array of maps, and matches it against all the arguments in the first map. For all elements that match, they are updated with the second map. The entire array is returned.
Go: UDN_ArrayMapFindUpdate
Input: Array of Maps
Args:
- Map :: This is a key/value map to check against the array of maps, returning the first map which matches all keys/values.
- Map :: This map is used to update all maps that match key/values in arg0
Output: Array of Maps
Example:
__input.[{age=10,name=Joe},{age=20,name=Bob}].__array_map_find_update.{age=10}.{selected=selected}
Result:
[{age=10,name=Joe,selected=selected},{age=20,name=Bob}]
Side Effect: None
Takes an array of maps, iterates over each map, and performs N templates updating keys with the map's contents (key/values)
Go: UDN_ArrayMapFindUpdate
Input: Array of Maps
Args:
-
String :: This is the map key to update/set
-
String :: This is the text/template data, uses the map's data
-
String (optional) :: This is the map key to update/set
-
String (optional) :: This is the text/template data, uses the map's data
Repeats in pairs forever.
Output: Array of Maps
Example:
__input.[{age=10,name=Joe},{age=20,name=Bob}].__array_map_template.label.'{{index .Map "name"}}: {{index .Map "age"}}'
Result:
[{age=10,name=Joe,label='Joe: 10',selected=selected},{age=20,name=Bob,label='Bob: 20'}]
Side Effect: None
Takes an array of maps, and returns a map where the key is the specified arg0 string key in all maps in the array
Go: UDN_ArrayMapToMap
Input: Array of Maps
Args:
- String :: Key to get from array maps, and key to set in result map
- List of Maps (optional) :: Can be passed in as arg1 instead of input
Output: Map
Example:
__input.[{age=10,name=Joe},{age=20,name=Bob}].__array_map_to_map.name
Result:
{Joe={age=10,name=Joe},Bob={age=20,name=Bob}}
Side Effect: None
Takes an array of maps, sets a variable number of key/value pairs
Go: UDN_ArrayMapToMap
Input: Array of Maps
Args:
-
String :: Key to set in each map
-
Any :: Value to be set into the key
-
String (optional) :: Key to set in each map
-
Any (optional) :: Value to be set into the key
Can repeat the pairs of key/values.
Output: Array of Maps
Example:
__input.[{age=10,name=Joe},{age=20,name=Bob}].__array_map_key_set.uuid.1234
Result:
[{age=10,name=Joe,uuid=1234},{age=20,name=Bob,uuid=1234}]
Side Effect: None
Given arg[0] string in the format 'YYYY-MM-DD hh:mm:ss' or 'YYYY-MM-DDThh:mm:ss.sssZ' (including milliseconds), return the go time.Time object.
Go: UDN_GetCurrentTime
Input: string :: This string must be of the format 'YYYY-MM-DD hh:mm:ss' or 'YYYY-MM-DDThh:mm:ss.sssZ' (including milliseconds). Otherwise, an empty result will be returned.
Args:
None
Output: time.time object
Example:
__input.'2018-01-01 00:00:00'.__string_to_time
Result:
time.Time object (Representing the first day of 2018 at midnight)
Side Effect: None
Given arg[0] string in the format 'YYYY-DD-MM hh:mm:ss'. If specific number given for YYYY, DD, MM, hh, mm, ss, use that number instead. Outputs go time.Time object of current time (UTC).
Go: UDN_GetCurrentTime
Input: Ignored
Args:
- string (optional) :: string format ‘YYYY-DD-MM hh:mm:ss’ - desired numbers can be specified to replace YYYY, DD, MM, hh, mm, ss
Output: time.time object
Example:
__get_current_time.'YYYY-MM-01 hh:mm:ss'
Result:
time.Time object (First day of the current month (UTC))
Alternate Example, no arguments specified:
__get_current_time
Result:
time.Time object (Current time (UTC))
Side Effect: None
If given arg[0] string, a specified timezone in the IANA Time Zone database, such as "America/Chicago". If given "" or "local" or no argument, outputs go time.Time object of current local time. Otherwise, outputs time.Time object, current time in the specified timezone.
Go: UDN_GetLocalTime
Input: Ignored
Args:
- string (optional) :: specified timezone in the IANA Time Zone database (https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
Output: time.time object
Example:
__get_local_time.'America/Chicago'
Result:
time.Time object (current time in America/Chicago timezone)
Alternate Example, no arguments specified:
__get_local_time
Result:
time.Time object (Current local time)
Side Effect: None
Given arg[0] time.Time object, convert to int64 unix time in seconds
Go: UDN_TimeToEpoch
Input: time.Time object
Args:
None
Output: int :: Unix time in seconds
Example:
__input.'2018-01-01 00:00:00'.__string_to_time.__time_to_epoch
Result:
1514764800
Side Effect: None
Given arg[0] time.Time object, convert to int64 unix time in milliseconds
Go: UDN_TimeToEpochMs
Input: time.Time object
Args:
None
Output: int :: Unix time in milliseconds
Example:
__input.'2018-01-01 00:00:00'.__string_to_time.__time_to_epoch
Result:
1514764800000
Side Effect: None
Performs a set of math functions
Go: UDN_Math
Input: None
Args:
- string :: specify the math function called
- int/float :: Arguments for the math function (variadic)
Output: int/float :: result of the math function
Functions:
__math.input.arg0 (returns a int/float)
__math.sum.arg0.arg1 or __math.+.arg0.arg1 (returns arg0 + arg1)
__math.subtract.arg0.arg1 or __math.-.arg0.arg1 (returns arg0 - arg1)
__math.multiply.arg0.arg1 or __math.*.arg0.arg1 (returns arg0 * arg1)
__math.divide.arg0.arg1 or __math./.arg0.arg1 (returns arg0 / arg1)
Example:
__math.input.8
Result:
8 (int, not string "8" - __input.8 would return string "8")
Example 2:
__math.add.8.9
Result:
17
Example 3:
__math.multiply.'1.1'.'5.5'
Result:
6.05
Side Effect: None
All widgets are cached in memory, this just accesses that cache and returns the Widget string.
Go: UDN_Widget
Input: Ignored
Args:
- string :: Name of widget
Output: String
Example:
__widget.button
Result:
<button type="button" class="btn btn-{{index .Map "color"}}" onclick="{{index .Map "onclick"}}"><i class="{{index .Map "icon"}} position-left"></i> {{index .Map "value"}}</button>
Side Effect: Any
Renders a Data Widget Instance. Performs all the operations needed to render a Data Widget Instance to a web page via an API call, or other accessing method.
Go: UDN_RenderDataWidgetInstance
Input: Ignored
Args:
- Integer :: web_data_widget_instance.id
- Map :: A map to update the "widget_instance" Global Data, to include external data in the rendering process
Output: String
Example:
__render_data.dialog_target.34.{control=(__get.param.data.__json_decode)}
Result:
...HTML/CSS/JS...
Side Effect: Any
Sets the returning http response code
Go: UDN_SetHttpResponseCode
Input: None
Args:
- string :: the http code (string) to be returned
Output: Nothing. The request's http return code will be set
Example:
__set_http_response.404
Result:
Nothing
Side Effect: The request's http return code will be set
Sends a http request with a given method (POST|PUT|DELETE|GET) to a url endpoint.
Go: UDN_HttpRequest
Input: map or array of maps to be encoded in the request body sends alone with the POST, PUT, DELETE
Args:
- string :: request method, should be one of "POST","GET","DELETE","PUT"
- endpoint url :: the url that the request goes to
- (Optional) timeout seconds :: the seconds after which the request will be timeout. By default, is 10 secs
Output: if error occurrs, returns nothing. If a "GET" request, returns the decoded json(application/json) or text string(other content-type), otherwise returns the response status code.
Example:
__http_request.'GET'.'http://eventsum.infra.prod.wish.com/detail?event_id=3002'.'10'
Result:
{ "event_name": "AttributeError", "event_type": "python", "raw_data": ...}
Side Effect: None
Example:
__input.[{name=group1,info=group1_info}].__http_request.'POST'.'http://eventsum.infra.prod.wish.com/group'
Result:
201
Side Effect: If POST/PUT/DELETE request, will change the state on the target url.
Authenticates against LDAP server
Go: UDN_Login
Input: Ignored
Args:
- String :: User name
- String :: Password
Output: String
Example:
__login.bob.pass
Result:
0tE44fJhc8Ne81jsILc6TuUZCkX
Side Effect: None
Returns HTML/CSS/JS necessary to render a dialog editing window for DDD spec data.
Go: UDN_RenderDataWidgetInstance
Input: Ignored
Args:
- String :: DOM Target ID
- Int64 :: web_data_widget_instance.id
- Map :: Widget Instance Update Map
- Map (optional):: UDN Update Map
Output: String
Example:
__ddd_render.'0'.0.0.0.(__get.temp.item.ddd_id).'temp.item.static_data_json'.(__get.temp.item.static_data_json).0
Result:
...HTML/CSS/JS...
Side Effect: None
Go: UDN_QueryById
Input: Any
Args: None
Output: Pass Through Input
Example:
__debug_output
Side Effect: Prints input to the debug log
Go: UDN_Comment
Input: Any
Args: Any
Output: Pass Through Input
Example:
__comment.hello.this is a comment
Side Effect: None