As constructs the instance and bind it to another interface. As means to be used as an argument to graph.Provide. For example: As(MyConstructor, new(MyAbstractInterface))
(constructor interface{}, as interface{})
| 33 | // For example: |
| 34 | // As(MyConstructor, new(MyAbstractInterface)) |
| 35 | func As(constructor interface{}, as interface{}) interface{} { |
| 36 | if op, ok := constructor.(OptionalProvider); ok { |
| 37 | op.Options = append(op.Options, dig.As(as)) |
| 38 | return op |
| 39 | } |
| 40 | return OptionalProvider{ |
| 41 | Constructor: constructor, |
| 42 | Options: []dig.ProvideOption{dig.As(as)}, |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | // Name constructs a named instance. Name means to be used as an argument to graph.Provide. |
| 47 | // For example: |
no outgoing calls