Hi,
Is it possible/planned to support calling method on "current context".
extracted from https://golang.org/pkg/text/template/ :
- The name of a niladic method of the data, preceded by a period,
such as
.Method
The result is the value of invoking the method with dot as the
receiver, dot.Method(). Such a method must have one return value (of
any type) or two return values, the second of which is an error.
If it has two and the returned error is non-nil, execution terminates
and an error is returned to the caller as the value of Execute.
Method invocations may be chained and combined with fields and keys
to any depth:
.Field1.Key1.Method1.Field2.Key2.Method2
Methods can also be evaluated on variables, including chaining:
$x.Method1.Field
My use case:
being able to call getter / lazy computed value from struct like Path / Uri (path(), filename(), hostname(), lazy value),
because computing those value before, could be costly and useless (if not used in the template).
(Thanks for your work)
Hi,
Is it possible/planned to support calling method on "current context".
extracted from https://golang.org/pkg/text/template/ :
My use case:
being able to call getter / lazy computed value from struct like Path / Uri (path(), filename(), hostname(), lazy value),
because computing those value before, could be costly and useless (if not used in the template).
(Thanks for your work)