Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewParseCtx ¶
func NewParseCtx( transformCtx *transformctx.Ctx, customFuncs customfuncs.CustomFuncs, customParseFuncs CustomParseFuncs) *parseCtx
NewParseCtx creates new context for parsing and transforming a *Node (and its sub-tree) into an output record.
Types ¶
type CustomFuncDecl ¶
type CustomFuncDecl struct {
Name string `json:"name,omitempty"`
Args []*Decl `json:"args,omitempty"`
IgnoreError bool `json:"ignore_error,omitempty"`
// contains filtered or unexported fields
}
CustomFuncDecl is the decl for a "custom_func".
func (CustomFuncDecl) MarshalJSON ¶
func (d CustomFuncDecl) MarshalJSON() ([]byte, error)
MarshalJSON is the custom JSON marshaler for CustomFuncDecl.
type CustomParseFuncType ¶
type CustomParseFuncType func(*transformctx.Ctx, *idr.Node) (interface{}, error)
CustomParseFuncType represents a custom_parse function type. Deprecated. Use customfuncs.CustomFuncType.
type CustomParseFuncs ¶
type CustomParseFuncs = map[string]CustomParseFuncType
CustomParseFuncs is a map from custom_parse names to an actual custom parse functions. Deprecated. Use customfuncs.CustomFuncs.
type Decl ¶
type Decl struct {
// Const indicates the input element is a cost.
Const *string `json:"const,omitempty"`
// External indicates the input element is from an external property.
External *string `json:"external,omitempty"`
// XPath specifies an xpath for an input element.
XPath *string `json:"xpath,omitempty"`
// XPathDynamic specifies a dynamically constructed xpath for an input element.
XPathDynamic *Decl `json:"xpath_dynamic,omitempty"`
// CustomFunc specifies the input element is a custom function.
CustomFunc *CustomFuncDecl `json:"custom_func,omitempty"`
// CustomParse specifies the input element is to be custom parsed. Deprecated.
CustomParse *string `json:"custom_parse,omitempty"`
// Template specifies the input element is a template.
Template *string `json:"template,omitempty"`
// Object specifies the input element is an object.
Object map[string]*Decl `json:"object,omitempty"`
// Array specifies the input element is an array.
Array []*Decl `json:"array,omitempty"`
// ResultType specifies the desired output type of element.
ResultType *resultType `json:"type,omitempty"`
// NoTrim specifies space trimming in string value of the output element.
NoTrim bool `json:"no_trim,omitempty"`
// KeepEmptyOrNull specifies whether to keep an empty/null output or not.
KeepEmptyOrNull bool `json:"keep_empty_or_null,omitempty"`
// contains filtered or unexported fields
}
Decl is the type for omni schema's `transform_declarations` declarations.
func ValidateTransformDeclarations ¶
func ValidateTransformDeclarations( schemaContent []byte, customFuncs customfuncs.CustomFuncs, customParseFuncs CustomParseFuncs) (*Decl, error)
ValidateTransformDeclarations validates `transform_declarations` section of an omni schema and returns the `FINAL_OUTPUT` corresponding Decl.
func (Decl) MarshalJSON ¶
MarshalJSON is the custom JSON marshaler for Decl.