fix for latest micro

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2021-12-16 15:27:02 +03:00
parent 8bcc645147
commit 80842ca667
3 changed files with 11 additions and 7 deletions

2
go.mod
View File

@ -3,6 +3,6 @@ module go.unistack.org/micro-client-drpc/v3
go 1.16 go 1.16
require ( require (
go.unistack.org/micro/v3 v3.8.11 go.unistack.org/micro/v3 v3.8.12
storj.io/drpc v0.0.26 storj.io/drpc v0.0.26
) )

4
go.sum
View File

@ -12,8 +12,8 @@ github.com/zeebo/errs v1.2.2 h1:5NFypMTuSdoySVTqlNs1dEoU21QVamMQJxW/Fii5O7g=
github.com/zeebo/errs v1.2.2/go.mod h1:sgbWHsvVuTPHcqJJGQ1WhI5KbWlHYz+2+2C/LSEtCw4= github.com/zeebo/errs v1.2.2/go.mod h1:sgbWHsvVuTPHcqJJGQ1WhI5KbWlHYz+2+2C/LSEtCw4=
go.unistack.org/micro-proto/v3 v3.1.0 h1:q39FwjFiRZn+Ux/tt+d3bJTmDtsQQWa+3SLYVo1vLfA= go.unistack.org/micro-proto/v3 v3.1.0 h1:q39FwjFiRZn+Ux/tt+d3bJTmDtsQQWa+3SLYVo1vLfA=
go.unistack.org/micro-proto/v3 v3.1.0/go.mod h1:DpRhYCBXlmSJ/AAXTmntvlh7kQkYU6eFvlmYAx4BQS8= go.unistack.org/micro-proto/v3 v3.1.0/go.mod h1:DpRhYCBXlmSJ/AAXTmntvlh7kQkYU6eFvlmYAx4BQS8=
go.unistack.org/micro/v3 v3.8.11 h1:Wv1YopcYNcsN3bW8Mv8v6AF99s0uKBtWQ1M/Ag8QLec= go.unistack.org/micro/v3 v3.8.12 h1:ACaHE8ZIHFXqEGPSRvXzND4hcqCSQf04WkzOFY6Y1gQ=
go.unistack.org/micro/v3 v3.8.11/go.mod h1:KMMmOmbgo/D52/rCAbqeKbBsgEEbSKM69he54J3ZIuA= go.unistack.org/micro/v3 v3.8.12/go.mod h1:KMMmOmbgo/D52/rCAbqeKbBsgEEbSKM69he54J3ZIuA=
golang.org/x/net v0.0.0-20210928044308-7d9f5e0b762b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210928044308-7d9f5e0b762b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=

View File

@ -2,19 +2,18 @@ package drpc
import ( import (
"go.unistack.org/micro/v3/client" "go.unistack.org/micro/v3/client"
"go.unistack.org/micro/v3/metadata"
) )
type drpcEvent struct { type drpcEvent struct {
payload interface{} payload interface{}
topic string topic string
contentType string contentType string
opts client.MessageOptions
} }
func newDRPCEvent(topic string, payload interface{}, contentType string, opts ...client.MessageOption) client.Message { func newDRPCEvent(topic string, payload interface{}, contentType string, opts ...client.MessageOption) client.Message {
var options client.MessageOptions options := client.NewMessageOptions(opts...)
for _, o := range opts {
o(&options)
}
if len(options.ContentType) > 0 { if len(options.ContentType) > 0 {
contentType = options.ContentType contentType = options.ContentType
@ -23,6 +22,7 @@ func newDRPCEvent(topic string, payload interface{}, contentType string, opts ..
return &drpcEvent{ return &drpcEvent{
payload: payload, payload: payload,
topic: topic, topic: topic,
opts: options,
contentType: contentType, contentType: contentType,
} }
} }
@ -38,3 +38,7 @@ func (d *drpcEvent) Topic() string {
func (d *drpcEvent) Payload() interface{} { func (d *drpcEvent) Payload() interface{} {
return d.payload return d.payload
} }
func (d *drpcEvent) Metadata() metadata.Metadata {
return d.opts.Metadata
}