Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/alecthomas/inject
/ functions
Functions
92 in github.com/alecthomas/inject
⨍
Functions
92
◇
Types & classes
24
↓ 33 callers
Function
SafeNew
SafeNew creates a new SafeInjector. The injector itself is already bound, as is an implementation of the Binder interface.
safe.go:31
↓ 32 callers
Method
Bind
(things ...interface{})
inject.go:18
↓ 22 callers
Method
Get
Get acquires a value of type t from the injector. It is usually preferable to use Call().
inject.go:106
↓ 14 callers
Method
Build
Build returns the type associated with the value being bound, and a function that builds that value at runtime.
annotations.go:13
↓ 14 callers
Method
Install
(module ...interface{})
inject.go:20
↓ 12 callers
Method
Call
Call calls f, injecting any arguments, and panics if the function errors.
inject.go:115
↓ 7 callers
Function
Annotate
Annotate ensures that v is an annotation, and returns it. Specifically: - If v is already an Annotation it will be returned as-is. - If v is a funct
annotations.go:25
↓ 7 callers
Function
Sequence
Sequence annotates a provider or binding to indicate it is part of a slice of values implementing the given type. injector.Bind(Sequence([]int{1}))
annotations.go:186
↓ 6 callers
Method
BindTo
(to interface{}, impl interface{})
inject.go:19
↓ 6 callers
Method
Is
Is checks if the annotation or any children are of the given annotation type.
annotations.go:15
↓ 6 callers
Function
Mapping
Mapping annotates a provider or binding to indicate it is part of a mapping of keys to values. injector.Bind(Mapping(map[string]int{"one": 1})) i
annotations.go:243
↓ 4 callers
Function
Singleton
Singleton annotates a provider function to indicate that the provider will only be called once, and that its return value will be used for all subsequ
annotations.go:135
↓ 4 callers
Method
String
()
inject_test.go:21
↓ 3 callers
Method
Validate
Validate that the function f can be called by the injector.
inject.go:131
↓ 3 callers
Method
resolve
(t reflect.Type)
safe.go:229
↓ 2 callers
Method
Bind
Bind binds a value to the injector. See Injector.Bind() for details.
safe.go:110
↓ 2 callers
Function
Literal
Literal annotates a value as being provided as-is with no further transformation.
annotations.go:37
↓ 2 callers
Function
Provider
Provider annotates a function to indicate it should be called whenever the type of its return value is requested.
annotations.go:66
↓ 2 callers
Method
getReflected
(t reflect.Type)
safe.go:265
↓ 1 callers
Method
Bind
Bind binds a value to the injector. Panics on error. See the README (https://github.com/alecthomas/inject/blob/master/README.md) for more details.
inject.go:79
↓ 1 callers
Method
BindTo
BindTo binds an implementation to an interface. See Injector.BindTo() for details.
safe.go:128
↓ 1 callers
Method
BindTo
BindTo binds an interface to a value. Panics on error. "as" should either be a nil pointer to the required interface: i.BindTo((*fmt.Stringer)(nil
inject.go:96
↓ 1 callers
Method
Child
Child creates a child Injector whose bindings overlay those of the parent. The parent will never be modified by the child.
inject.go:126
↓ 1 callers
Method
Configure
(binder Binder)
inject.go:27
↓ 1 callers
Function
New
New creates a new Injector. An unsafe injector panics on any error. This is commonly used because DI failures are generally not user-recoverable. Th
inject.go:40
↓ 1 callers
Method
handleDuplicate
(existing reflect.Value, incoming reflect.Value)
safe.go:95
↓ 1 callers
Method
resolveMapping
(t reflect.Type)
safe.go:196
↓ 1 callers
Method
resolveSlice
(t reflect.Type)
safe.go:163
Method
Bind
(things ...interface{})
safe.go:21
Method
BindTo
(to interface{}, impl interface{})
safe.go:22
Method
Build
(*SafeInjector)
annotations.go:49
Method
Build
(i *SafeInjector)
annotations.go:70
Method
Build
(i *SafeInjector)
annotations.go:143
Method
Build
(i *SafeInjector)
annotations.go:194
Method
Build
(i *SafeInjector)
annotations.go:247
Method
Call
Call f, injecting any arguments.
safe.go:283
Method
Child
Child creates a child SafeInjector whose bindings overlay those of the parent. The parent will never be modified by the child.
safe.go:308
Method
Configure
(binder Binder)
inject_test.go:366
Method
Configure
(binder Binder)
inject_test.go:373
Method
Get
Get acquires a value of type t from the injector. It is usually preferable to use Call().
safe.go:261
Method
Install
(module ...interface{})
safe.go:23
Method
Install
Install installs a module. See Injector.Install() for details.
safe.go:47
Method
Install
Install a module. A module is a struct whose methods are providers. This is useful for grouping configuration data together with providers. Duplicate
inject.go:69
Method
Is
(annotation Annotation)
annotations.go:56
Method
Is
(annotation Annotation)
annotations.go:119
Method
Is
(annotation Annotation)
annotations.go:171
Method
Is
(annotation Annotation)
annotations.go:225
Method
Is
(annotation Annotation)
annotations.go:285
Method
ProvideInt
(string)
inject_test.go:334
Method
ProvideInt
()
inject_test.go:388
Method
ProvideString
(i int)
inject_test.go:214
Method
ProvideString
(int)
inject_test.go:338
Method
Safe
Safe returns the underlying SafeInjector.
inject.go:136
Method
String
()
annotations.go:45
Method
String
()
inject_test.go:29
Method
String
()
inject_test.go:238
Method
String
()
inject_test.go:242
Function
TestCallError
(t *testing.T)
inject_test.go:227
Function
TestChildInjector
(t *testing.T)
inject_test.go:99
Function
TestDuplicateNamedBindErrors
(t *testing.T)
inject_test.go:302
Function
TestDynamicInjection
(t *testing.T)
inject_test.go:146
Function
TestGetUnboundType
(t *testing.T)
inject_test.go:72
Function
TestInjectorBind
(t *testing.T)
inject_test.go:11
Function
TestInjectorBindTo
(t *testing.T)
inject_test.go:33
Function
TestInjectorBindToInvalidImplementation
(t *testing.T)
inject_test.go:65
Function
TestInjectorBindToStruct
(t *testing.T)
inject_test.go:43
Function
TestInjectorBindToTypeAlias
(t *testing.T)
inject_test.go:52
Function
TestInjectorCall
(t *testing.T)
inject_test.go:112
Function
TestInstallConfigurableModule
(t *testing.T)
inject_test.go:378
Function
TestInstallDifferingDuplicateModule
(t *testing.T)
inject_test.go:356
Function
TestInstallIdenticalDuplicateModule
(t *testing.T)
inject_test.go:348
Function
TestInstallNewNonZeroModuleOverwritesExisting
(t *testing.T)
inject_test.go:401
Function
TestInstallNewZeroModuleKeepsExisting
(t *testing.T)
inject_test.go:390
Function
TestInterfaceConversion
(t *testing.T)
inject_test.go:244
Function
TestIs
(t *testing.T)
inject_test.go:298
Function
TestLiteral
(t *testing.T)
inject_test.go:190
Function
TestMapValueInterfaceConversion
(t *testing.T)
inject_test.go:269
Function
TestMappingAnnotation
(t *testing.T)
inject_test.go:174
Function
TestMappingIsNotImplicitlyProvided
(t *testing.T)
inject_test.go:291
Function
TestModule
(t *testing.T)
inject_test.go:216
Function
TestProvider
(t *testing.T)
inject_test.go:78
Function
TestProviderCycle
(t *testing.T)
inject_test.go:340
Function
TestProviderGraph
(t *testing.T)
inject_test.go:90
Function
TestPseudoBoundValues
(t *testing.T)
inject_test.go:202
Function
TestSequenceAnnotation
(t *testing.T)
inject_test.go:164
Function
TestSingletonAnnotation
(t *testing.T)
inject_test.go:127
Function
TestSingletonToNonProviderPanics
(t *testing.T)
inject_test.go:139
Function
TestSliceInterfaceConversion
(t *testing.T)
inject_test.go:254
Function
TestSliceIsNotImplicitlyProvided
(t *testing.T)
inject_test.go:284
Function
TestValidate
(t *testing.T)
inject_test.go:312
Method
Unsafe
()
safe.go:42
Method
Validate
Validate that the function f can be called by the injector.
safe.go:315