Merged in jb/openapi (pull request #22)
add openapi infra * add openapi infra Includes generated stubs and all deps * generatetolocation * basesetupoffunctionsandclient * round1controllertests * passintegrationtests * cleanupfromfullsuite * storedjson * fixjsonyaml * fixtests Approved-by: Michael McGuinness
This commit is contained in:
committed by
Michael McGuinness
parent
5ca36b0502
commit
174644b63c
+29
@@ -0,0 +1,29 @@
|
||||
package echo
|
||||
|
||||
import "io"
|
||||
|
||||
// Renderer is the interface that wraps the Render function.
|
||||
type Renderer interface {
|
||||
Render(io.Writer, string, interface{}, Context) error
|
||||
}
|
||||
|
||||
// TemplateRenderer is helper to ease creating renderers for `html/template` and `text/template` packages.
|
||||
// Example usage:
|
||||
//
|
||||
// e.Renderer = &echo.TemplateRenderer{
|
||||
// Template: template.Must(template.ParseGlob("templates/*.html")),
|
||||
// }
|
||||
//
|
||||
// e.Renderer = &echo.TemplateRenderer{
|
||||
// Template: template.Must(template.New("hello").Parse("Hello, {{.}}!")),
|
||||
// }
|
||||
type TemplateRenderer struct {
|
||||
Template interface {
|
||||
ExecuteTemplate(wr io.Writer, name string, data any) error
|
||||
}
|
||||
}
|
||||
|
||||
// Render renders the template with given data.
|
||||
func (t *TemplateRenderer) Render(w io.Writer, name string, data interface{}, c Context) error {
|
||||
return t.Template.ExecuteTemplate(w, name, data)
|
||||
}
|
||||
Reference in New Issue
Block a user