mirror of
https://github.com/go-micro/go-micro.git
synced 2025-08-10 21:52:01 +02:00
Add String method to all interfaces
This commit is contained in:
@@ -212,3 +212,7 @@ func (c *consulRegistry) ListServices() ([]*Service, error) {
|
||||
func (c *consulRegistry) Watch() (Watcher, error) {
|
||||
return newConsulWatcher(c)
|
||||
}
|
||||
|
||||
func (c *consulRegistry) String() string {
|
||||
return "consul"
|
||||
}
|
||||
|
@@ -65,6 +65,10 @@ func (m *MockRegistry) Watch() (registry.Watcher, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (m *MockRegistry) String() string {
|
||||
return "mock"
|
||||
}
|
||||
|
||||
func NewRegistry() *MockRegistry {
|
||||
return &MockRegistry{}
|
||||
}
|
||||
|
@@ -6,6 +6,7 @@ type Registry interface {
|
||||
GetService(string) ([]*Service, error)
|
||||
ListServices() ([]*Service, error)
|
||||
Watch() (Watcher, error)
|
||||
String() string
|
||||
}
|
||||
|
||||
type Option func(*Options)
|
||||
@@ -37,3 +38,7 @@ func ListServices() ([]*Service, error) {
|
||||
func Watch() (Watcher, error) {
|
||||
return DefaultRegistry.Watch()
|
||||
}
|
||||
|
||||
func String() string {
|
||||
return DefaultRegistry.String()
|
||||
}
|
||||
|
Reference in New Issue
Block a user