(_ reflect.Value, dest *Dependency)
| 130 | } |
| 131 | |
| 132 | func 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 | |
| 156 | func fromBuiltinValue(v reflect.Value, dest *Dependency) bool { |
| 157 | if !isBuiltinValue(v) { |
no test coverage detected
searching dependent graphs…