forked from evergreen-ci/gimlet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrender.go
30 lines (26 loc) · 871 Bytes
/
render.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package gimlet
import (
"io"
"net/http"
)
// Renderer descibes an interface used to provide template caching and
// streaming for Go standard library templates.
type Renderer interface {
GetTemplate(...string) (RenderTemplate, error)
Render(io.Writer, interface{}, string, ...string) error
Stream(http.ResponseWriter, int, interface{}, string, ...string)
WriteResponse(http.ResponseWriter, int, interface{}, string, ...string)
}
// RenderTemplate describes the common interface used by Renderer
// implementations to interact with text or html templates.
type RenderTemplate interface {
ExecuteTemplate(io.Writer, string, interface{}) error
}
// RendererOptions descibes the common options passed to the renderer
// constructors.
type RendererOptions struct {
Functions map[string]interface{}
Directory string
Encoding string
DisableCache bool
}