示例#1
0
func SelectServiceInstances(store Store, service string, s data.Selector, fi InstanceFunc) error {
	return ForeachInstance(store, service, func(sn, in string, d data.Instance) error {
		if s.Includes(d) {
			if err := fi(sn, in, d); err != nil {
				return err
			}
		}
		return nil
	})
}
示例#2
0
func SelectInstances(store Store, sel data.Selector, fun InstanceFunc) error {
	return ForeachServiceInstance(store, nil, func(sn, in string, d data.Instance) error {
		if sel.Includes(d) {
			if err := fun(sn, in, d); err != nil {
				return err
			}
		}
		return nil
	})
}