MCPcopy Create free account
hub / github.com/kataras/iris / fromDependencyHandler

Function fromDependencyHandler

hero/dependency.go:132–154  ·  view source on GitHub ↗
(_ reflect.Value, dest *Dependency)

Source from the content-addressed store, hash-verified

130}
131
132func fromDependencyHandler(_ reflect.Value, dest *Dependency) bool {
133 // It's already on the desired form, just return it.
134 dependency := dest.OriginalValue
135 handler, ok := dependency.(DependencyHandler)
136 if !ok {
137 handler, ok = dependency.(func(*context.Context, *Input) (reflect.Value, error))
138 if !ok {
139 // It's almost a handler, only the second `Input` argument is missing.
140 if h, is := dependency.(func(*context.Context) (reflect.Value, error)); is {
141 handler = func(ctx *context.Context, _ *Input) (reflect.Value, error) {
142 return h(ctx)
143 }
144 ok = is
145 }
146 }
147 }
148 if !ok {
149 return false
150 }
151
152 dest.Handle = handler
153 return true
154}
155
156func fromBuiltinValue(v reflect.Value, dest *Dependency) bool {
157 if !isBuiltinValue(v) {

Callers 1

resolveDependencyFunction · 0.85

Calls 1

hFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…