1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-12-24 10:07:04 +02:00

Switch around method names

This commit is contained in:
Asim 2016-04-23 21:09:48 +01:00
parent 7c3ce60ce6
commit febe87dfb8
2 changed files with 8 additions and 8 deletions

View File

@ -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

View File

@ -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 {