arg_parser

package
v0.0.0-...-f7fa24c Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 10 Imported by: 42

Documentation

Overview

Utility functions for extracting and validating inputs to functions and plugins.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractArgs

func ExtractArgs(scope types.Scope, args *ordereddict.Dict, target interface{}) error

Deprecate this in favor of ExtractArgsWithContext

func ExtractArgsWithContext

func ExtractArgsWithContext(
	ctx context.Context, scope types.Scope, args *ordereddict.Dict, target interface{}) error

func GetStringArg

func GetStringArg(
	ctx context.Context, scope types.Scope, args *ordereddict.Dict, field string) string

func RegisterParser

func RegisterParser(exemplar types.Any, parser ParserDipatcher)

func ToLazyExpr

func ToLazyExpr(scope types.Scope, arg types.Any) types.LazyExpr

Wrap an arg in a LazyExpr for plugins that want to receive a LazyExpr.

func ToStoredQuery

func ToStoredQuery(ctx context.Context, arg types.Any) types.StoredQuery

Convert a type to a stored query

Types

type FieldParser

type FieldParser struct {
	Field    string
	FieldIdx int
	Required bool
	Parser   ParserDipatcher
}

type LazyExpressionWrapper

type LazyExpressionWrapper struct {
	// contains filtered or unexported fields
}

func (*LazyExpressionWrapper) Delegate

func (self *LazyExpressionWrapper) Delegate() types.Any

func (*LazyExpressionWrapper) Reduce

func (self *LazyExpressionWrapper) Reduce(ctx context.Context) types.Any

func (*LazyExpressionWrapper) ReduceWithScope

func (self *LazyExpressionWrapper) ReduceWithScope(ctx context.Context, scope types.Scope) types.Any

type Parser

type Parser struct {
	Fields []*FieldParser
}

func BuildParser

func BuildParser(v reflect.Value) (*Parser, error)

Builds a cacheable parser that can parse into

func GetParser

func GetParser(target reflect.Value) (*Parser, error)

func (*Parser) Parse

func (self *Parser) Parse(
	ctx context.Context, scope types.Scope, args *ordereddict.Dict, target reflect.Value) error

type ParserDipatcher

type ParserDipatcher func(ctx context.Context,
	scope types.Scope, args *ordereddict.Dict,
	value interface{}) (interface{}, error)

type StoredQueryWrapperLazyExpression

type StoredQueryWrapperLazyExpression struct {
	// contains filtered or unexported fields
}

Wrap a Stored Query with a LazyExpr interface. Callers will receive the Stored Query when reducing us.

func (*StoredQueryWrapperLazyExpression) Delegate

func (*StoredQueryWrapperLazyExpression) Reduce

func (*StoredQueryWrapperLazyExpression) ReduceWithScope

func (self *StoredQueryWrapperLazyExpression) ReduceWithScope(
	ctx context.Context, scope types.Scope) types.Any

Jump to

Keyboard shortcuts

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