Documentation ¶
Index ¶
- Variables
- func Middleware(e *TemplateEngine) echo.MiddlewareFunc
- func NewMiddleware(config TemplateConfig) echo.MiddlewareFunc
- func Render(ctx echo.Context, code int, name string, data interface{}) error
- type Delims
- type FileHandler
- type TemplateConfig
- type TemplateEngine
- func Default() *TemplateEngine
- func New(config TemplateConfig) *TemplateEngine
- func NewEmbed(fs embed.FS) *TemplateEngine
- func NewRice(viewsRootBox *rice.Box) *TemplateEngine
- func NewWithConfigEmbed(fs embed.FS, config TemplateConfig) *TemplateEngine
- func NewWithConfigRice(viewsRootBox *rice.Box, config TemplateConfig) *TemplateEngine
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultConfig = TemplateConfig{ Root: "views", Extension: ".html", Master: "layouts/master", Partials: []string{}, Funcs: make(template.FuncMap), DisableCache: false, Delims: Delims{Left: "{{", Right: "}}"}, }
DefaultConfig defines the default settings for templating
Functions ¶
func Middleware ¶
func Middleware(e *TemplateEngine) echo.MiddlewareFunc
func NewMiddleware ¶
func NewMiddleware(config TemplateConfig) echo.MiddlewareFunc
New gin middleware for func `gintemplate.Render()`
Types ¶
type FileHandler ¶
type FileHandler func(config TemplateConfig, tplFile string) (content string, err error)
func DefaultFileHandler ¶
func DefaultFileHandler() FileHandler
func FileHandlerEmbed ¶
func FileHandlerEmbed(fs embed.FS) FileHandler
func FileHandlerRice ¶
func FileHandlerRice(viewsRootBox *rice.Box) FileHandler
type TemplateConfig ¶
type TemplateEngine ¶
type TemplateEngine struct {
// contains filtered or unexported fields
}
func Default ¶
func Default() *TemplateEngine
func New ¶
func New(config TemplateConfig) *TemplateEngine
func NewEmbed ¶
func NewEmbed(fs embed.FS) *TemplateEngine
func NewRice ¶
func NewRice(viewsRootBox *rice.Box) *TemplateEngine
func NewWithConfigEmbed ¶
func NewWithConfigEmbed(fs embed.FS, config TemplateConfig) *TemplateEngine
func NewWithConfigRice ¶
func NewWithConfigRice(viewsRootBox *rice.Box, config TemplateConfig) *TemplateEngine
func (*TemplateEngine) Render ¶
func (e *TemplateEngine) Render(w io.Writer, name string, data interface{}, c echo.Context) error
func (*TemplateEngine) SetFileHandler ¶
func (e *TemplateEngine) SetFileHandler(handle FileHandler)
Click to show internal directories.
Click to hide internal directories.