parse

package
v4.2.5-beta.2+incompat... Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2020 License: Apache-2.0 Imports: 8 Imported by: 24

Documentation

Index

Constants

View Source
const (
	// EmailNamespace is a function namespace for email functions
	EmailNamespace = "email"
	// EmailLocalFnName is a name for email.local function
	EmailLocalFnName = "local"
)

Variables

This section is empty.

Functions

func EmailLocal

func EmailLocal(in string) (string, error)

EmailLocal returns local part of the email

Types

type Expression

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

Expression is an expression template that can interpolate to some variables

func RoleVariable

func RoleVariable(variable string) (*Expression, error)

RoleVariable checks if the passed in string matches the variable pattern {{external.foo}} or {{internal.bar}}. If it does, it returns the variable prefix and the variable name. In the previous example this would be "external" or "internal" for the variable prefix and "foo" or "bar" for the variable name. If no variable pattern is found, trace.NotFound is returned.

func (*Expression) Interpolate

func (p *Expression) Interpolate(traits map[string][]string) ([]string, error)

Interpolate interpolates the variable adding prefix and suffix if present, returns trace.NotFound in case if the trait is not found, nil in case of success and BadParameter error otherwise

func (*Expression) Name

func (p *Expression) Name() string

Name returns variable name

func (*Expression) Namespace

func (p *Expression) Namespace() string

Namespace returns a variable namespace, e.g. external or internal

type TransformFn

type TransformFn func(in string) (string, error)

TransformFn is an optional transform function that can take in string and replace it with another value

Jump to

Keyboard shortcuts

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