template

package
v0.0.0-...-c693505 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2026 License: MIT Imports: 7 Imported by: 0

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

func (e *Pongo2TemplateEngine) EvaluateBool(expression string, ctx map[string]any) (bool, error)

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模板引擎实例

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL