RemoveSingleton removes the singleton instance associated with the specified name.
(name string)
| 237 | |
| 238 | // RemoveSingleton removes the singleton instance associated with the specified name. |
| 239 | func (d *DefaultContainer) RemoveSingleton(name string) error { |
| 240 | d.muSingletons.Lock() |
| 241 | defer d.muSingletons.Unlock() |
| 242 | |
| 243 | if _, exists := d.singletons[name]; !exists { |
| 244 | return ErrInstanceNotFound |
| 245 | } |
| 246 | |
| 247 | delete(d.singletons, name) |
| 248 | delete(d.typesOfSingletons, name) |
| 249 | |
| 250 | return nil |
| 251 | } |
| 252 | |
| 253 | // CanResolve checks if a component with the given name is resolvable. |
| 254 | func (d *DefaultContainer) CanResolve(name string) bool { |
no outgoing calls