Documentation
¶
Overview ¶
Package transform package contains canonical implementations of Kazaam transforms.
Index ¶
- func Coalesce(spec *Config, data *simplejson.Json) error
- func Concat(spec *Config, data *simplejson.Json) error
- func Default(spec *Config, data *simplejson.Json) error
- func Extract(spec *Config, data *simplejson.Json) error
- func Pass(spec *Config, data *simplejson.Json) error
- func Shift(spec *Config, data *simplejson.Json) error
- type Config
- type ParseError
- type RequireError
- type SpecError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Coalesce ¶
func Coalesce(spec *Config, data *simplejson.Json) error
Coalesce checks multiple keys and returns the first matching key found.
func Concat ¶
func Concat(spec *Config, data *simplejson.Json) error
Concat combines any specified fields and literal strings into a single string value.
func Default ¶
func Default(spec *Config, data *simplejson.Json) error
Default sets specific value(s) in output json.
func Extract ¶
func Extract(spec *Config, data *simplejson.Json) error
Extract returns the specified path as the top-level object.
Types ¶
type Config ¶
type Config struct { Spec *map[string]interface{} `json:"spec"` Require bool `json:"require,omitempty"` }
Config contains the options that dictate the behavior of a transform. The internal `spec` object can be an arbitrary json configuration for the transform.
type ParseError ¶
type ParseError string
ParseError should be thrown when there is an issue with parsing any the specification or data
func (ParseError) Error ¶
func (p ParseError) Error() string
type RequireError ¶
type RequireError string
RequireError should be thrown if a required key is missing in the data
func (RequireError) Error ¶
func (r RequireError) Error() string