Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pongo2TemplateEngine ¶
type Pongo2TemplateEngine struct{}
Pongo2TemplateEngine 使用pongo2作为模板引擎的实现
func (*Pongo2TemplateEngine) EvaluateBool ¶
EvaluateBool 评估模板表达式,返回布尔值
func (*Pongo2TemplateEngine) EvaluateString ¶
func (e *Pongo2TemplateEngine) EvaluateString(expression string, ctx map[string]any) (string, error)
EvaluateString 评估模板表达式,返回字符串
func (*Pongo2TemplateEngine) Validate ¶
func (e *Pongo2TemplateEngine) Validate(expression string) error
Validate 验证表达式语法是否正确
type TemplateEngine ¶
type TemplateEngine interface {
// EvaluateBool 评估模板表达式,返回布尔值
EvaluateBool(expression string, ctx map[string]any) (bool, error)
// EvaluateString 评估模板表达式,返回字符串
EvaluateString(expression string, ctx map[string]any) (string, error)
// Validate 验证表达式语法是否正确
Validate(expression string) error
}
TemplateEngine 模板引擎接口,用于表达式求值
func NewPongo2TemplateEngine ¶
func NewPongo2TemplateEngine() TemplateEngine
NewPongo2TemplateEngine 创建一个新的Pongo2模板引擎实例
Click to show internal directories.
Click to hide internal directories.