From 8db52549e45a9e17354ffb3b9b1d00779dcf7544 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Fri, 27 Dec 2024 19:10:46 +0300 Subject: [PATCH] register: add ListName option Signed-off-by: Vasiliy Tolstov --- register/options.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/register/options.go b/register/options.go index 05cacb7f..a0d13f64 100644 --- a/register/options.go +++ b/register/options.go @@ -130,9 +130,12 @@ func NewLookupOptions(opts ...LookupOption) LookupOptions { // ListOptions holds the list options for list method type ListOptions struct { + // Context used to store additional options Context context.Context // Namespace to scope the request to Namespace string + // Name filter services by name + Name string } // NewListOptions returns list options filled by opts @@ -294,6 +297,13 @@ func ListNamespace(d string) ListOption { } } +// ListName sets the name for list method to filter needed services +func ListName(n string) ListOption { + return func(o *ListOptions) { + o.Name = n + } +} + // Name sets the name func Name(n string) Option { return func(o *Options) {