Skip to content

Commit 2b70959

Browse files
committed
doc comments
1 parent 3588374 commit 2b70959

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

renderable.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff 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.
810
type 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

1318
type 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.
1724
type RenderableFunc func(context.Context) (Renderable, error)
1825

26+
// Renderable implements Renderable for RenderableFunc.
1927
func (f RenderableFunc) Renderable(ctx context.Context) (Renderable, error) {
2028
return f(ctx)
2129
}

0 commit comments

Comments
 (0)