Skip to content

Commit

Permalink
renderview
Browse files Browse the repository at this point in the history
  • Loading branch information
iesreza committed Jul 26, 2022
1 parent e527bd9 commit f17ab9b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions evo.context.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (r *Request) View(mixed ...interface{}) {
buff = nil
}

type View func(request *Request) []interface{}
type View func(*Request, jet.VarMap) []interface{}

func (r *Request) RenderView(mixed ...interface{}) *bytes.Buffer {
//input interface{}, views ...string
Expand All @@ -158,10 +158,10 @@ func (r *Request) RenderView(mixed ...interface{}) *bytes.Buffer {
}
case reflect.Func:
var resp []interface{}
if fn, ok := item.(func(request *Request) []interface{}); ok {
resp = fn(r)
if fn, ok := item.(func(*Request, jet.VarMap) []interface{}); ok {
resp = fn(r, vars)
} else if fn, ok := item.(View); ok {
resp = fn(r)
resp = fn(r, vars)
}
for _, p := range resp {
var in = reflect.ValueOf(p)
Expand Down

0 comments on commit f17ab9b

Please sign in to comment.