MCPcopy Create free account
hub / github.com/codnect/procyon / RemoveSingleton

Method RemoveSingleton

component/container.go:239–251  ·  view source on GitHub ↗

RemoveSingleton removes the singleton instance associated with the specified name.

(name string)

Source from the content-addressed store, hash-verified

237
238// RemoveSingleton removes the singleton instance associated with the specified name.
239func (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.
254func (d *DefaultContainer) CanResolve(name string) bool {

Callers 1

Calls

no outgoing calls

Tested by 1