Skip to content

Commit bda46e0

Browse files
committed
Adding RequestRenderable & Func
1 parent 7008a94 commit bda46e0

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

‎http_request_renderable.go‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package veun
2+
3+
import (
4+
"net/http"
5+
)
6+
7+
// RequestRenderable represents a method that
8+
// can create a view out of an http.Request.
9+
type RequestRenderable interface {
10+
RequestRenderable(r *http.Request) (AsRenderable, error)
11+
}
12+
13+
// RequestRenderableFunc is the function representation of a
14+
// RequestRenderable.
15+
type RequestRenderableFunc func(*http.Request) (AsRenderable, error)
16+
17+
// RequestRenderable conforms RequestRenderableFunc to
18+
// RequestRenderable interface.
19+
func (f RequestRenderableFunc) RequestRenderable(r *http.Request) (AsRenderable, error) {
20+
return f(r)
21+
}

0 commit comments

Comments
 (0)