Documentation
¶
Index ¶
- type Builtin
- type Logger
- type Opts
- type Syringe
- func (s *Syringe) Add(a, b interface{}) (interface{}, error)
- func (s *Syringe) AddByte(str string, val interface{}) (string, error)
- func (s *Syringe) AddElements(list []interface{}, els ...interface{}) []interface{}
- func (s *Syringe) AliasesMap() template.FuncMap
- func (s *Syringe) Assert(cond bool, args ...interface{}) (string, error)
- func (s *Syringe) Builtins() []Builtin
- func (s *Syringe) Contains(haystack interface{}, needle interface{}) (bool, error)
- func (s *Syringe) Die(args ...interface{}) (string, error)
- func (s *Syringe) Div(a, b interface{}) (interface{}, error)
- func (s *Syringe) Env(str string) string
- func (s *Syringe) Expander() string
- func (s *Syringe) GetVal(m map[interface{}]interface{}, key interface{}) interface{}
- func (s *Syringe) HasElement(list []interface{}, el interface{}) bool
- func (s *Syringe) HasKey(m map[interface{}]interface{}, key interface{}) bool
- func (s *Syringe) IndexOf(list []interface{}, el interface{}) int
- func (s *Syringe) IsFloat(i interface{}) bool
- func (s *Syringe) IsInt(i interface{}) bool
- func (s *Syringe) IsList(i interface{}) bool
- func (s *Syringe) IsMap(i interface{}) bool
- func (s *Syringe) IsNumber(i interface{}) bool
- func (s *Syringe) List(args ...interface{}) []interface{}
- func (s *Syringe) Log(args ...interface{}) string
- func (s *Syringe) Loop(a, b int) <-chan int
- func (s *Syringe) Map(args ...interface{}) map[interface{}]interface{}
- func (s *Syringe) Mul(a, b interface{}) (interface{}, error)
- func (s *Syringe) SetKeyVal(m map[interface{}]interface{}, key, val interface{}) string
- func (s *Syringe) Strcat(args ...interface{}) string
- func (s *Syringe) Sub(a, b interface{}) (interface{}, error)
- func (s *Syringe) Type(i interface{}) (string, error)
- func (s *Syringe) Version() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger interface {
Print(v ...interface{})
}
Logger is an interface that Syringe uses for "log" statements.
type Opts ¶
type Opts struct {
Logger Logger // Used for "log" statements, defaults to https://pkg.go.dev/log
}
Opts are the options for New.
type Syringe ¶
type Syringe struct {
// contains filtered or unexported fields
}
Syringe is the receiver of the template functions injector.
func (*Syringe) AddByte ¶ added in v1.0.5
AddByte adds a byte to a string and returns the expanded string.
func (*Syringe) AddElements ¶
func (s *Syringe) AddElements(list []interface{}, els ...interface{}) []interface{}
AddElements is the builtin that adds elements to a list.
func (*Syringe) AliasesMap ¶
AliasesMap returns a `template.FuncMap` that can be passed to text/template so that shorthand builtins can be used.
func (*Syringe) Contains ¶ added in v1.0.4
Contains replaces HasElement or HasKey and offers substring matching.
func (*Syringe) Die ¶
Die is the builtin that stops execution. If previous `Log` invocations occurred, then the the reason for stopping is logged, else, the reason is shown on `os.Stderr`.
func (*Syringe) GetVal ¶
func (s *Syringe) GetVal(m map[interface{}]interface{}, key interface{}) interface{}
GetVal is the builtin that returns a value from a map given a key, or "".
func (*Syringe) HasElement ¶
HasElement is the builtin that checks whether a list contains an element. Deprecated: use Contains.
func (*Syringe) HasKey ¶
HasKey is the builtin that checks whether a map contains a key. Deprecated: use Contains.
func (*Syringe) IsFloat ¶
IsFloat is the builtin that evaluates to `true` when its argument is a floating point number.
func (*Syringe) IsInt ¶
IsInt is the builtin that evaluates to `true` when its argument is an integer.
func (*Syringe) IsList ¶
IsList is the builtin that evaluates to `true` when its argument is a list.
func (*Syringe) IsNumber ¶
IsNumber is the builtin that evaluates to `true` when its argument is a number (int or float).
func (*Syringe) List ¶
func (s *Syringe) List(args ...interface{}) []interface{}
List is the builtin that returns a list.
func (*Syringe) Map ¶
func (s *Syringe) Map(args ...interface{}) map[interface{}]interface{}
Map is the builtin that returns a map.
func (*Syringe) SetKeyVal ¶
SetKeyVal is the builtin that sets a value for a key in a map, or adds it.
func (*Syringe) Strcat ¶ added in v1.0.3
Strcat returns a string where all arguments are concatenated.