Add wrappers for Pongo's AsValue() and AsSaveValue()

Former-commit-id: 642c8709b7566dbe5827759155167ec4d82212e3
This commit is contained in:
Alexey McSakoff 2018-02-25 12:28:17 +04:00
parent d7beb9a752
commit a1aa1b66c6

View File

@ -44,6 +44,18 @@ type (
TagParser func(doc *Parser, start *Token, arguments *Parser) (INodeTag, *Error)
)
// AsValue converts any given value to a view.Value.
// Usually being used within own functions passed to a template
// through a Context or within filter functions.
func AsValue(i interface{}) *Value {
return (*Value)(pongo2.AsValue(i))
}
// AsSafeValue works like AsValue, but does not apply the 'escape' filter.
func AsSafeValue(i interface{}) *Value {
return (*Value)(pongo2.AsSafeValue(i))
}
// GetValue returns the `Value` as *pongo2.Value type.
// This method was added by balthild at https://github.com/kataras/iris/pull/765
func (value *Value) GetValue() *pongo2.Value {