Skip to content

Commit

Permalink
Adding RequestRenderable & Func
Browse files Browse the repository at this point in the history
  • Loading branch information
stanistan committed Dec 6, 2023
1 parent 7008a94 commit bda46e0
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions http_request_renderable.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package veun

import (
"net/http"
)

// RequestRenderable represents a method that
// can create a view out of an http.Request.
type RequestRenderable interface {
RequestRenderable(r *http.Request) (AsRenderable, error)
}

// RequestRenderableFunc is the function representation of a
// RequestRenderable.
type RequestRenderableFunc func(*http.Request) (AsRenderable, error)

// RequestRenderable conforms RequestRenderableFunc to
// RequestRenderable interface.
func (f RequestRenderableFunc) RequestRenderable(r *http.Request) (AsRenderable, error) {
return f(r)
}

0 comments on commit bda46e0

Please sign in to comment.