-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbinding.go
30 lines (23 loc) · 929 Bytes
/
binding.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package container
import "reflect"
type Binding struct {
// Function, Concrete, Abstract
// Function is a function we call to get a resolved value
// Concrete is resolvable by passing a type of the concrete
// Abstract is our Abstract -> Concrete resolver. We provide an interface, and get a service implementation.
// Singleton
bindingType string
// The function to call when our bindingType is Function
resolverFunction any
// If we have a resolver function to call upon resolve
// If this is false, we'll just create a new instance of concreteType
isFunctionResolver bool
// Set to true when we create this binding as a singleton
isSingleton bool
// Our abstract type, this is usually an interface
// If we only bound a concrete implementation, this will also be our concrete
abstractType reflect.Type
// This is our actually resolvable concrete type
concreteType reflect.Type
invocable *Invocable
}