transform

package
v2.2.3 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package transform package contains canonical implementations of Kazaam transforms.

Index

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.

func Pass

func Pass(spec *Config, data *simplejson.Json) error

Pass performs no manipulation of the passed-in data. It is useful for testing/default behavior.

func Shift

func Shift(spec *Config, data *simplejson.Json) error

Shift moves values from one provided json path to another.

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

type SpecError

type SpecError string

SpecError should be thrown if the spec for a transform is malformed

func (SpecError) Error

func (s SpecError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL