Switch around method names
This commit is contained in:
parent
7c3ce60ce6
commit
febe87dfb8
@ -4,9 +4,9 @@ import (
|
|||||||
"github.com/micro/go-micro/registry"
|
"github.com/micro/go-micro/registry"
|
||||||
)
|
)
|
||||||
|
|
||||||
// LabelFilter is a label based Select Filter which will
|
// FilterLabel is a label based Select Filter which will
|
||||||
// only return services with the label specified.
|
// only return services with the label specified.
|
||||||
func LabelFilter(key, val string) Filter {
|
func FilterLabel(key, val string) Filter {
|
||||||
return func(old []*registry.Service) []*registry.Service {
|
return func(old []*registry.Service) []*registry.Service {
|
||||||
var services []*registry.Service
|
var services []*registry.Service
|
||||||
|
|
||||||
@ -37,9 +37,9 @@ func LabelFilter(key, val string) Filter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// VersionFilter is a version based Select Filter which will
|
// FilterVersion is a version based Select Filter which will
|
||||||
// only return services with the version specified.
|
// only return services with the version specified.
|
||||||
func VersionFilter(version string) Filter {
|
func FilterVersion(version string) Filter {
|
||||||
return func(old []*registry.Service) []*registry.Service {
|
return func(old []*registry.Service) []*registry.Service {
|
||||||
var services []*registry.Service
|
var services []*registry.Service
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
"github.com/micro/go-micro/registry"
|
"github.com/micro/go-micro/registry"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestLabelFilter(t *testing.T) {
|
func TestFilterLabel(t *testing.T) {
|
||||||
testData := []struct {
|
testData := []struct {
|
||||||
services []*registry.Service
|
services []*registry.Service
|
||||||
label [2]string
|
label [2]string
|
||||||
@ -73,7 +73,7 @@ func TestLabelFilter(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, data := range testData {
|
for _, data := range testData {
|
||||||
filter := LabelFilter(data.label[0], data.label[1])
|
filter := FilterLabel(data.label[0], data.label[1])
|
||||||
services := filter(data.services)
|
services := filter(data.services)
|
||||||
|
|
||||||
if len(services) != data.count {
|
if len(services) != data.count {
|
||||||
@ -98,7 +98,7 @@ func TestLabelFilter(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVersionFilter(t *testing.T) {
|
func TestFilterVersion(t *testing.T) {
|
||||||
testData := []struct {
|
testData := []struct {
|
||||||
services []*registry.Service
|
services []*registry.Service
|
||||||
version string
|
version string
|
||||||
@ -135,7 +135,7 @@ func TestVersionFilter(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, data := range testData {
|
for _, data := range testData {
|
||||||
filter := VersionFilter(data.version)
|
filter := FilterVersion(data.version)
|
||||||
services := filter(data.services)
|
services := filter(data.services)
|
||||||
|
|
||||||
if len(services) != data.count {
|
if len(services) != data.count {
|
||||||
|
Loading…
Reference in New Issue
Block a user