package
0.10.1
Repository: https://github.com/francoispqt/toolbox.git
Documentation: pkg.go.dev

# README

Expandable Collection User Defined Function

Usage


    aMap := data.NewMap();
    aMap.Put("ts", "2015-02-11")
    udf.Register(aMap)
    expanded := aMap.ExpandAsText(`$FormatTime($ts, "yyyy")`)
 

The list of defined UDFs:

  • Length, Len returns length of slice, map or string
  • AsMap - convert source into a map, it accepts data structure, or JSON, YAML literal
  • AsCollection - convert source into a slice, it accepts data structure, or JSON, YAML literal
  • AsData - convert source into a map or slice, it accepts data structure, or JSON, YAML literal
  • AsInt - convert source into a an int
  • AsFloat - convert source into a a float
  • AsBool - convert source into a boolean
  • FormatTime, takes two arguments, date or now, followed by java style date format
  • Values - returns map values
  • Keys - return map keys
  • IndexOf - returns index of matched slice element
  • Join - join slice element with supplied separator

# Functions

AsBool converts source into bool.
AsCollection converts source into a slice.
AsData converts source into map or slice.
AsFloat converts source into float64.
AsInt converts source into int.
AsJSON converts source to JSON.
AsMap converts source into map.
AsInt converts source into int.
Base64Decode decodes source using base64.StdEncoding.
Base64DecodeText decodes source using base64.StdEncoding to string.
Base64Decode encodes source using base64.StdEncoding.
FormatTime return formatted time, it takes an array of two arguments, the first id time, or now followed by java style time format.
IndexOf returns index of the matched slice elements or -1.
Join joins slice by separator.
Keys returns keys of the supplied map.
Length returns length of slice or string.
QueryEscape returns url escaped text.
QueryUnescape returns url escaped text.
Register registers defined in this package UDFs.
TrimSpace returns trims spaces from supplied text.
Type returns source type.
Values returns values of the supplied map.