-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathapi.go
More file actions
34 lines (24 loc) · 718 Bytes
/
api.go
File metadata and controls
34 lines (24 loc) · 718 Bytes
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
31
32
33
34
/*
## htmlgo
Type safe and modularize way to generate html on server side.
Download the package with `go get -v github.com/theplant/htmlgo` and import the package with `.` gives you simpler code:
import (
. "github.com/theplant/htmlgo"
)
also checkout full API documentation at: https://godoc.org/github.com/theplant/htmlgo
*/
package htmlgo
import (
"context"
)
type HTMLComponent interface {
MarshalHTML(ctx context.Context) ([]byte, error)
}
type ComponentFunc func(ctx context.Context) (r []byte, err error)
func (f ComponentFunc) MarshalHTML(ctx context.Context) (r []byte, err error) {
return f(ctx)
}
type MutableAttrHTMLComponent interface {
HTMLComponent
SetAttr(k string, v interface{})
}