4
4
"reflect"
5
5
)
6
6
7
- // Option is an interface for configuring components loaded into the gone framework.
7
+ // Option is an interface for configuring Goners loaded into the gone framework.
8
8
type Option interface {
9
9
Apply (c * coffin ) error
10
10
}
@@ -20,8 +20,8 @@ func (o option) Apply(c *coffin) error {
20
20
return o .apply (c )
21
21
}
22
22
23
- // IsDefault returns an Option that marks a component as the default implementation for its type.
24
- // When multiple components of the same type exist, the default one will be used for injection
23
+ // IsDefault returns an Option that marks a Goner as the default implementation for its type.
24
+ // When multiple Goners of the same type exist, the default one will be used for injection
25
25
// if no specific name is requested.
26
26
//
27
27
// Example usage:
@@ -68,7 +68,7 @@ func IsDefault(objPointers ...any) Option {
68
68
}
69
69
}
70
70
71
- // Order returns an Option that sets the start order for a component .
71
+ // Order returns an Option that sets the start order for a Goner .
72
72
// Components with lower order values will be started before those with higher values.
73
73
// This can be used to control started sequence when specific ordering is required.
74
74
//
@@ -100,15 +100,15 @@ func LowStartPriority() Option {
100
100
return Order (100 )
101
101
}
102
102
103
- // Name returns an Option that sets a custom name for a component .
103
+ // Name returns an Option that sets a custom name for a Goner .
104
104
// Components can be looked up by this name when injecting dependencies.
105
105
//
106
106
// Example usage:
107
107
//
108
108
// gone.Load(&EnvConfigure{}, gone.GonerName("configure"))
109
109
//
110
110
// Parameters:
111
- // - name: String identifier to use for this component
111
+ // - name: String identifier to use for this Goner
112
112
func Name (name string ) Option {
113
113
return option {
114
114
apply : func (c * coffin ) error {
@@ -118,8 +118,8 @@ func Name(name string) Option {
118
118
}
119
119
}
120
120
121
- // OnlyForName returns an Option that marks a component as only available for name-based injection.
122
- // When this option is used, the component will not be registered as a type provider,
121
+ // OnlyForName returns an Option that marks a Goner as only available for name-based injection.
122
+ // When this option is used, the Goner will not be registered as a type provider,
123
123
// meaning it can only be injected by explicitly referencing its name.
124
124
//
125
125
// Example usage:
@@ -136,15 +136,15 @@ func OnlyForName() Option {
136
136
}
137
137
}
138
138
139
- // ForceReplace returns an Option that allows replacing existing components with the same name or type.
140
- // When loading a component with this option:
141
- // - If a component with the same name already exists, it will be replaced
139
+ // ForceReplace returns an Option that allows replacing loaded Goners with the same name or type.
140
+ // When loading a Goner with this option:
141
+ // - If a Goner with the same name already exists, it will be replaced
142
142
// - If a provider for the same type already exists, it will be replaced
143
143
//
144
144
// Example usage:
145
145
//
146
146
// gone.Load(&MyService{}, gone.GonerName("service"), gone.ForceReplace())
147
- // // This will replace any existing component named "service"
147
+ // // This will replace any existing Goner named "service"
148
148
func ForceReplace () Option {
149
149
return option {
150
150
apply : func (c * coffin ) error {
@@ -154,14 +154,12 @@ func ForceReplace() Option {
154
154
}
155
155
}
156
156
157
- // LazyFill returns an Option that marks a component as lazy-filled.
158
- // When this option is used, the component will not be loaded until it is actually injected.
159
- // This can be useful for components that are expensive to load or have external dependencies.
157
+ // LazyFill returns an Option that marks a Goner as lazy-filled.
158
+ // When this option is used, the Goner will be filled at last.
160
159
//
161
160
// Example usage:
162
161
//
163
162
// gone.Load(&MyService{}, gone.GonerName("service"), gone.LazyFill())
164
- // // This will load the component only when it is actually injected
165
163
func LazyFill () Option {
166
164
return option {
167
165
apply : func (c * coffin ) error {
0 commit comments