ContainsSingleton checks whether a singleton with the specified name exists.
(name string)
| 215 | |
| 216 | // ContainsSingleton checks whether a singleton with the specified name exists. |
| 217 | func (d *DefaultContainer) ContainsSingleton(name string) bool { |
| 218 | d.muSingletons.Lock() |
| 219 | defer d.muSingletons.Unlock() |
| 220 | |
| 221 | _, exists := d.singletons[name] |
| 222 | return exists |
| 223 | } |
| 224 | |
| 225 | // Singleton retrieves the singleton instance associated with the given name. |
| 226 | // Returns the instance and a boolean indicating its existence. |
no outgoing calls