template

package
v0.0.0-...-3cc3ff2 Latest Latest
Warning

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

Go to latest
Published: May 17, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TemplateOpen tag
	TemplateOpen = "{{"
	// TemplateClose tag
	TemplateClose = "}}"

	// ReferenceDelimiter represents the value resource reference delimiter
	ReferenceDelimiter = ":"
	// PathDelimiter represents the path reference delimiter
	PathDelimiter = "."

	// InputResource key
	InputResource = "input"
	// OutputResource key
	OutputResource = "output"
	// StackResource property
	StackResource = "stack"
	// ParamsResource property
	ParamsResource = "params"
	// RequestResource property
	RequestResource = "request"
	// HeaderResource property
	HeaderResource = "header"
	// ResponseResource property
	ResponseResource = "response"
	// ErrorResource property
	ErrorResource = "error"

	// DefaultInputResource represents the default input property on resource select
	DefaultInputResource = RequestResource
	// DefaultCallResource represents the default call property on resource select
	DefaultCallResource = ResponseResource
)

Variables

View Source
var (
	// ReferencePattern is the matching pattern for references
	ReferencePattern = regexp.MustCompile(`^[a-zA-Z0-9_\-\.]*:[a-zA-Z0-9\^\&\%\$@_\-\.]*$`)
	// StringPattern is the matching pattern for strings
	StringPattern = regexp.MustCompile(`^\'(.+)\'$`)
)

Functions

func GetTemplateContent

func GetTemplateContent(value string) string

GetTemplateContent trims the opening and closing tags from the given template value

func Is

func Is(value string) bool

Is checks whether the given value is a template

func JoinPath

func JoinPath(values ...string) (result string)

JoinPath joins the given flow paths

func Parse

func Parse(ctx *broker.Context, path string, name string, value string) (*specs.Property, error)

Parse parses the given value template and sets the resource and path

func ParseContent

func ParseContent(path string, name string, content string) (*specs.Property, error)

ParseContent parses the given template function

func ParsePropertyReference

func ParsePropertyReference(value string) *specs.PropertyReference

ParsePropertyReference parses the given value to a property reference

func ParseReference

func ParseReference(path string, name string, value string) (*specs.Property, error)

ParseReference parses the given value as a template reference

func ResourcePath

func ResourcePath(resource string, paths ...string) string

ResourcePath constructs a new path using the given resource and path.

func SplitPath

func SplitPath(path string) []string

SplitPath splits the given path into parts

Types

type ErrPathNotFound

type ErrPathNotFound struct {
	Path string
}

ErrPathNotFound occurs when path cannot be resolved

func (ErrPathNotFound) Error

func (e ErrPathNotFound) Error() string

Error returns a description of the given error as a string

func (ErrPathNotFound) Prettify

func (e ErrPathNotFound) Prettify() prettyerr.Error

Prettify returns the prettified version of the given error

Jump to

Keyboard shortcuts

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