compiler

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EntityCompiler = "compiler"

	// ISODateFormat https://en.wikipedia.org/wiki/ISO_8601
	ISODateFormat = "2006-01-02"

	ISOTimeFormat = time.RFC3339
)

Variables

This section is empty.

Functions

func Date

func Date(timeStr string) (string, error)

func DateModify

func DateModify(fmt string, date time.Time) time.Time

func Join

func Join(sep string, v []string) string

func List

func List(v ...string) []string

func OptimusFuncMap

func OptimusFuncMap() template.FuncMap

func PrepareContext

func PrepareContext(builders ...ContextOpts) map[string]interface{}

func Replace

func Replace(old, newStr, name string) string

func Trunc

func Trunc(c int, s string) string

func UnixEpoch

func UnixEpoch(date time.Time) string

Types

type ContextOpts

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

func From

func From(confs ...map[string]string) ContextOpts

func (ContextOpts) AddToContext

func (b ContextOpts) AddToContext() ContextOpts

func (ContextOpts) WithKeyPrefix

func (b ContextOpts) WithKeyPrefix(prefix string) ContextOpts

func (ContextOpts) WithName

func (b ContextOpts) WithName(name string) ContextOpts

type Engine

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

Engine compiles a set of defined macros using the provided context

func NewEngine

func NewEngine() *Engine

func (*Engine) Compile

func (e *Engine) Compile(templateMap map[string]string, context map[string]any) (map[string]string, error)

func (*Engine) CompileString

func (e *Engine) CompileString(input string, context map[string]any) (string, error)

Jump to

Keyboard shortcuts

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