add needed files

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2021-09-12 23:24:32 +03:00
parent e265a6f83f
commit d797edb9a7
15 changed files with 2139 additions and 13 deletions

40
stream.go Normal file
View File

@@ -0,0 +1,40 @@
package drpc
import (
"context"
"github.com/unistack-org/micro/v3/server"
"google.golang.org/grpc"
)
// rpcStream implements a server side Stream.
type rpcStream struct {
// embed the grpc stream so we can access it
grpc.ServerStream
request server.Request
}
func (r *rpcStream) Close() error {
return nil
}
func (r *rpcStream) Error() error {
return nil
}
func (r *rpcStream) Request() server.Request {
return r.request
}
func (r *rpcStream) Context() context.Context {
return r.ServerStream.Context()
}
func (r *rpcStream) Send(m interface{}) error {
return r.ServerStream.SendMsg(m)
}
func (r *rpcStream) Recv(m interface{}) error {
return r.ServerStream.RecvMsg(m)
}