Example #1
0
func TwoFactory(dp dependency.Provider) (dependency.Instance, error) {
	two := NewTwo()
	if err := dp.InjectTo(two); err != nil {
		return nil, err
	}
	return two, nil
}
Example #2
0
func CircleFactory(dp dependency.Provider) (dependency.Instance, error) {
	ins := NewCircle()
	if err := dp.InjectTo(ins); err != nil {
		return nil, err
	}
	return ins, nil
}
Example #3
0
func MyCircleDepFactory(dp dependency.Provider) (dependency.Instance, error) {
	instance, err := dp.Get(MyCircleDepName)
	if err != nil {
		return nil, err
	}
	return &MyCircleDep{
		instance: instance,
	}, nil
}