File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -5,17 +5,25 @@ import (
55 "html/template"
66)
77
8+ // Renderable represents any struct that can be rendered
9+ // in the Render function.
810type Renderable interface {
11+ // Template provides the template object / parsed and compiled,
12+ // that Render will execute given a context.
913 Template (ctx context.Context ) (* template.Template , error )
14+ // TemplateData provides the data to the template given a context.
1015 TemplateData (ctx context.Context ) (any , error )
1116}
1217
1318type AsRenderable interface {
19+ // Renderable produces a Renderable struct given a context.
1420 Renderable (ctx context.Context ) (Renderable , error )
1521}
1622
23+ // RenderableFunc is a function that conforms to the Renderable interface.
1724type RenderableFunc func (context.Context ) (Renderable , error )
1825
26+ // Renderable implements Renderable for RenderableFunc.
1927func (f RenderableFunc ) Renderable (ctx context.Context ) (Renderable , error ) {
2028 return f (ctx )
2129}
You can’t perform that action at this time.
0 commit comments