udf

package
Version: v0.10.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 23, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsBool

func AsBool(source interface{}, state data.Map) (interface{}, error)

AsBool converts source into bool

func AsCollection

func AsCollection(source interface{}, state data.Map) (interface{}, error)

AsCollection converts source into a slice

func AsData

func AsData(source interface{}, state data.Map) (interface{}, error)

AsData converts source into map or slice

func AsFloat

func AsFloat(source interface{}, state data.Map) (interface{}, error)

AsFloat converts source into float64

func AsInt

func AsInt(source interface{}, state data.Map) (interface{}, error)

AsInt converts source into int

func AsJSON added in v0.7.0

func AsJSON(source interface{}, state data.Map) (interface{}, error)

AsJSON converts source to JSON

func AsMap

func AsMap(source interface{}, state data.Map) (interface{}, error)

AsMap converts source into map

func AsString

func AsString(source interface{}, state data.Map) (interface{}, error)

AsInt converts source into int

func Base64Decode added in v0.6.3

func Base64Decode(source interface{}, state data.Map) (interface{}, error)

Base64Decode decodes source using base64.StdEncoding

func Base64DecodeText added in v0.7.0

func Base64DecodeText(source interface{}, state data.Map) (interface{}, error)

Base64DecodeText decodes source using base64.StdEncoding to string

func Base64Encode added in v0.6.3

func Base64Encode(source interface{}, state data.Map) (interface{}, error)

Base64Decode encodes source using base64.StdEncoding

func FormatTime

func FormatTime(source interface{}, state data.Map) (interface{}, error)

FormatTime return formatted time, it takes an array of two arguments, the first id time, or now followed by java style time format.

func IndexOf

func IndexOf(source interface{}, state data.Map) (interface{}, error)

IndexOf returns index of the matched slice elements or -1

func Join

func Join(args interface{}, state data.Map) (interface{}, error)

Join joins slice by separator

func Keys

func Keys(source interface{}, state data.Map) (interface{}, error)

Keys returns keys of the supplied map

func Length

func Length(source interface{}, state data.Map) (interface{}, error)

Length returns length of slice or string

func QueryEscape added in v0.5.4

func QueryEscape(source interface{}, state data.Map) (interface{}, error)

QueryEscape returns url escaped text

func QueryUnescape added in v0.8.1

func QueryUnescape(source interface{}, state data.Map) (interface{}, error)

QueryUnescape returns url escaped text

func Register

func Register(aMap data.Map)

Register registers defined in this package UDFs

func TrimSpace added in v0.10.1

func TrimSpace(source interface{}, state data.Map) (interface{}, error)

TrimSpace returns trims spaces from supplied text

func Type added in v0.7.0

func Type(source interface{}, state data.Map) (interface{}, error)

Type returns source type

func Values

func Values(source interface{}, state data.Map) (interface{}, error)

Values returns values of the supplied map

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL