/
container.go
27 lines (25 loc) · 1.03 KB
/
container.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
package container
//Container main interface for registering and fetching Services
type Container interface {
AddConstructor(id string, constructor Constructor)
AddNewMethod(id string, typedConstructor interface{}, constructorArgumentNames ...string)
Scan(id string, dest interface{})
ScanNonCached(id string, dest interface{})
ScanSecure(id string, isCached bool, dest interface{}) error
Get(id string, isCached bool) interface{}
GetSecure(id string, isCached bool) (interface{}, error)
Check()
Exists(id string) bool
AddGarbageCollectFunc(serviceName string, gcFunc GarbageCollectorFunc)
CollectGarbage() error
SetConstructor(id string, constructor Constructor)
SetNewMethod(id string, typedConstructor interface{}, constructorArgumentNames ...string)
}
//MergeableContainer containers that support merging
type MergeableContainer interface {
Merge(c MergeableContainer)
getConstructors() map[string]Constructor
getNewFuncConstructors() map[string]NewFuncConstructor
getCache() dependencyCache
getEventsContainer() EventsContainer
}