Documentation ¶
Index ¶
- func FormatJSON(store references.Store, tracker references.Tracker, argument *specs.Property) (string, error)
- func FormatWithFunc(valueFormatter ValueFormatter) func(Precision) Formatter
- func Function(args ...*specs.Property) (*specs.Property, functions.Exec, error)
- type Constant
- type Constructor
- type Float
- type Formatter
- type FormatterDetector
- type Int
- type JSON
- type Precision
- type Printer
- type Radix
- type Scanner
- type String
- type Token
- type Tokens
- type TypeChecker
- type ValueFormatter
- type Verb
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatJSON ¶
func FormatJSON(store references.Store, tracker references.Tracker, argument *specs.Property) (string, error)
FormatJSON prints provided argument in a JSON format.
func FormatWithFunc ¶
func FormatWithFunc(valueFormatter ValueFormatter) func(Precision) Formatter
FormatWithFunc does common operations (e.g. retrieves scalar value from the reference store).
Types ¶
type Constructor ¶
Constructor is a formatter constructor.
type Float ¶
type Float struct{}
Float formatter.
type Formatter ¶
type Formatter func(store references.Store, tracker references.Tracker, argument *specs.Property) (string, error)
Formatter is a function to be called in order to format the argument value.
type FormatterDetector ¶
type FormatterDetector interface {
Detect(input string) (Constructor, bool)
}
FormatterDetector detects formatter (if possible) from provided input.
type Int ¶
type Int struct{}
Int formatter.
type JSON ¶
type JSON struct{}
JSON formatter.
type Radix ¶
type Radix struct {
// contains filtered or unexported fields
}
Radix tree based implementation of Formatter registry.
func (*Radix) Detect ¶
func (r *Radix) Detect(input string) (Constructor, bool)
Detect if input string starts with one of the registered verbs.
func (*Radix) Register ¶
func (r *Radix) Register(constructor Constructor) error
Register provided Formatter.
type Scanner ¶
Scanner scans provided string splitting it up by tokens.
func NewScanner ¶
func NewScanner(detector FormatterDetector) Scanner
NewScanner creates a stateful scanner with provided formatter detector. Current implementation does not have a state so it can be used concurrently.
type String ¶
type String struct{}
String formatter.
type Tokens ¶
type Tokens []Token
Tokens is a list of tokens (implements Printer interface).
type TypeChecker ¶
TypeChecker determines if the provided type can be formatted by the formatter.
type ValueFormatter ¶
ValueFormatter formats a scalar value with provided precision.