template

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: Apache-2.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultStringJoiner = NewStringJoiner()
View Source
var StopFlag = langctx.NewBoolFlag()

Functions

func Language

func Language(opts ...Option) gval.Language

Types

type DelimitedLanguage

type DelimitedLanguage struct {
	Start, End string
	Language   gval.Language
}

type DelimitedLanguageFactory

type DelimitedLanguageFactory interface {
	DelimitedLanguage(tpl gval.Language) *DelimitedLanguage
}

func DelimitedExpressionLanguageFactory

func DelimitedExpressionLanguageFactory(dl *DelimitedLanguage) DelimitedLanguageFactory

type DelimitedLanguageFactoryFunc

type DelimitedLanguageFactoryFunc func(tpl gval.Language) *DelimitedLanguage

func (DelimitedLanguageFactoryFunc) DelimitedLanguage

func (dlff DelimitedLanguageFactoryFunc) DelimitedLanguage(tpl gval.Language) *DelimitedLanguage

type EvaluationError added in v0.2.0

type EvaluationError struct {
	Start string
	Cause error
}

func (*EvaluationError) Error added in v0.2.0

func (e *EvaluationError) Error() string

func (*EvaluationError) Unwrap added in v0.2.0

func (e *EvaluationError) Unwrap() error

type Joiner

type Joiner interface {
	Join(ctx context.Context, a, b gval.Evaluable, parameter any) (any, error)
}

type JoinerFunc

type JoinerFunc func(ctx context.Context, a, b gval.Evaluable, parameter any) (any, error)

func (JoinerFunc) Join

func (jf JoinerFunc) Join(ctx context.Context, a, b gval.Evaluable, parameter any) (any, error)

type Option

type Option interface {
	ApplyToOptions(target *Options)
}

type Options

type Options struct {
	Joiner                     Joiner
	DelimitedLanguageFactories []DelimitedLanguageFactory
}

func (*Options) ApplyOptions

func (o *Options) ApplyOptions(opts []Option)

type StringFormatter

type StringFormatter interface {
	FormatString(ctx context.Context, v any) (string, error)
}
var DefaultStringFormatter StringFormatter = &defaultStringFormatter{}

type StringFormatterFunc

type StringFormatterFunc func(ctx context.Context, v any) (string, error)

func (StringFormatterFunc) FormatString

func (sff StringFormatterFunc) FormatString(ctx context.Context, v any) (string, error)

type StringJoiner

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

func NewStringJoiner

func NewStringJoiner(opts ...StringJoinerOption) *StringJoiner

func (*StringJoiner) Join

func (sj *StringJoiner) Join(ctx context.Context, a, b gval.Evaluable, parameter any) (any, error)

type StringJoinerOption

type StringJoinerOption interface {
	ApplyToStringJoinerOptions(target *StringJoinerOptions)
}

type StringJoinerOptions

type StringJoinerOptions struct {
	Formatter             StringFormatter
	EliminateEmptyStrings bool
}

func (*StringJoinerOptions) ApplyOptions

func (o *StringJoinerOptions) ApplyOptions(opts []StringJoinerOption)

type WithDelimitedLanguage

type WithDelimitedLanguage struct {
	*DelimitedLanguage
}

func (WithDelimitedLanguage) ApplyToOptions

func (wdl WithDelimitedLanguage) ApplyToOptions(target *Options)

type WithDelimitedLanguageFactory

type WithDelimitedLanguageFactory struct {
	DelimitedLanguageFactory
}

func (WithDelimitedLanguageFactory) ApplyToOptions

func (wdlf WithDelimitedLanguageFactory) ApplyToOptions(target *Options)

type WithEmptyStringsEliminated

type WithEmptyStringsEliminated bool

func (WithEmptyStringsEliminated) ApplyToStringJoinerOptions

func (wese WithEmptyStringsEliminated) ApplyToStringJoinerOptions(target *StringJoinerOptions)

type WithJoiner

type WithJoiner struct {
	Joiner
}

func (WithJoiner) ApplyToOptions

func (wj WithJoiner) ApplyToOptions(target *Options)

type WithStringFormatter

type WithStringFormatter struct {
	StringFormatter
}

func (WithStringFormatter) ApplyToStringJoinerOptions

func (wsf WithStringFormatter) ApplyToStringJoinerOptions(target *StringJoinerOptions)

Jump to

Keyboard shortcuts

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