func (c *Type) Get(key string) interface{} {
	s, ok := c.definitions[key]
	if !ok {
		return nil
	}

	// Multi means we don't use a shared instance but instead instantiate a new object each time called
	if s.Type == ServiceTypeNonShared {
		obj, err := s.Func()
		if err != nil {
			return nil
		}
		return obj
	}

	// Already resolved, return
	if c.resolved[key] != nil {
		return c.resolved[key]
	}

	// Create instance, save it and return
	obj, err := s.Func()
	if err != nil {
		return nil
	}
	c.mu.Lock()
	c.resolved[key] = obj
	c.mu.Unlock()

	return obj
}
// Get will retrieve the function for the given service, or nil when not found
Get will retrieve the function for the given service, or nil when not found
// Get will retrieve the function for the given service or nil when not found
func (c *Type) Get(key string) interface{} {
	s, ok := c.definitions[key]
	if !ok {
		return nil
	}
	if s.Type == ServiceTypeNonShared {
		obj, err := s.Func()
		if err != nil {
			return nil
		}
		return obj
	}
	if c.resolved[key] != nil {
		return c.resolved[key]
	}
	obj, err := s.Func()
	if err != nil {
		return nil
	}
	c.mu.Lock()
	c.resolved[key] = obj
	c.mu.Unlock()
	return obj
}
func ( c * Type ) Get ( key string ) interface { } { s , ok := c . definitions [ key ] if ! ok { return nil } if s . Type == ServiceTypeNonShared { obj , err := s . Func ( ) if err != nil { return nil } return obj } if c . resolved [ key ] != nil { return c . resolved [ key ] } obj , err := s . Func ( ) if err != nil { return nil } c . mu . Lock ( ) c . resolved [ key ] = obj c . mu . Unlock ( ) return obj }
Get will retrieve the function for the given service, or nil when not found
Get will retrieve the function for the given service or nil when not found
// Multi means we don't use a shared instance but instead instantiate a new object each time called // Already resolved, return // Create instance, save it and return