interpolator

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultInterpolationExamples = map[string]interface{}{
	"count":        42,
	"total":        42,
	"limit":        1000,
	"maxLimit":     5000,
	"value":        83,
	"year":         `2006`,
	"color":        "blue",
	"colour":       "green",
	"error":        "Simulated error",
	"errormessage": "Simulated error",
	"errormsg":     "Simulated error",
	"regionname":   "Gigantis",
	"region":       "Gigantis",
	"country":      "Japan",
	"countryname":  "Japan",
	"companyname":  "Wily",
	"user":         "Roll",
	"username":     "Roll",
	"name":         "Douglas Dagurasu",
	"firstName":    "Axl",
	"lastName":     "Akuseru",
	"month":        "August",
	"price":        "5000",
	"email":        "roll@example.com",
	"date":         mustParseDate("1987-12-17T06:00:00-09:00"),
	"expires":      mustParseDate("1995-03-24T06:00:00-09:00"),
	"days":         6,
}

Functions

This section is empty.

Types

type AstKind

type AstKind int
const (
	AstKindLiteral AstKind = iota
)

type InterpolationAST

type InterpolationAST struct {
	Kind AstKind
}

type InterpolationOptions

type InterpolationOptions struct {
	// Used to sepearte format from Interpolation value. Default: ","
	// Not yet supported
	FormatSeperator string
	// Prefix for Interpolation. Default: "{{"
	// Not yet supported
	Prefix string
	// Suffix for Interpolation. Default: "{{"
	// Not yet supported
	Suffix string

	// Prefix for nesting of Interpolation. Default: "$t("
	// Not yet supported
	NestingPrefix string
	// Suffix for nesting of Interpolation. Default: ")"
	// Not yet supported
	NestingSuffix string
	// Seperates the options from nesting key. Default: ","
	// Not yet supported
	NestingOptionsSeperator string

	// global variables to use in interpolation replacements: Default: null, but examples uses defaultInterpolationExamples
	// Not yet supported
	DefaultVariables map[string]interface{}
	// After How many interpolation runs to break out before throwing a stack overflow: Default: 1000
	// Not yet supported
	MaxReplaces int

	// Will skip to interpolate the variables, example:
	// Not yet supported
	SkipOnVariables bool
}

type Interpolator

type Interpolator struct {
	Options InterpolationOptions
}

func NewInterpolator

func NewInterpolator() Interpolator

func (*Interpolator) Infer

func (ip *Interpolator) Infer(s string) InterpolationAST

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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