Documentation ¶
Overview ¶
Package transform package contains canonical implementations of Kazaam transforms.
Index ¶
- Variables
- func Coalesce(spec *Config, data []byte) ([]byte, error)
- func Concat(spec *Config, data []byte) ([]byte, error)
- func Default(spec *Config, data []byte) ([]byte, error)
- func Delete(spec *Config, data []byte) ([]byte, error)
- func Extract(spec *Config, data []byte) ([]byte, error)
- func HandleUnquotedStrings(value []byte, dt jsonparser.ValueType) []byte
- func Pass(spec *Config, data []byte) ([]byte, error)
- func Shift(spec *Config, data []byte) ([]byte, error)
- func Timestamp(spec *Config, data []byte) ([]byte, error)
- func UUID(spec *Config, data []byte) ([]byte, error)
- type Config
- type ParseError
- type RequireError
- type SpecError
Constants ¶
This section is empty.
Variables ¶
var (
NonExistentPath = RequireError("Path does not exist")
)
Functions ¶
func Coalesce ¶
Coalesce checks multiple keys and returns the first matching key found in raw []byte.
func Concat ¶
Concat combines any specified fields and literal strings into a single string value with raw []byte.
func Delete ¶
Delete deletes keys in-place from the provided data if they exist keys are specified in an array under "keys" in the spec.
func HandleUnquotedStrings ¶
func HandleUnquotedStrings(value []byte, dt jsonparser.ValueType) []byte
jsonparser strips quotes from returned strings, this adds them back
func Pass ¶
Pass performs no manipulation of the passed-in data. It is useful for testing/default behavior.
Types ¶
type Config ¶
type Config struct { Spec *map[string]interface{} `json:"spec"` Require bool `json:"require,omitempty"` InPlace bool `json:"inplace,omitempty"` KeySeparator string `json:"keySeparator"` }
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 of 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