Compare commits

...

6 Commits

Author SHA1 Message Date
06da500ef4 register: cleanup
All checks were successful
test / test (push) Successful in 3m33s
coverage / build (push) Successful in 9m11s
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2024-12-27 23:56:27 +03:00
277f04ba19 register: add Codec option
All checks were successful
coverage / build (push) Successful in 1m3s
test / test (push) Successful in 3m31s
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2024-12-27 19:33:50 +03:00
vtolstov
470263ff5f Apply Code Coverage Badge 2024-12-27 16:14:00 +00:00
b8232e02be register: add ListName option
All checks were successful
test / test (push) Successful in 3m50s
coverage / build (push) Successful in 8m15s
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2024-12-27 19:12:57 +03:00
vtolstov
f8c5e10c1d Apply Code Coverage Badge 2024-12-26 22:21:35 +00:00
397e71f815 Merge pull request 'register: improvements' (#390) from register into v3
All checks were successful
test / test (push) Successful in 3m50s
coverage / build (push) Successful in 13m40s
Reviewed-on: #390
2024-12-27 01:20:49 +03:00
2 changed files with 12 additions and 1 deletions

View File

@@ -1,5 +1,5 @@
# Micro # Micro
![Coverage](https://img.shields.io/badge/Coverage-45.1%25-yellow) ![Coverage](https://img.shields.io/badge/Coverage-44.8%25-yellow)
Micro is a standard library for microservices. Micro is a standard library for microservices.

View File

@@ -5,6 +5,7 @@ import (
"crypto/tls" "crypto/tls"
"time" "time"
"go.unistack.org/micro/v3/codec"
"go.unistack.org/micro/v3/logger" "go.unistack.org/micro/v3/logger"
"go.unistack.org/micro/v3/meter" "go.unistack.org/micro/v3/meter"
"go.unistack.org/micro/v3/tracer" "go.unistack.org/micro/v3/tracer"
@@ -26,6 +27,8 @@ type Options struct {
Name string Name string
// Addrs specifies register addrs // Addrs specifies register addrs
Addrs []string Addrs []string
// Codec used to marshal/unmarshal data in register
Codec codec.Codec
// Timeout specifies timeout // Timeout specifies timeout
Timeout time.Duration Timeout time.Duration
} }
@@ -37,6 +40,7 @@ func NewOptions(opts ...Option) Options {
Meter: meter.DefaultMeter, Meter: meter.DefaultMeter,
Tracer: tracer.DefaultTracer, Tracer: tracer.DefaultTracer,
Context: context.Background(), Context: context.Background(),
Codec: codec.NewCodec(),
} }
for _, o := range opts { for _, o := range opts {
o(&options) o(&options)
@@ -130,6 +134,7 @@ func NewLookupOptions(opts ...LookupOption) LookupOptions {
// ListOptions holds the list options for list method // ListOptions holds the list options for list method
type ListOptions struct { type ListOptions struct {
// Context used to store additional options
Context context.Context Context context.Context
// Namespace to scope the request to // Namespace to scope the request to
Namespace string Namespace string
@@ -300,3 +305,9 @@ func Name(n string) Option {
o.Name = n o.Name = n
} }
} }
func Codec(c codec.Codec) Option {
return func(o *Options) {
o.Codec = c
}
}