add checkgenerate to ci
This commit is contained in:
parent
1fda47eb90
commit
b80901bbb4
|
|
@ -1,3 +1,4 @@
|
||||||
dist/
|
dist/
|
||||||
.idea/
|
.idea/
|
||||||
VERSION
|
VERSION
|
||||||
|
.tmp/
|
||||||
|
|
|
||||||
23
Makefile
23
Makefile
|
|
@ -1,12 +1,14 @@
|
||||||
dev_build_version=$(shell git describe --tags --always --dirty)
|
dev_build_version=$(shell git describe --tags --always --dirty)
|
||||||
|
|
||||||
|
export PATH := $(shell pwd)/.tmp/protoc/bin:$(PATH)
|
||||||
|
|
||||||
# TODO: run golint and errcheck, but only to catch *new* violations and
|
# TODO: run golint and errcheck, but only to catch *new* violations and
|
||||||
# decide whether to change code or not (e.g. we need to be able to whitelist
|
# decide whether to change code or not (e.g. we need to be able to whitelist
|
||||||
# violations already in the code). They can be useful to catch errors, but
|
# violations already in the code). They can be useful to catch errors, but
|
||||||
# they are just too noisy to be a requirement for a CI -- we don't even *want*
|
# they are just too noisy to be a requirement for a CI -- we don't even *want*
|
||||||
# to fix some of the things they consider to be violations.
|
# to fix some of the things they consider to be violations.
|
||||||
.PHONY: ci
|
.PHONY: ci
|
||||||
ci: deps checkgofmt vet staticcheck ineffassign predeclared test
|
ci: deps checkgofmt checkgenerate vet staticcheck ineffassign predeclared test
|
||||||
|
|
||||||
.PHONY: deps
|
.PHONY: deps
|
||||||
deps:
|
deps:
|
||||||
|
|
@ -31,6 +33,19 @@ docker:
|
||||||
docker build -t fullstorydev/grpcurl:$(dev_build_version) .
|
docker build -t fullstorydev/grpcurl:$(dev_build_version) .
|
||||||
@rm VERSION
|
@rm VERSION
|
||||||
|
|
||||||
|
.PHONY: generate
|
||||||
|
generate: .tmp/protoc/bin/protoc
|
||||||
|
@go install google.golang.org/protobuf/cmd/protoc-gen-go@a709e31e5d12
|
||||||
|
@go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.1.0
|
||||||
|
go generate ./...
|
||||||
|
|
||||||
|
.PHONY: checkgenerate
|
||||||
|
checkgenerate: generate
|
||||||
|
git status --porcelain
|
||||||
|
@if [ -n "$$(git status --porcelain)" ]; then \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
.PHONY: checkgofmt
|
.PHONY: checkgofmt
|
||||||
checkgofmt:
|
checkgofmt:
|
||||||
gofmt -s -l .
|
gofmt -s -l .
|
||||||
|
|
@ -44,7 +59,7 @@ vet:
|
||||||
|
|
||||||
.PHONY: staticcheck
|
.PHONY: staticcheck
|
||||||
staticcheck:
|
staticcheck:
|
||||||
@go install honnef.co/go/tools/cmd/staticcheck@v0.3.3
|
@go install honnef.co/go/tools/cmd/staticcheck@v0.4.3
|
||||||
staticcheck ./...
|
staticcheck ./...
|
||||||
|
|
||||||
.PHONY: ineffassign
|
.PHONY: ineffassign
|
||||||
|
|
@ -72,3 +87,7 @@ errcheck:
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test:
|
test:
|
||||||
go test -race ./...
|
go test -race ./...
|
||||||
|
|
||||||
|
.tmp/protoc/bin/protoc:
|
||||||
|
./download_protoc.sh
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cd $(dirname $0)
|
||||||
|
|
||||||
|
PROTOC_VERSION="22.0"
|
||||||
|
PROTOC_OS="$(uname -s)"
|
||||||
|
PROTOC_ARCH="$(uname -m)"
|
||||||
|
case "${PROTOC_OS}" in
|
||||||
|
Darwin) PROTOC_OS="osx" ;;
|
||||||
|
Linux) PROTOC_OS="linux" ;;
|
||||||
|
*)
|
||||||
|
echo "Invalid value for uname -s: ${PROTOC_OS}" >&2
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
|
||||||
|
# This is for macs with M1 chips. Precompiled binaries for osx/amd64 are not available for download, so for that case
|
||||||
|
# we download the x86_64 version instead. This will work as long as rosetta2 is installed.
|
||||||
|
if [ "$PROTOC_OS" = "osx" ] && [ "$PROTOC_ARCH" = "arm64" ]; then
|
||||||
|
PROTOC_ARCH="x86_64"
|
||||||
|
fi
|
||||||
|
|
||||||
|
PROTOC="${PWD}/.tmp/protoc/bin/protoc"
|
||||||
|
|
||||||
|
if [[ "$(${PROTOC} --version 2>/dev/null)" != "libprotoc 3.${PROTOC_VERSION}" ]]; then
|
||||||
|
rm -rf ./.tmp/protoc
|
||||||
|
mkdir -p .tmp/protoc
|
||||||
|
curl -L "https://github.com/google/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-${PROTOC_OS}-${PROTOC_ARCH}.zip" > .tmp/protoc/protoc.zip
|
||||||
|
cd ./.tmp/protoc && unzip protoc.zip && cd ..
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
@ -12,6 +12,7 @@ import (
|
||||||
|
|
||||||
// bankServer implements the Bank gRPC service.
|
// bankServer implements the Bank gRPC service.
|
||||||
type bankServer struct {
|
type bankServer struct {
|
||||||
|
UnimplementedBankServer
|
||||||
allAccounts *accounts
|
allAccounts *accounts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,13 @@
|
||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.25.0-devel
|
// protoc-gen-go v1.25.0-devel
|
||||||
// protoc v3.14.0
|
// protoc v4.22.0
|
||||||
// source: bank.proto
|
// source: bank.proto
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
context "context"
|
|
||||||
proto "github.com/golang/protobuf/proto"
|
proto "github.com/golang/protobuf/proto"
|
||||||
grpc "google.golang.org/grpc"
|
|
||||||
codes "google.golang.org/grpc/codes"
|
|
||||||
status "google.golang.org/grpc/status"
|
|
||||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
||||||
|
|
@ -696,10 +692,12 @@ type TransferRequest struct {
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
// Types that are assignable to Source:
|
// Types that are assignable to Source:
|
||||||
|
//
|
||||||
// *TransferRequest_SourceAccountNumber
|
// *TransferRequest_SourceAccountNumber
|
||||||
// *TransferRequest_ExternalSource
|
// *TransferRequest_ExternalSource
|
||||||
Source isTransferRequest_Source `protobuf_oneof:"source"`
|
Source isTransferRequest_Source `protobuf_oneof:"source"`
|
||||||
// Types that are assignable to Dest:
|
// Types that are assignable to Dest:
|
||||||
|
//
|
||||||
// *TransferRequest_DestAccountNumber
|
// *TransferRequest_DestAccountNumber
|
||||||
// *TransferRequest_ExternalDest
|
// *TransferRequest_ExternalDest
|
||||||
Dest isTransferRequest_Dest `protobuf_oneof:"dest"`
|
Dest isTransferRequest_Dest `protobuf_oneof:"dest"`
|
||||||
|
|
@ -1347,355 +1345,3 @@ func file_bank_proto_init() {
|
||||||
file_bank_proto_goTypes = nil
|
file_bank_proto_goTypes = nil
|
||||||
file_bank_proto_depIdxs = nil
|
file_bank_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
|
||||||
var _ context.Context
|
|
||||||
var _ grpc.ClientConnInterface
|
|
||||||
|
|
||||||
// This is a compile-time assertion to ensure that this generated file
|
|
||||||
// is compatible with the grpc package it is being compiled against.
|
|
||||||
const _ = grpc.SupportPackageIsVersion6
|
|
||||||
|
|
||||||
// BankClient is the client API for Bank service.
|
|
||||||
//
|
|
||||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
|
||||||
type BankClient interface {
|
|
||||||
// OpenAccount creates an account with the type and given initial deposit
|
|
||||||
// as its balance.
|
|
||||||
OpenAccount(ctx context.Context, in *OpenAccountRequest, opts ...grpc.CallOption) (*Account, error)
|
|
||||||
// CloseAccount closes the indicated account. An account can only be
|
|
||||||
// closed if its balance is zero.
|
|
||||||
CloseAccount(ctx context.Context, in *CloseAccountRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
|
||||||
// GetAccounts lists all accounts for the current customer.
|
|
||||||
GetAccounts(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetAccountsResponse, error)
|
|
||||||
// GetTransactions streams all transactions that match the given criteria.
|
|
||||||
// If the given start date is not specified, transactions since beginning
|
|
||||||
// of time are included. Similarly, if the given end date is not specified,
|
|
||||||
// transactions all the way to the presnet are included.
|
|
||||||
GetTransactions(ctx context.Context, in *GetTransactionsRequest, opts ...grpc.CallOption) (Bank_GetTransactionsClient, error)
|
|
||||||
// Deposit increases the balance of an account by depositing funds into it.
|
|
||||||
Deposit(ctx context.Context, in *DepositRequest, opts ...grpc.CallOption) (*BalanceResponse, error)
|
|
||||||
// Withdraw decreases the balance of an account by withdrawing funds from it.
|
|
||||||
Withdraw(ctx context.Context, in *WithdrawRequest, opts ...grpc.CallOption) (*BalanceResponse, error)
|
|
||||||
// Transfer moves money from one account to another. The source and destination
|
|
||||||
// accounts can be with this bank (e.g. "local" account numbers) or can be
|
|
||||||
// external accounts, identified by their ACH routing and account numbers.
|
|
||||||
Transfer(ctx context.Context, in *TransferRequest, opts ...grpc.CallOption) (*TransferResponse, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
type bankClient struct {
|
|
||||||
cc grpc.ClientConnInterface
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewBankClient(cc grpc.ClientConnInterface) BankClient {
|
|
||||||
return &bankClient{cc}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *bankClient) OpenAccount(ctx context.Context, in *OpenAccountRequest, opts ...grpc.CallOption) (*Account, error) {
|
|
||||||
out := new(Account)
|
|
||||||
err := c.cc.Invoke(ctx, "/Bank/OpenAccount", in, out, opts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *bankClient) CloseAccount(ctx context.Context, in *CloseAccountRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
|
||||||
out := new(emptypb.Empty)
|
|
||||||
err := c.cc.Invoke(ctx, "/Bank/CloseAccount", in, out, opts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *bankClient) GetAccounts(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetAccountsResponse, error) {
|
|
||||||
out := new(GetAccountsResponse)
|
|
||||||
err := c.cc.Invoke(ctx, "/Bank/GetAccounts", in, out, opts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *bankClient) GetTransactions(ctx context.Context, in *GetTransactionsRequest, opts ...grpc.CallOption) (Bank_GetTransactionsClient, error) {
|
|
||||||
stream, err := c.cc.NewStream(ctx, &_Bank_serviceDesc.Streams[0], "/Bank/GetTransactions", opts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
x := &bankGetTransactionsClient{stream}
|
|
||||||
if err := x.ClientStream.SendMsg(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if err := x.ClientStream.CloseSend(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return x, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type Bank_GetTransactionsClient interface {
|
|
||||||
Recv() (*Transaction, error)
|
|
||||||
grpc.ClientStream
|
|
||||||
}
|
|
||||||
|
|
||||||
type bankGetTransactionsClient struct {
|
|
||||||
grpc.ClientStream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *bankGetTransactionsClient) Recv() (*Transaction, error) {
|
|
||||||
m := new(Transaction)
|
|
||||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return m, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *bankClient) Deposit(ctx context.Context, in *DepositRequest, opts ...grpc.CallOption) (*BalanceResponse, error) {
|
|
||||||
out := new(BalanceResponse)
|
|
||||||
err := c.cc.Invoke(ctx, "/Bank/Deposit", in, out, opts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *bankClient) Withdraw(ctx context.Context, in *WithdrawRequest, opts ...grpc.CallOption) (*BalanceResponse, error) {
|
|
||||||
out := new(BalanceResponse)
|
|
||||||
err := c.cc.Invoke(ctx, "/Bank/Withdraw", in, out, opts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *bankClient) Transfer(ctx context.Context, in *TransferRequest, opts ...grpc.CallOption) (*TransferResponse, error) {
|
|
||||||
out := new(TransferResponse)
|
|
||||||
err := c.cc.Invoke(ctx, "/Bank/Transfer", in, out, opts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// BankServer is the server API for Bank service.
|
|
||||||
type BankServer interface {
|
|
||||||
// OpenAccount creates an account with the type and given initial deposit
|
|
||||||
// as its balance.
|
|
||||||
OpenAccount(context.Context, *OpenAccountRequest) (*Account, error)
|
|
||||||
// CloseAccount closes the indicated account. An account can only be
|
|
||||||
// closed if its balance is zero.
|
|
||||||
CloseAccount(context.Context, *CloseAccountRequest) (*emptypb.Empty, error)
|
|
||||||
// GetAccounts lists all accounts for the current customer.
|
|
||||||
GetAccounts(context.Context, *emptypb.Empty) (*GetAccountsResponse, error)
|
|
||||||
// GetTransactions streams all transactions that match the given criteria.
|
|
||||||
// If the given start date is not specified, transactions since beginning
|
|
||||||
// of time are included. Similarly, if the given end date is not specified,
|
|
||||||
// transactions all the way to the presnet are included.
|
|
||||||
GetTransactions(*GetTransactionsRequest, Bank_GetTransactionsServer) error
|
|
||||||
// Deposit increases the balance of an account by depositing funds into it.
|
|
||||||
Deposit(context.Context, *DepositRequest) (*BalanceResponse, error)
|
|
||||||
// Withdraw decreases the balance of an account by withdrawing funds from it.
|
|
||||||
Withdraw(context.Context, *WithdrawRequest) (*BalanceResponse, error)
|
|
||||||
// Transfer moves money from one account to another. The source and destination
|
|
||||||
// accounts can be with this bank (e.g. "local" account numbers) or can be
|
|
||||||
// external accounts, identified by their ACH routing and account numbers.
|
|
||||||
Transfer(context.Context, *TransferRequest) (*TransferResponse, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnimplementedBankServer can be embedded to have forward compatible implementations.
|
|
||||||
type UnimplementedBankServer struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*UnimplementedBankServer) OpenAccount(context.Context, *OpenAccountRequest) (*Account, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method OpenAccount not implemented")
|
|
||||||
}
|
|
||||||
func (*UnimplementedBankServer) CloseAccount(context.Context, *CloseAccountRequest) (*emptypb.Empty, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method CloseAccount not implemented")
|
|
||||||
}
|
|
||||||
func (*UnimplementedBankServer) GetAccounts(context.Context, *emptypb.Empty) (*GetAccountsResponse, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method GetAccounts not implemented")
|
|
||||||
}
|
|
||||||
func (*UnimplementedBankServer) GetTransactions(*GetTransactionsRequest, Bank_GetTransactionsServer) error {
|
|
||||||
return status.Errorf(codes.Unimplemented, "method GetTransactions not implemented")
|
|
||||||
}
|
|
||||||
func (*UnimplementedBankServer) Deposit(context.Context, *DepositRequest) (*BalanceResponse, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method Deposit not implemented")
|
|
||||||
}
|
|
||||||
func (*UnimplementedBankServer) Withdraw(context.Context, *WithdrawRequest) (*BalanceResponse, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method Withdraw not implemented")
|
|
||||||
}
|
|
||||||
func (*UnimplementedBankServer) Transfer(context.Context, *TransferRequest) (*TransferResponse, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method Transfer not implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
func RegisterBankServer(s *grpc.Server, srv BankServer) {
|
|
||||||
s.RegisterService(&_Bank_serviceDesc, srv)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _Bank_OpenAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(OpenAccountRequest)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(BankServer).OpenAccount(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: "/Bank/OpenAccount",
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(BankServer).OpenAccount(ctx, req.(*OpenAccountRequest))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _Bank_CloseAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(CloseAccountRequest)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(BankServer).CloseAccount(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: "/Bank/CloseAccount",
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(BankServer).CloseAccount(ctx, req.(*CloseAccountRequest))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _Bank_GetAccounts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(emptypb.Empty)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(BankServer).GetAccounts(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: "/Bank/GetAccounts",
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(BankServer).GetAccounts(ctx, req.(*emptypb.Empty))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _Bank_GetTransactions_Handler(srv interface{}, stream grpc.ServerStream) error {
|
|
||||||
m := new(GetTransactionsRequest)
|
|
||||||
if err := stream.RecvMsg(m); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return srv.(BankServer).GetTransactions(m, &bankGetTransactionsServer{stream})
|
|
||||||
}
|
|
||||||
|
|
||||||
type Bank_GetTransactionsServer interface {
|
|
||||||
Send(*Transaction) error
|
|
||||||
grpc.ServerStream
|
|
||||||
}
|
|
||||||
|
|
||||||
type bankGetTransactionsServer struct {
|
|
||||||
grpc.ServerStream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *bankGetTransactionsServer) Send(m *Transaction) error {
|
|
||||||
return x.ServerStream.SendMsg(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _Bank_Deposit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(DepositRequest)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(BankServer).Deposit(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: "/Bank/Deposit",
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(BankServer).Deposit(ctx, req.(*DepositRequest))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _Bank_Withdraw_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(WithdrawRequest)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(BankServer).Withdraw(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: "/Bank/Withdraw",
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(BankServer).Withdraw(ctx, req.(*WithdrawRequest))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _Bank_Transfer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(TransferRequest)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(BankServer).Transfer(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: "/Bank/Transfer",
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(BankServer).Transfer(ctx, req.(*TransferRequest))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _Bank_serviceDesc = grpc.ServiceDesc{
|
|
||||||
ServiceName: "Bank",
|
|
||||||
HandlerType: (*BankServer)(nil),
|
|
||||||
Methods: []grpc.MethodDesc{
|
|
||||||
{
|
|
||||||
MethodName: "OpenAccount",
|
|
||||||
Handler: _Bank_OpenAccount_Handler,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
MethodName: "CloseAccount",
|
|
||||||
Handler: _Bank_CloseAccount_Handler,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
MethodName: "GetAccounts",
|
|
||||||
Handler: _Bank_GetAccounts_Handler,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
MethodName: "Deposit",
|
|
||||||
Handler: _Bank_Deposit_Handler,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
MethodName: "Withdraw",
|
|
||||||
Handler: _Bank_Withdraw_Handler,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
MethodName: "Transfer",
|
|
||||||
Handler: _Bank_Transfer_Handler,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Streams: []grpc.StreamDesc{
|
|
||||||
{
|
|
||||||
StreamName: "GetTransactions",
|
|
||||||
Handler: _Bank_GetTransactions_Handler,
|
|
||||||
ServerStreams: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Metadata: "bank.proto",
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,374 @@
|
||||||
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
context "context"
|
||||||
|
grpc "google.golang.org/grpc"
|
||||||
|
codes "google.golang.org/grpc/codes"
|
||||||
|
status "google.golang.org/grpc/status"
|
||||||
|
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
||||||
|
)
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the grpc package it is being compiled against.
|
||||||
|
// Requires gRPC-Go v1.32.0 or later.
|
||||||
|
const _ = grpc.SupportPackageIsVersion7
|
||||||
|
|
||||||
|
// BankClient is the client API for Bank service.
|
||||||
|
//
|
||||||
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||||
|
type BankClient interface {
|
||||||
|
// OpenAccount creates an account with the type and given initial deposit
|
||||||
|
// as its balance.
|
||||||
|
OpenAccount(ctx context.Context, in *OpenAccountRequest, opts ...grpc.CallOption) (*Account, error)
|
||||||
|
// CloseAccount closes the indicated account. An account can only be
|
||||||
|
// closed if its balance is zero.
|
||||||
|
CloseAccount(ctx context.Context, in *CloseAccountRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||||
|
// GetAccounts lists all accounts for the current customer.
|
||||||
|
GetAccounts(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetAccountsResponse, error)
|
||||||
|
// GetTransactions streams all transactions that match the given criteria.
|
||||||
|
// If the given start date is not specified, transactions since beginning
|
||||||
|
// of time are included. Similarly, if the given end date is not specified,
|
||||||
|
// transactions all the way to the presnet are included.
|
||||||
|
GetTransactions(ctx context.Context, in *GetTransactionsRequest, opts ...grpc.CallOption) (Bank_GetTransactionsClient, error)
|
||||||
|
// Deposit increases the balance of an account by depositing funds into it.
|
||||||
|
Deposit(ctx context.Context, in *DepositRequest, opts ...grpc.CallOption) (*BalanceResponse, error)
|
||||||
|
// Withdraw decreases the balance of an account by withdrawing funds from it.
|
||||||
|
Withdraw(ctx context.Context, in *WithdrawRequest, opts ...grpc.CallOption) (*BalanceResponse, error)
|
||||||
|
// Transfer moves money from one account to another. The source and destination
|
||||||
|
// accounts can be with this bank (e.g. "local" account numbers) or can be
|
||||||
|
// external accounts, identified by their ACH routing and account numbers.
|
||||||
|
Transfer(ctx context.Context, in *TransferRequest, opts ...grpc.CallOption) (*TransferResponse, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type bankClient struct {
|
||||||
|
cc grpc.ClientConnInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewBankClient(cc grpc.ClientConnInterface) BankClient {
|
||||||
|
return &bankClient{cc}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *bankClient) OpenAccount(ctx context.Context, in *OpenAccountRequest, opts ...grpc.CallOption) (*Account, error) {
|
||||||
|
out := new(Account)
|
||||||
|
err := c.cc.Invoke(ctx, "/Bank/OpenAccount", in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *bankClient) CloseAccount(ctx context.Context, in *CloseAccountRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
||||||
|
out := new(emptypb.Empty)
|
||||||
|
err := c.cc.Invoke(ctx, "/Bank/CloseAccount", in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *bankClient) GetAccounts(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetAccountsResponse, error) {
|
||||||
|
out := new(GetAccountsResponse)
|
||||||
|
err := c.cc.Invoke(ctx, "/Bank/GetAccounts", in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *bankClient) GetTransactions(ctx context.Context, in *GetTransactionsRequest, opts ...grpc.CallOption) (Bank_GetTransactionsClient, error) {
|
||||||
|
stream, err := c.cc.NewStream(ctx, &Bank_ServiceDesc.Streams[0], "/Bank/GetTransactions", opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
x := &bankGetTransactionsClient{stream}
|
||||||
|
if err := x.ClientStream.SendMsg(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if err := x.ClientStream.CloseSend(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return x, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type Bank_GetTransactionsClient interface {
|
||||||
|
Recv() (*Transaction, error)
|
||||||
|
grpc.ClientStream
|
||||||
|
}
|
||||||
|
|
||||||
|
type bankGetTransactionsClient struct {
|
||||||
|
grpc.ClientStream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *bankGetTransactionsClient) Recv() (*Transaction, error) {
|
||||||
|
m := new(Transaction)
|
||||||
|
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *bankClient) Deposit(ctx context.Context, in *DepositRequest, opts ...grpc.CallOption) (*BalanceResponse, error) {
|
||||||
|
out := new(BalanceResponse)
|
||||||
|
err := c.cc.Invoke(ctx, "/Bank/Deposit", in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *bankClient) Withdraw(ctx context.Context, in *WithdrawRequest, opts ...grpc.CallOption) (*BalanceResponse, error) {
|
||||||
|
out := new(BalanceResponse)
|
||||||
|
err := c.cc.Invoke(ctx, "/Bank/Withdraw", in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *bankClient) Transfer(ctx context.Context, in *TransferRequest, opts ...grpc.CallOption) (*TransferResponse, error) {
|
||||||
|
out := new(TransferResponse)
|
||||||
|
err := c.cc.Invoke(ctx, "/Bank/Transfer", in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// BankServer is the server API for Bank service.
|
||||||
|
// All implementations must embed UnimplementedBankServer
|
||||||
|
// for forward compatibility
|
||||||
|
type BankServer interface {
|
||||||
|
// OpenAccount creates an account with the type and given initial deposit
|
||||||
|
// as its balance.
|
||||||
|
OpenAccount(context.Context, *OpenAccountRequest) (*Account, error)
|
||||||
|
// CloseAccount closes the indicated account. An account can only be
|
||||||
|
// closed if its balance is zero.
|
||||||
|
CloseAccount(context.Context, *CloseAccountRequest) (*emptypb.Empty, error)
|
||||||
|
// GetAccounts lists all accounts for the current customer.
|
||||||
|
GetAccounts(context.Context, *emptypb.Empty) (*GetAccountsResponse, error)
|
||||||
|
// GetTransactions streams all transactions that match the given criteria.
|
||||||
|
// If the given start date is not specified, transactions since beginning
|
||||||
|
// of time are included. Similarly, if the given end date is not specified,
|
||||||
|
// transactions all the way to the presnet are included.
|
||||||
|
GetTransactions(*GetTransactionsRequest, Bank_GetTransactionsServer) error
|
||||||
|
// Deposit increases the balance of an account by depositing funds into it.
|
||||||
|
Deposit(context.Context, *DepositRequest) (*BalanceResponse, error)
|
||||||
|
// Withdraw decreases the balance of an account by withdrawing funds from it.
|
||||||
|
Withdraw(context.Context, *WithdrawRequest) (*BalanceResponse, error)
|
||||||
|
// Transfer moves money from one account to another. The source and destination
|
||||||
|
// accounts can be with this bank (e.g. "local" account numbers) or can be
|
||||||
|
// external accounts, identified by their ACH routing and account numbers.
|
||||||
|
Transfer(context.Context, *TransferRequest) (*TransferResponse, error)
|
||||||
|
mustEmbedUnimplementedBankServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnimplementedBankServer must be embedded to have forward compatible implementations.
|
||||||
|
type UnimplementedBankServer struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (UnimplementedBankServer) OpenAccount(context.Context, *OpenAccountRequest) (*Account, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method OpenAccount not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedBankServer) CloseAccount(context.Context, *CloseAccountRequest) (*emptypb.Empty, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method CloseAccount not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedBankServer) GetAccounts(context.Context, *emptypb.Empty) (*GetAccountsResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method GetAccounts not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedBankServer) GetTransactions(*GetTransactionsRequest, Bank_GetTransactionsServer) error {
|
||||||
|
return status.Errorf(codes.Unimplemented, "method GetTransactions not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedBankServer) Deposit(context.Context, *DepositRequest) (*BalanceResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method Deposit not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedBankServer) Withdraw(context.Context, *WithdrawRequest) (*BalanceResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method Withdraw not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedBankServer) Transfer(context.Context, *TransferRequest) (*TransferResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method Transfer not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedBankServer) mustEmbedUnimplementedBankServer() {}
|
||||||
|
|
||||||
|
// UnsafeBankServer may be embedded to opt out of forward compatibility for this service.
|
||||||
|
// Use of this interface is not recommended, as added methods to BankServer will
|
||||||
|
// result in compilation errors.
|
||||||
|
type UnsafeBankServer interface {
|
||||||
|
mustEmbedUnimplementedBankServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterBankServer(s grpc.ServiceRegistrar, srv BankServer) {
|
||||||
|
s.RegisterService(&Bank_ServiceDesc, srv)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _Bank_OpenAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(OpenAccountRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(BankServer).OpenAccount(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/Bank/OpenAccount",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(BankServer).OpenAccount(ctx, req.(*OpenAccountRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _Bank_CloseAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(CloseAccountRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(BankServer).CloseAccount(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/Bank/CloseAccount",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(BankServer).CloseAccount(ctx, req.(*CloseAccountRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _Bank_GetAccounts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(emptypb.Empty)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(BankServer).GetAccounts(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/Bank/GetAccounts",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(BankServer).GetAccounts(ctx, req.(*emptypb.Empty))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _Bank_GetTransactions_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||||
|
m := new(GetTransactionsRequest)
|
||||||
|
if err := stream.RecvMsg(m); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return srv.(BankServer).GetTransactions(m, &bankGetTransactionsServer{stream})
|
||||||
|
}
|
||||||
|
|
||||||
|
type Bank_GetTransactionsServer interface {
|
||||||
|
Send(*Transaction) error
|
||||||
|
grpc.ServerStream
|
||||||
|
}
|
||||||
|
|
||||||
|
type bankGetTransactionsServer struct {
|
||||||
|
grpc.ServerStream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *bankGetTransactionsServer) Send(m *Transaction) error {
|
||||||
|
return x.ServerStream.SendMsg(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _Bank_Deposit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(DepositRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(BankServer).Deposit(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/Bank/Deposit",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(BankServer).Deposit(ctx, req.(*DepositRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _Bank_Withdraw_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(WithdrawRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(BankServer).Withdraw(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/Bank/Withdraw",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(BankServer).Withdraw(ctx, req.(*WithdrawRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _Bank_Transfer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(TransferRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(BankServer).Transfer(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/Bank/Transfer",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(BankServer).Transfer(ctx, req.(*TransferRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bank_ServiceDesc is the grpc.ServiceDesc for Bank service.
|
||||||
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
|
// and not to be introspected or modified (even as a copy)
|
||||||
|
var Bank_ServiceDesc = grpc.ServiceDesc{
|
||||||
|
ServiceName: "Bank",
|
||||||
|
HandlerType: (*BankServer)(nil),
|
||||||
|
Methods: []grpc.MethodDesc{
|
||||||
|
{
|
||||||
|
MethodName: "OpenAccount",
|
||||||
|
Handler: _Bank_OpenAccount_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "CloseAccount",
|
||||||
|
Handler: _Bank_CloseAccount_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GetAccounts",
|
||||||
|
Handler: _Bank_GetAccounts_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "Deposit",
|
||||||
|
Handler: _Bank_Deposit_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "Withdraw",
|
||||||
|
Handler: _Bank_Withdraw_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "Transfer",
|
||||||
|
Handler: _Bank_Transfer_Handler,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Streams: []grpc.StreamDesc{
|
||||||
|
{
|
||||||
|
StreamName: "GetTransactions",
|
||||||
|
Handler: _Bank_GetTransactions_Handler,
|
||||||
|
ServerStreams: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Metadata: "bank.proto",
|
||||||
|
}
|
||||||
|
|
@ -15,6 +15,7 @@ import (
|
||||||
// a capability to connect customers and support agents in real-time
|
// a capability to connect customers and support agents in real-time
|
||||||
// chat.
|
// chat.
|
||||||
type chatServer struct {
|
type chatServer struct {
|
||||||
|
UnimplementedSupportServer
|
||||||
chatsBySession map[string]*session
|
chatsBySession map[string]*session
|
||||||
chatsAwaitingAgent []string
|
chatsAwaitingAgent []string
|
||||||
lastSession int32
|
lastSession int32
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
//go:generate protoc --go_out=plugins=grpc:./ bank.proto support.proto
|
//go:generate protoc --go_out=. --go-grpc_out=. bank.proto support.proto
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,13 @@
|
||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.25.0-devel
|
// protoc-gen-go v1.25.0-devel
|
||||||
// protoc v3.14.0
|
// protoc v4.22.0
|
||||||
// source: support.proto
|
// source: support.proto
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
context "context"
|
|
||||||
proto "github.com/golang/protobuf/proto"
|
proto "github.com/golang/protobuf/proto"
|
||||||
grpc "google.golang.org/grpc"
|
|
||||||
codes "google.golang.org/grpc/codes"
|
|
||||||
status "google.golang.org/grpc/status"
|
|
||||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
|
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
|
||||||
|
|
@ -79,6 +75,7 @@ type ChatCustomerRequest struct {
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
// Types that are assignable to Req:
|
// Types that are assignable to Req:
|
||||||
|
//
|
||||||
// *ChatCustomerRequest_Init
|
// *ChatCustomerRequest_Init
|
||||||
// *ChatCustomerRequest_Msg
|
// *ChatCustomerRequest_Msg
|
||||||
// *ChatCustomerRequest_HangUp
|
// *ChatCustomerRequest_HangUp
|
||||||
|
|
@ -286,6 +283,7 @@ type ChatCustomerResponse struct {
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
// Types that are assignable to Resp:
|
// Types that are assignable to Resp:
|
||||||
|
//
|
||||||
// *ChatCustomerResponse_Session
|
// *ChatCustomerResponse_Session
|
||||||
// *ChatCustomerResponse_Msg
|
// *ChatCustomerResponse_Msg
|
||||||
Resp isChatCustomerResponse_Resp `protobuf_oneof:"resp"`
|
Resp isChatCustomerResponse_Resp `protobuf_oneof:"resp"`
|
||||||
|
|
@ -371,6 +369,7 @@ type ChatAgentRequest struct {
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
// Types that are assignable to Req:
|
// Types that are assignable to Req:
|
||||||
|
//
|
||||||
// *ChatAgentRequest_Accept
|
// *ChatAgentRequest_Accept
|
||||||
// *ChatAgentRequest_Msg
|
// *ChatAgentRequest_Msg
|
||||||
// *ChatAgentRequest_LeaveSession
|
// *ChatAgentRequest_LeaveSession
|
||||||
|
|
@ -524,6 +523,7 @@ type ChatEntry struct {
|
||||||
|
|
||||||
Date *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=date,proto3" json:"date,omitempty"`
|
Date *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=date,proto3" json:"date,omitempty"`
|
||||||
// Types that are assignable to Entry:
|
// Types that are assignable to Entry:
|
||||||
|
//
|
||||||
// *ChatEntry_CustomerMsg
|
// *ChatEntry_CustomerMsg
|
||||||
// *ChatEntry_AgentMsg
|
// *ChatEntry_AgentMsg
|
||||||
Entry isChatEntry_Entry `protobuf_oneof:"entry"`
|
Entry isChatEntry_Entry `protobuf_oneof:"entry"`
|
||||||
|
|
@ -611,6 +611,7 @@ type ChatAgentResponse struct {
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
// Types that are assignable to Resp:
|
// Types that are assignable to Resp:
|
||||||
|
//
|
||||||
// *ChatAgentResponse_AcceptedSession
|
// *ChatAgentResponse_AcceptedSession
|
||||||
// *ChatAgentResponse_Msg
|
// *ChatAgentResponse_Msg
|
||||||
// *ChatAgentResponse_SessionEnded
|
// *ChatAgentResponse_SessionEnded
|
||||||
|
|
@ -1056,199 +1057,3 @@ func file_support_proto_init() {
|
||||||
file_support_proto_goTypes = nil
|
file_support_proto_goTypes = nil
|
||||||
file_support_proto_depIdxs = nil
|
file_support_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
|
||||||
var _ context.Context
|
|
||||||
var _ grpc.ClientConnInterface
|
|
||||||
|
|
||||||
// This is a compile-time assertion to ensure that this generated file
|
|
||||||
// is compatible with the grpc package it is being compiled against.
|
|
||||||
const _ = grpc.SupportPackageIsVersion6
|
|
||||||
|
|
||||||
// SupportClient is the client API for Support service.
|
|
||||||
//
|
|
||||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
|
||||||
type SupportClient interface {
|
|
||||||
// ChatCustomer is used by a customer-facing app to send the customer's messages
|
|
||||||
// to a chat session. The customer is how initiates and terminates (via "hangup")
|
|
||||||
// a chat session. Only customers may invoke this method (e.g. requests must
|
|
||||||
// include customer auth credentials).
|
|
||||||
ChatCustomer(ctx context.Context, opts ...grpc.CallOption) (Support_ChatCustomerClient, error)
|
|
||||||
// ChatAgent is used by an agent-facing app to allow an agent to reply to a
|
|
||||||
// customer's messages in a chat session. The agent may accept a chat session,
|
|
||||||
// which defaults to the session awaiting an agent for the longest period of time
|
|
||||||
// (FIFO queue).
|
|
||||||
ChatAgent(ctx context.Context, opts ...grpc.CallOption) (Support_ChatAgentClient, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
type supportClient struct {
|
|
||||||
cc grpc.ClientConnInterface
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewSupportClient(cc grpc.ClientConnInterface) SupportClient {
|
|
||||||
return &supportClient{cc}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *supportClient) ChatCustomer(ctx context.Context, opts ...grpc.CallOption) (Support_ChatCustomerClient, error) {
|
|
||||||
stream, err := c.cc.NewStream(ctx, &_Support_serviceDesc.Streams[0], "/Support/ChatCustomer", opts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
x := &supportChatCustomerClient{stream}
|
|
||||||
return x, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type Support_ChatCustomerClient interface {
|
|
||||||
Send(*ChatCustomerRequest) error
|
|
||||||
Recv() (*ChatCustomerResponse, error)
|
|
||||||
grpc.ClientStream
|
|
||||||
}
|
|
||||||
|
|
||||||
type supportChatCustomerClient struct {
|
|
||||||
grpc.ClientStream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *supportChatCustomerClient) Send(m *ChatCustomerRequest) error {
|
|
||||||
return x.ClientStream.SendMsg(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *supportChatCustomerClient) Recv() (*ChatCustomerResponse, error) {
|
|
||||||
m := new(ChatCustomerResponse)
|
|
||||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return m, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *supportClient) ChatAgent(ctx context.Context, opts ...grpc.CallOption) (Support_ChatAgentClient, error) {
|
|
||||||
stream, err := c.cc.NewStream(ctx, &_Support_serviceDesc.Streams[1], "/Support/ChatAgent", opts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
x := &supportChatAgentClient{stream}
|
|
||||||
return x, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type Support_ChatAgentClient interface {
|
|
||||||
Send(*ChatAgentRequest) error
|
|
||||||
Recv() (*ChatAgentResponse, error)
|
|
||||||
grpc.ClientStream
|
|
||||||
}
|
|
||||||
|
|
||||||
type supportChatAgentClient struct {
|
|
||||||
grpc.ClientStream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *supportChatAgentClient) Send(m *ChatAgentRequest) error {
|
|
||||||
return x.ClientStream.SendMsg(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *supportChatAgentClient) Recv() (*ChatAgentResponse, error) {
|
|
||||||
m := new(ChatAgentResponse)
|
|
||||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return m, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// SupportServer is the server API for Support service.
|
|
||||||
type SupportServer interface {
|
|
||||||
// ChatCustomer is used by a customer-facing app to send the customer's messages
|
|
||||||
// to a chat session. The customer is how initiates and terminates (via "hangup")
|
|
||||||
// a chat session. Only customers may invoke this method (e.g. requests must
|
|
||||||
// include customer auth credentials).
|
|
||||||
ChatCustomer(Support_ChatCustomerServer) error
|
|
||||||
// ChatAgent is used by an agent-facing app to allow an agent to reply to a
|
|
||||||
// customer's messages in a chat session. The agent may accept a chat session,
|
|
||||||
// which defaults to the session awaiting an agent for the longest period of time
|
|
||||||
// (FIFO queue).
|
|
||||||
ChatAgent(Support_ChatAgentServer) error
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnimplementedSupportServer can be embedded to have forward compatible implementations.
|
|
||||||
type UnimplementedSupportServer struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*UnimplementedSupportServer) ChatCustomer(Support_ChatCustomerServer) error {
|
|
||||||
return status.Errorf(codes.Unimplemented, "method ChatCustomer not implemented")
|
|
||||||
}
|
|
||||||
func (*UnimplementedSupportServer) ChatAgent(Support_ChatAgentServer) error {
|
|
||||||
return status.Errorf(codes.Unimplemented, "method ChatAgent not implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
func RegisterSupportServer(s *grpc.Server, srv SupportServer) {
|
|
||||||
s.RegisterService(&_Support_serviceDesc, srv)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _Support_ChatCustomer_Handler(srv interface{}, stream grpc.ServerStream) error {
|
|
||||||
return srv.(SupportServer).ChatCustomer(&supportChatCustomerServer{stream})
|
|
||||||
}
|
|
||||||
|
|
||||||
type Support_ChatCustomerServer interface {
|
|
||||||
Send(*ChatCustomerResponse) error
|
|
||||||
Recv() (*ChatCustomerRequest, error)
|
|
||||||
grpc.ServerStream
|
|
||||||
}
|
|
||||||
|
|
||||||
type supportChatCustomerServer struct {
|
|
||||||
grpc.ServerStream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *supportChatCustomerServer) Send(m *ChatCustomerResponse) error {
|
|
||||||
return x.ServerStream.SendMsg(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *supportChatCustomerServer) Recv() (*ChatCustomerRequest, error) {
|
|
||||||
m := new(ChatCustomerRequest)
|
|
||||||
if err := x.ServerStream.RecvMsg(m); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return m, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func _Support_ChatAgent_Handler(srv interface{}, stream grpc.ServerStream) error {
|
|
||||||
return srv.(SupportServer).ChatAgent(&supportChatAgentServer{stream})
|
|
||||||
}
|
|
||||||
|
|
||||||
type Support_ChatAgentServer interface {
|
|
||||||
Send(*ChatAgentResponse) error
|
|
||||||
Recv() (*ChatAgentRequest, error)
|
|
||||||
grpc.ServerStream
|
|
||||||
}
|
|
||||||
|
|
||||||
type supportChatAgentServer struct {
|
|
||||||
grpc.ServerStream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *supportChatAgentServer) Send(m *ChatAgentResponse) error {
|
|
||||||
return x.ServerStream.SendMsg(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *supportChatAgentServer) Recv() (*ChatAgentRequest, error) {
|
|
||||||
m := new(ChatAgentRequest)
|
|
||||||
if err := x.ServerStream.RecvMsg(m); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return m, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var _Support_serviceDesc = grpc.ServiceDesc{
|
|
||||||
ServiceName: "Support",
|
|
||||||
HandlerType: (*SupportServer)(nil),
|
|
||||||
Methods: []grpc.MethodDesc{},
|
|
||||||
Streams: []grpc.StreamDesc{
|
|
||||||
{
|
|
||||||
StreamName: "ChatCustomer",
|
|
||||||
Handler: _Support_ChatCustomer_Handler,
|
|
||||||
ServerStreams: true,
|
|
||||||
ClientStreams: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
StreamName: "ChatAgent",
|
|
||||||
Handler: _Support_ChatAgent_Handler,
|
|
||||||
ServerStreams: true,
|
|
||||||
ClientStreams: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Metadata: "support.proto",
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,217 @@
|
||||||
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
context "context"
|
||||||
|
grpc "google.golang.org/grpc"
|
||||||
|
codes "google.golang.org/grpc/codes"
|
||||||
|
status "google.golang.org/grpc/status"
|
||||||
|
)
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the grpc package it is being compiled against.
|
||||||
|
// Requires gRPC-Go v1.32.0 or later.
|
||||||
|
const _ = grpc.SupportPackageIsVersion7
|
||||||
|
|
||||||
|
// SupportClient is the client API for Support service.
|
||||||
|
//
|
||||||
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||||
|
type SupportClient interface {
|
||||||
|
// ChatCustomer is used by a customer-facing app to send the customer's messages
|
||||||
|
// to a chat session. The customer is how initiates and terminates (via "hangup")
|
||||||
|
// a chat session. Only customers may invoke this method (e.g. requests must
|
||||||
|
// include customer auth credentials).
|
||||||
|
ChatCustomer(ctx context.Context, opts ...grpc.CallOption) (Support_ChatCustomerClient, error)
|
||||||
|
// ChatAgent is used by an agent-facing app to allow an agent to reply to a
|
||||||
|
// customer's messages in a chat session. The agent may accept a chat session,
|
||||||
|
// which defaults to the session awaiting an agent for the longest period of time
|
||||||
|
// (FIFO queue).
|
||||||
|
ChatAgent(ctx context.Context, opts ...grpc.CallOption) (Support_ChatAgentClient, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type supportClient struct {
|
||||||
|
cc grpc.ClientConnInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewSupportClient(cc grpc.ClientConnInterface) SupportClient {
|
||||||
|
return &supportClient{cc}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *supportClient) ChatCustomer(ctx context.Context, opts ...grpc.CallOption) (Support_ChatCustomerClient, error) {
|
||||||
|
stream, err := c.cc.NewStream(ctx, &Support_ServiceDesc.Streams[0], "/Support/ChatCustomer", opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
x := &supportChatCustomerClient{stream}
|
||||||
|
return x, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type Support_ChatCustomerClient interface {
|
||||||
|
Send(*ChatCustomerRequest) error
|
||||||
|
Recv() (*ChatCustomerResponse, error)
|
||||||
|
grpc.ClientStream
|
||||||
|
}
|
||||||
|
|
||||||
|
type supportChatCustomerClient struct {
|
||||||
|
grpc.ClientStream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *supportChatCustomerClient) Send(m *ChatCustomerRequest) error {
|
||||||
|
return x.ClientStream.SendMsg(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *supportChatCustomerClient) Recv() (*ChatCustomerResponse, error) {
|
||||||
|
m := new(ChatCustomerResponse)
|
||||||
|
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *supportClient) ChatAgent(ctx context.Context, opts ...grpc.CallOption) (Support_ChatAgentClient, error) {
|
||||||
|
stream, err := c.cc.NewStream(ctx, &Support_ServiceDesc.Streams[1], "/Support/ChatAgent", opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
x := &supportChatAgentClient{stream}
|
||||||
|
return x, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type Support_ChatAgentClient interface {
|
||||||
|
Send(*ChatAgentRequest) error
|
||||||
|
Recv() (*ChatAgentResponse, error)
|
||||||
|
grpc.ClientStream
|
||||||
|
}
|
||||||
|
|
||||||
|
type supportChatAgentClient struct {
|
||||||
|
grpc.ClientStream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *supportChatAgentClient) Send(m *ChatAgentRequest) error {
|
||||||
|
return x.ClientStream.SendMsg(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *supportChatAgentClient) Recv() (*ChatAgentResponse, error) {
|
||||||
|
m := new(ChatAgentResponse)
|
||||||
|
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// SupportServer is the server API for Support service.
|
||||||
|
// All implementations must embed UnimplementedSupportServer
|
||||||
|
// for forward compatibility
|
||||||
|
type SupportServer interface {
|
||||||
|
// ChatCustomer is used by a customer-facing app to send the customer's messages
|
||||||
|
// to a chat session. The customer is how initiates and terminates (via "hangup")
|
||||||
|
// a chat session. Only customers may invoke this method (e.g. requests must
|
||||||
|
// include customer auth credentials).
|
||||||
|
ChatCustomer(Support_ChatCustomerServer) error
|
||||||
|
// ChatAgent is used by an agent-facing app to allow an agent to reply to a
|
||||||
|
// customer's messages in a chat session. The agent may accept a chat session,
|
||||||
|
// which defaults to the session awaiting an agent for the longest period of time
|
||||||
|
// (FIFO queue).
|
||||||
|
ChatAgent(Support_ChatAgentServer) error
|
||||||
|
mustEmbedUnimplementedSupportServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnimplementedSupportServer must be embedded to have forward compatible implementations.
|
||||||
|
type UnimplementedSupportServer struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (UnimplementedSupportServer) ChatCustomer(Support_ChatCustomerServer) error {
|
||||||
|
return status.Errorf(codes.Unimplemented, "method ChatCustomer not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedSupportServer) ChatAgent(Support_ChatAgentServer) error {
|
||||||
|
return status.Errorf(codes.Unimplemented, "method ChatAgent not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedSupportServer) mustEmbedUnimplementedSupportServer() {}
|
||||||
|
|
||||||
|
// UnsafeSupportServer may be embedded to opt out of forward compatibility for this service.
|
||||||
|
// Use of this interface is not recommended, as added methods to SupportServer will
|
||||||
|
// result in compilation errors.
|
||||||
|
type UnsafeSupportServer interface {
|
||||||
|
mustEmbedUnimplementedSupportServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterSupportServer(s grpc.ServiceRegistrar, srv SupportServer) {
|
||||||
|
s.RegisterService(&Support_ServiceDesc, srv)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _Support_ChatCustomer_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||||
|
return srv.(SupportServer).ChatCustomer(&supportChatCustomerServer{stream})
|
||||||
|
}
|
||||||
|
|
||||||
|
type Support_ChatCustomerServer interface {
|
||||||
|
Send(*ChatCustomerResponse) error
|
||||||
|
Recv() (*ChatCustomerRequest, error)
|
||||||
|
grpc.ServerStream
|
||||||
|
}
|
||||||
|
|
||||||
|
type supportChatCustomerServer struct {
|
||||||
|
grpc.ServerStream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *supportChatCustomerServer) Send(m *ChatCustomerResponse) error {
|
||||||
|
return x.ServerStream.SendMsg(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *supportChatCustomerServer) Recv() (*ChatCustomerRequest, error) {
|
||||||
|
m := new(ChatCustomerRequest)
|
||||||
|
if err := x.ServerStream.RecvMsg(m); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func _Support_ChatAgent_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||||
|
return srv.(SupportServer).ChatAgent(&supportChatAgentServer{stream})
|
||||||
|
}
|
||||||
|
|
||||||
|
type Support_ChatAgentServer interface {
|
||||||
|
Send(*ChatAgentResponse) error
|
||||||
|
Recv() (*ChatAgentRequest, error)
|
||||||
|
grpc.ServerStream
|
||||||
|
}
|
||||||
|
|
||||||
|
type supportChatAgentServer struct {
|
||||||
|
grpc.ServerStream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *supportChatAgentServer) Send(m *ChatAgentResponse) error {
|
||||||
|
return x.ServerStream.SendMsg(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *supportChatAgentServer) Recv() (*ChatAgentRequest, error) {
|
||||||
|
m := new(ChatAgentRequest)
|
||||||
|
if err := x.ServerStream.RecvMsg(m); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Support_ServiceDesc is the grpc.ServiceDesc for Support service.
|
||||||
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
|
// and not to be introspected or modified (even as a copy)
|
||||||
|
var Support_ServiceDesc = grpc.ServiceDesc{
|
||||||
|
ServiceName: "Support",
|
||||||
|
HandlerType: (*SupportServer)(nil),
|
||||||
|
Methods: []grpc.MethodDesc{},
|
||||||
|
Streams: []grpc.StreamDesc{
|
||||||
|
{
|
||||||
|
StreamName: "ChatCustomer",
|
||||||
|
Handler: _Support_ChatCustomer_Handler,
|
||||||
|
ServerStreams: true,
|
||||||
|
ClientStreams: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
StreamName: "ChatAgent",
|
||||||
|
Handler: _Support_ChatAgent_Handler,
|
||||||
|
ServerStreams: true,
|
||||||
|
ClientStreams: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Metadata: "support.proto",
|
||||||
|
}
|
||||||
Binary file not shown.
|
|
@ -20,17 +20,13 @@
|
||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.25.0-devel
|
// protoc-gen-go v1.25.0-devel
|
||||||
// protoc v3.14.0
|
// protoc v4.22.0
|
||||||
// source: test.proto
|
// source: test.proto
|
||||||
|
|
||||||
package testing
|
package testing
|
||||||
|
|
||||||
import (
|
import (
|
||||||
context "context"
|
|
||||||
proto "github.com/golang/protobuf/proto"
|
proto "github.com/golang/protobuf/proto"
|
||||||
grpc "google.golang.org/grpc"
|
|
||||||
codes "google.golang.org/grpc/codes"
|
|
||||||
status "google.golang.org/grpc/status"
|
|
||||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
|
|
@ -1032,491 +1028,3 @@ func file_test_proto_init() {
|
||||||
file_test_proto_goTypes = nil
|
file_test_proto_goTypes = nil
|
||||||
file_test_proto_depIdxs = nil
|
file_test_proto_depIdxs = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
|
||||||
var _ context.Context
|
|
||||||
var _ grpc.ClientConnInterface
|
|
||||||
|
|
||||||
// This is a compile-time assertion to ensure that this generated file
|
|
||||||
// is compatible with the grpc package it is being compiled against.
|
|
||||||
const _ = grpc.SupportPackageIsVersion6
|
|
||||||
|
|
||||||
// TestServiceClient is the client API for TestService service.
|
|
||||||
//
|
|
||||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
|
||||||
type TestServiceClient interface {
|
|
||||||
// One empty request followed by one empty response.
|
|
||||||
EmptyCall(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error)
|
|
||||||
// One request followed by one response.
|
|
||||||
// The server returns the client payload as-is.
|
|
||||||
UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error)
|
|
||||||
// One request followed by a sequence of responses (streamed download).
|
|
||||||
// The server returns the payload with client desired type and sizes.
|
|
||||||
StreamingOutputCall(ctx context.Context, in *StreamingOutputCallRequest, opts ...grpc.CallOption) (TestService_StreamingOutputCallClient, error)
|
|
||||||
// A sequence of requests followed by one response (streamed upload).
|
|
||||||
// The server returns the aggregated size of client payload as the result.
|
|
||||||
StreamingInputCall(ctx context.Context, opts ...grpc.CallOption) (TestService_StreamingInputCallClient, error)
|
|
||||||
// A sequence of requests with each request served by the server immediately.
|
|
||||||
// As one request could lead to multiple responses, this interface
|
|
||||||
// demonstrates the idea of full duplexing.
|
|
||||||
FullDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_FullDuplexCallClient, error)
|
|
||||||
// A sequence of requests followed by a sequence of responses.
|
|
||||||
// The server buffers all the client requests and then serves them in order. A
|
|
||||||
// stream of responses are returned to the client when the server starts with
|
|
||||||
// first request.
|
|
||||||
HalfDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_HalfDuplexCallClient, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
type testServiceClient struct {
|
|
||||||
cc grpc.ClientConnInterface
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewTestServiceClient(cc grpc.ClientConnInterface) TestServiceClient {
|
|
||||||
return &testServiceClient{cc}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *testServiceClient) EmptyCall(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) {
|
|
||||||
out := new(Empty)
|
|
||||||
err := c.cc.Invoke(ctx, "/testing.TestService/EmptyCall", in, out, opts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *testServiceClient) UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) {
|
|
||||||
out := new(SimpleResponse)
|
|
||||||
err := c.cc.Invoke(ctx, "/testing.TestService/UnaryCall", in, out, opts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *testServiceClient) StreamingOutputCall(ctx context.Context, in *StreamingOutputCallRequest, opts ...grpc.CallOption) (TestService_StreamingOutputCallClient, error) {
|
|
||||||
stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[0], "/testing.TestService/StreamingOutputCall", opts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
x := &testServiceStreamingOutputCallClient{stream}
|
|
||||||
if err := x.ClientStream.SendMsg(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if err := x.ClientStream.CloseSend(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return x, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type TestService_StreamingOutputCallClient interface {
|
|
||||||
Recv() (*StreamingOutputCallResponse, error)
|
|
||||||
grpc.ClientStream
|
|
||||||
}
|
|
||||||
|
|
||||||
type testServiceStreamingOutputCallClient struct {
|
|
||||||
grpc.ClientStream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *testServiceStreamingOutputCallClient) Recv() (*StreamingOutputCallResponse, error) {
|
|
||||||
m := new(StreamingOutputCallResponse)
|
|
||||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return m, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *testServiceClient) StreamingInputCall(ctx context.Context, opts ...grpc.CallOption) (TestService_StreamingInputCallClient, error) {
|
|
||||||
stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[1], "/testing.TestService/StreamingInputCall", opts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
x := &testServiceStreamingInputCallClient{stream}
|
|
||||||
return x, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type TestService_StreamingInputCallClient interface {
|
|
||||||
Send(*StreamingInputCallRequest) error
|
|
||||||
CloseAndRecv() (*StreamingInputCallResponse, error)
|
|
||||||
grpc.ClientStream
|
|
||||||
}
|
|
||||||
|
|
||||||
type testServiceStreamingInputCallClient struct {
|
|
||||||
grpc.ClientStream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *testServiceStreamingInputCallClient) Send(m *StreamingInputCallRequest) error {
|
|
||||||
return x.ClientStream.SendMsg(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *testServiceStreamingInputCallClient) CloseAndRecv() (*StreamingInputCallResponse, error) {
|
|
||||||
if err := x.ClientStream.CloseSend(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
m := new(StreamingInputCallResponse)
|
|
||||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return m, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *testServiceClient) FullDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_FullDuplexCallClient, error) {
|
|
||||||
stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[2], "/testing.TestService/FullDuplexCall", opts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
x := &testServiceFullDuplexCallClient{stream}
|
|
||||||
return x, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type TestService_FullDuplexCallClient interface {
|
|
||||||
Send(*StreamingOutputCallRequest) error
|
|
||||||
Recv() (*StreamingOutputCallResponse, error)
|
|
||||||
grpc.ClientStream
|
|
||||||
}
|
|
||||||
|
|
||||||
type testServiceFullDuplexCallClient struct {
|
|
||||||
grpc.ClientStream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *testServiceFullDuplexCallClient) Send(m *StreamingOutputCallRequest) error {
|
|
||||||
return x.ClientStream.SendMsg(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *testServiceFullDuplexCallClient) Recv() (*StreamingOutputCallResponse, error) {
|
|
||||||
m := new(StreamingOutputCallResponse)
|
|
||||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return m, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *testServiceClient) HalfDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_HalfDuplexCallClient, error) {
|
|
||||||
stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[3], "/testing.TestService/HalfDuplexCall", opts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
x := &testServiceHalfDuplexCallClient{stream}
|
|
||||||
return x, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type TestService_HalfDuplexCallClient interface {
|
|
||||||
Send(*StreamingOutputCallRequest) error
|
|
||||||
Recv() (*StreamingOutputCallResponse, error)
|
|
||||||
grpc.ClientStream
|
|
||||||
}
|
|
||||||
|
|
||||||
type testServiceHalfDuplexCallClient struct {
|
|
||||||
grpc.ClientStream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *testServiceHalfDuplexCallClient) Send(m *StreamingOutputCallRequest) error {
|
|
||||||
return x.ClientStream.SendMsg(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *testServiceHalfDuplexCallClient) Recv() (*StreamingOutputCallResponse, error) {
|
|
||||||
m := new(StreamingOutputCallResponse)
|
|
||||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return m, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// TestServiceServer is the server API for TestService service.
|
|
||||||
type TestServiceServer interface {
|
|
||||||
// One empty request followed by one empty response.
|
|
||||||
EmptyCall(context.Context, *Empty) (*Empty, error)
|
|
||||||
// One request followed by one response.
|
|
||||||
// The server returns the client payload as-is.
|
|
||||||
UnaryCall(context.Context, *SimpleRequest) (*SimpleResponse, error)
|
|
||||||
// One request followed by a sequence of responses (streamed download).
|
|
||||||
// The server returns the payload with client desired type and sizes.
|
|
||||||
StreamingOutputCall(*StreamingOutputCallRequest, TestService_StreamingOutputCallServer) error
|
|
||||||
// A sequence of requests followed by one response (streamed upload).
|
|
||||||
// The server returns the aggregated size of client payload as the result.
|
|
||||||
StreamingInputCall(TestService_StreamingInputCallServer) error
|
|
||||||
// A sequence of requests with each request served by the server immediately.
|
|
||||||
// As one request could lead to multiple responses, this interface
|
|
||||||
// demonstrates the idea of full duplexing.
|
|
||||||
FullDuplexCall(TestService_FullDuplexCallServer) error
|
|
||||||
// A sequence of requests followed by a sequence of responses.
|
|
||||||
// The server buffers all the client requests and then serves them in order. A
|
|
||||||
// stream of responses are returned to the client when the server starts with
|
|
||||||
// first request.
|
|
||||||
HalfDuplexCall(TestService_HalfDuplexCallServer) error
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnimplementedTestServiceServer can be embedded to have forward compatible implementations.
|
|
||||||
type UnimplementedTestServiceServer struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*UnimplementedTestServiceServer) EmptyCall(context.Context, *Empty) (*Empty, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method EmptyCall not implemented")
|
|
||||||
}
|
|
||||||
func (*UnimplementedTestServiceServer) UnaryCall(context.Context, *SimpleRequest) (*SimpleResponse, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method UnaryCall not implemented")
|
|
||||||
}
|
|
||||||
func (*UnimplementedTestServiceServer) StreamingOutputCall(*StreamingOutputCallRequest, TestService_StreamingOutputCallServer) error {
|
|
||||||
return status.Errorf(codes.Unimplemented, "method StreamingOutputCall not implemented")
|
|
||||||
}
|
|
||||||
func (*UnimplementedTestServiceServer) StreamingInputCall(TestService_StreamingInputCallServer) error {
|
|
||||||
return status.Errorf(codes.Unimplemented, "method StreamingInputCall not implemented")
|
|
||||||
}
|
|
||||||
func (*UnimplementedTestServiceServer) FullDuplexCall(TestService_FullDuplexCallServer) error {
|
|
||||||
return status.Errorf(codes.Unimplemented, "method FullDuplexCall not implemented")
|
|
||||||
}
|
|
||||||
func (*UnimplementedTestServiceServer) HalfDuplexCall(TestService_HalfDuplexCallServer) error {
|
|
||||||
return status.Errorf(codes.Unimplemented, "method HalfDuplexCall not implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
func RegisterTestServiceServer(s *grpc.Server, srv TestServiceServer) {
|
|
||||||
s.RegisterService(&_TestService_serviceDesc, srv)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _TestService_EmptyCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(Empty)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(TestServiceServer).EmptyCall(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: "/testing.TestService/EmptyCall",
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(TestServiceServer).EmptyCall(ctx, req.(*Empty))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _TestService_UnaryCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(SimpleRequest)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(TestServiceServer).UnaryCall(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: "/testing.TestService/UnaryCall",
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(TestServiceServer).UnaryCall(ctx, req.(*SimpleRequest))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _TestService_StreamingOutputCall_Handler(srv interface{}, stream grpc.ServerStream) error {
|
|
||||||
m := new(StreamingOutputCallRequest)
|
|
||||||
if err := stream.RecvMsg(m); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return srv.(TestServiceServer).StreamingOutputCall(m, &testServiceStreamingOutputCallServer{stream})
|
|
||||||
}
|
|
||||||
|
|
||||||
type TestService_StreamingOutputCallServer interface {
|
|
||||||
Send(*StreamingOutputCallResponse) error
|
|
||||||
grpc.ServerStream
|
|
||||||
}
|
|
||||||
|
|
||||||
type testServiceStreamingOutputCallServer struct {
|
|
||||||
grpc.ServerStream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *testServiceStreamingOutputCallServer) Send(m *StreamingOutputCallResponse) error {
|
|
||||||
return x.ServerStream.SendMsg(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _TestService_StreamingInputCall_Handler(srv interface{}, stream grpc.ServerStream) error {
|
|
||||||
return srv.(TestServiceServer).StreamingInputCall(&testServiceStreamingInputCallServer{stream})
|
|
||||||
}
|
|
||||||
|
|
||||||
type TestService_StreamingInputCallServer interface {
|
|
||||||
SendAndClose(*StreamingInputCallResponse) error
|
|
||||||
Recv() (*StreamingInputCallRequest, error)
|
|
||||||
grpc.ServerStream
|
|
||||||
}
|
|
||||||
|
|
||||||
type testServiceStreamingInputCallServer struct {
|
|
||||||
grpc.ServerStream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *testServiceStreamingInputCallServer) SendAndClose(m *StreamingInputCallResponse) error {
|
|
||||||
return x.ServerStream.SendMsg(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *testServiceStreamingInputCallServer) Recv() (*StreamingInputCallRequest, error) {
|
|
||||||
m := new(StreamingInputCallRequest)
|
|
||||||
if err := x.ServerStream.RecvMsg(m); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return m, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func _TestService_FullDuplexCall_Handler(srv interface{}, stream grpc.ServerStream) error {
|
|
||||||
return srv.(TestServiceServer).FullDuplexCall(&testServiceFullDuplexCallServer{stream})
|
|
||||||
}
|
|
||||||
|
|
||||||
type TestService_FullDuplexCallServer interface {
|
|
||||||
Send(*StreamingOutputCallResponse) error
|
|
||||||
Recv() (*StreamingOutputCallRequest, error)
|
|
||||||
grpc.ServerStream
|
|
||||||
}
|
|
||||||
|
|
||||||
type testServiceFullDuplexCallServer struct {
|
|
||||||
grpc.ServerStream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *testServiceFullDuplexCallServer) Send(m *StreamingOutputCallResponse) error {
|
|
||||||
return x.ServerStream.SendMsg(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *testServiceFullDuplexCallServer) Recv() (*StreamingOutputCallRequest, error) {
|
|
||||||
m := new(StreamingOutputCallRequest)
|
|
||||||
if err := x.ServerStream.RecvMsg(m); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return m, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func _TestService_HalfDuplexCall_Handler(srv interface{}, stream grpc.ServerStream) error {
|
|
||||||
return srv.(TestServiceServer).HalfDuplexCall(&testServiceHalfDuplexCallServer{stream})
|
|
||||||
}
|
|
||||||
|
|
||||||
type TestService_HalfDuplexCallServer interface {
|
|
||||||
Send(*StreamingOutputCallResponse) error
|
|
||||||
Recv() (*StreamingOutputCallRequest, error)
|
|
||||||
grpc.ServerStream
|
|
||||||
}
|
|
||||||
|
|
||||||
type testServiceHalfDuplexCallServer struct {
|
|
||||||
grpc.ServerStream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *testServiceHalfDuplexCallServer) Send(m *StreamingOutputCallResponse) error {
|
|
||||||
return x.ServerStream.SendMsg(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *testServiceHalfDuplexCallServer) Recv() (*StreamingOutputCallRequest, error) {
|
|
||||||
m := new(StreamingOutputCallRequest)
|
|
||||||
if err := x.ServerStream.RecvMsg(m); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return m, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var _TestService_serviceDesc = grpc.ServiceDesc{
|
|
||||||
ServiceName: "testing.TestService",
|
|
||||||
HandlerType: (*TestServiceServer)(nil),
|
|
||||||
Methods: []grpc.MethodDesc{
|
|
||||||
{
|
|
||||||
MethodName: "EmptyCall",
|
|
||||||
Handler: _TestService_EmptyCall_Handler,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
MethodName: "UnaryCall",
|
|
||||||
Handler: _TestService_UnaryCall_Handler,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Streams: []grpc.StreamDesc{
|
|
||||||
{
|
|
||||||
StreamName: "StreamingOutputCall",
|
|
||||||
Handler: _TestService_StreamingOutputCall_Handler,
|
|
||||||
ServerStreams: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
StreamName: "StreamingInputCall",
|
|
||||||
Handler: _TestService_StreamingInputCall_Handler,
|
|
||||||
ClientStreams: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
StreamName: "FullDuplexCall",
|
|
||||||
Handler: _TestService_FullDuplexCall_Handler,
|
|
||||||
ServerStreams: true,
|
|
||||||
ClientStreams: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
StreamName: "HalfDuplexCall",
|
|
||||||
Handler: _TestService_HalfDuplexCall_Handler,
|
|
||||||
ServerStreams: true,
|
|
||||||
ClientStreams: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Metadata: "test.proto",
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnimplementedServiceClient is the client API for UnimplementedService service.
|
|
||||||
//
|
|
||||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
|
||||||
type UnimplementedServiceClient interface {
|
|
||||||
// A call that no server should implement
|
|
||||||
UnimplementedCall(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
type unimplementedServiceClient struct {
|
|
||||||
cc grpc.ClientConnInterface
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewUnimplementedServiceClient(cc grpc.ClientConnInterface) UnimplementedServiceClient {
|
|
||||||
return &unimplementedServiceClient{cc}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *unimplementedServiceClient) UnimplementedCall(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) {
|
|
||||||
out := new(Empty)
|
|
||||||
err := c.cc.Invoke(ctx, "/testing.UnimplementedService/UnimplementedCall", in, out, opts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnimplementedServiceServer is the server API for UnimplementedService service.
|
|
||||||
type UnimplementedServiceServer interface {
|
|
||||||
// A call that no server should implement
|
|
||||||
UnimplementedCall(context.Context, *Empty) (*Empty, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnimplementedUnimplementedServiceServer can be embedded to have forward compatible implementations.
|
|
||||||
type UnimplementedUnimplementedServiceServer struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*UnimplementedUnimplementedServiceServer) UnimplementedCall(context.Context, *Empty) (*Empty, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method UnimplementedCall not implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
func RegisterUnimplementedServiceServer(s *grpc.Server, srv UnimplementedServiceServer) {
|
|
||||||
s.RegisterService(&_UnimplementedService_serviceDesc, srv)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _UnimplementedService_UnimplementedCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(Empty)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(UnimplementedServiceServer).UnimplementedCall(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: "/testing.UnimplementedService/UnimplementedCall",
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(UnimplementedServiceServer).UnimplementedCall(ctx, req.(*Empty))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _UnimplementedService_serviceDesc = grpc.ServiceDesc{
|
|
||||||
ServiceName: "testing.UnimplementedService",
|
|
||||||
HandlerType: (*UnimplementedServiceServer)(nil),
|
|
||||||
Methods: []grpc.MethodDesc{
|
|
||||||
{
|
|
||||||
MethodName: "UnimplementedCall",
|
|
||||||
Handler: _UnimplementedService_UnimplementedCall_Handler,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Streams: []grpc.StreamDesc{},
|
|
||||||
Metadata: "test.proto",
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,523 @@
|
||||||
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||||
|
|
||||||
|
package testing
|
||||||
|
|
||||||
|
import (
|
||||||
|
context "context"
|
||||||
|
grpc "google.golang.org/grpc"
|
||||||
|
codes "google.golang.org/grpc/codes"
|
||||||
|
status "google.golang.org/grpc/status"
|
||||||
|
)
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the grpc package it is being compiled against.
|
||||||
|
// Requires gRPC-Go v1.32.0 or later.
|
||||||
|
const _ = grpc.SupportPackageIsVersion7
|
||||||
|
|
||||||
|
// TestServiceClient is the client API for TestService service.
|
||||||
|
//
|
||||||
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||||
|
type TestServiceClient interface {
|
||||||
|
// One empty request followed by one empty response.
|
||||||
|
EmptyCall(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error)
|
||||||
|
// One request followed by one response.
|
||||||
|
// The server returns the client payload as-is.
|
||||||
|
UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error)
|
||||||
|
// One request followed by a sequence of responses (streamed download).
|
||||||
|
// The server returns the payload with client desired type and sizes.
|
||||||
|
StreamingOutputCall(ctx context.Context, in *StreamingOutputCallRequest, opts ...grpc.CallOption) (TestService_StreamingOutputCallClient, error)
|
||||||
|
// A sequence of requests followed by one response (streamed upload).
|
||||||
|
// The server returns the aggregated size of client payload as the result.
|
||||||
|
StreamingInputCall(ctx context.Context, opts ...grpc.CallOption) (TestService_StreamingInputCallClient, error)
|
||||||
|
// A sequence of requests with each request served by the server immediately.
|
||||||
|
// As one request could lead to multiple responses, this interface
|
||||||
|
// demonstrates the idea of full duplexing.
|
||||||
|
FullDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_FullDuplexCallClient, error)
|
||||||
|
// A sequence of requests followed by a sequence of responses.
|
||||||
|
// The server buffers all the client requests and then serves them in order. A
|
||||||
|
// stream of responses are returned to the client when the server starts with
|
||||||
|
// first request.
|
||||||
|
HalfDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_HalfDuplexCallClient, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type testServiceClient struct {
|
||||||
|
cc grpc.ClientConnInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewTestServiceClient(cc grpc.ClientConnInterface) TestServiceClient {
|
||||||
|
return &testServiceClient{cc}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *testServiceClient) EmptyCall(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) {
|
||||||
|
out := new(Empty)
|
||||||
|
err := c.cc.Invoke(ctx, "/testing.TestService/EmptyCall", in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *testServiceClient) UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) {
|
||||||
|
out := new(SimpleResponse)
|
||||||
|
err := c.cc.Invoke(ctx, "/testing.TestService/UnaryCall", in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *testServiceClient) StreamingOutputCall(ctx context.Context, in *StreamingOutputCallRequest, opts ...grpc.CallOption) (TestService_StreamingOutputCallClient, error) {
|
||||||
|
stream, err := c.cc.NewStream(ctx, &TestService_ServiceDesc.Streams[0], "/testing.TestService/StreamingOutputCall", opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
x := &testServiceStreamingOutputCallClient{stream}
|
||||||
|
if err := x.ClientStream.SendMsg(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if err := x.ClientStream.CloseSend(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return x, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type TestService_StreamingOutputCallClient interface {
|
||||||
|
Recv() (*StreamingOutputCallResponse, error)
|
||||||
|
grpc.ClientStream
|
||||||
|
}
|
||||||
|
|
||||||
|
type testServiceStreamingOutputCallClient struct {
|
||||||
|
grpc.ClientStream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *testServiceStreamingOutputCallClient) Recv() (*StreamingOutputCallResponse, error) {
|
||||||
|
m := new(StreamingOutputCallResponse)
|
||||||
|
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *testServiceClient) StreamingInputCall(ctx context.Context, opts ...grpc.CallOption) (TestService_StreamingInputCallClient, error) {
|
||||||
|
stream, err := c.cc.NewStream(ctx, &TestService_ServiceDesc.Streams[1], "/testing.TestService/StreamingInputCall", opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
x := &testServiceStreamingInputCallClient{stream}
|
||||||
|
return x, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type TestService_StreamingInputCallClient interface {
|
||||||
|
Send(*StreamingInputCallRequest) error
|
||||||
|
CloseAndRecv() (*StreamingInputCallResponse, error)
|
||||||
|
grpc.ClientStream
|
||||||
|
}
|
||||||
|
|
||||||
|
type testServiceStreamingInputCallClient struct {
|
||||||
|
grpc.ClientStream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *testServiceStreamingInputCallClient) Send(m *StreamingInputCallRequest) error {
|
||||||
|
return x.ClientStream.SendMsg(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *testServiceStreamingInputCallClient) CloseAndRecv() (*StreamingInputCallResponse, error) {
|
||||||
|
if err := x.ClientStream.CloseSend(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
m := new(StreamingInputCallResponse)
|
||||||
|
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *testServiceClient) FullDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_FullDuplexCallClient, error) {
|
||||||
|
stream, err := c.cc.NewStream(ctx, &TestService_ServiceDesc.Streams[2], "/testing.TestService/FullDuplexCall", opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
x := &testServiceFullDuplexCallClient{stream}
|
||||||
|
return x, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type TestService_FullDuplexCallClient interface {
|
||||||
|
Send(*StreamingOutputCallRequest) error
|
||||||
|
Recv() (*StreamingOutputCallResponse, error)
|
||||||
|
grpc.ClientStream
|
||||||
|
}
|
||||||
|
|
||||||
|
type testServiceFullDuplexCallClient struct {
|
||||||
|
grpc.ClientStream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *testServiceFullDuplexCallClient) Send(m *StreamingOutputCallRequest) error {
|
||||||
|
return x.ClientStream.SendMsg(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *testServiceFullDuplexCallClient) Recv() (*StreamingOutputCallResponse, error) {
|
||||||
|
m := new(StreamingOutputCallResponse)
|
||||||
|
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *testServiceClient) HalfDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_HalfDuplexCallClient, error) {
|
||||||
|
stream, err := c.cc.NewStream(ctx, &TestService_ServiceDesc.Streams[3], "/testing.TestService/HalfDuplexCall", opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
x := &testServiceHalfDuplexCallClient{stream}
|
||||||
|
return x, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type TestService_HalfDuplexCallClient interface {
|
||||||
|
Send(*StreamingOutputCallRequest) error
|
||||||
|
Recv() (*StreamingOutputCallResponse, error)
|
||||||
|
grpc.ClientStream
|
||||||
|
}
|
||||||
|
|
||||||
|
type testServiceHalfDuplexCallClient struct {
|
||||||
|
grpc.ClientStream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *testServiceHalfDuplexCallClient) Send(m *StreamingOutputCallRequest) error {
|
||||||
|
return x.ClientStream.SendMsg(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *testServiceHalfDuplexCallClient) Recv() (*StreamingOutputCallResponse, error) {
|
||||||
|
m := new(StreamingOutputCallResponse)
|
||||||
|
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// TestServiceServer is the server API for TestService service.
|
||||||
|
// All implementations must embed UnimplementedTestServiceServer
|
||||||
|
// for forward compatibility
|
||||||
|
type TestServiceServer interface {
|
||||||
|
// One empty request followed by one empty response.
|
||||||
|
EmptyCall(context.Context, *Empty) (*Empty, error)
|
||||||
|
// One request followed by one response.
|
||||||
|
// The server returns the client payload as-is.
|
||||||
|
UnaryCall(context.Context, *SimpleRequest) (*SimpleResponse, error)
|
||||||
|
// One request followed by a sequence of responses (streamed download).
|
||||||
|
// The server returns the payload with client desired type and sizes.
|
||||||
|
StreamingOutputCall(*StreamingOutputCallRequest, TestService_StreamingOutputCallServer) error
|
||||||
|
// A sequence of requests followed by one response (streamed upload).
|
||||||
|
// The server returns the aggregated size of client payload as the result.
|
||||||
|
StreamingInputCall(TestService_StreamingInputCallServer) error
|
||||||
|
// A sequence of requests with each request served by the server immediately.
|
||||||
|
// As one request could lead to multiple responses, this interface
|
||||||
|
// demonstrates the idea of full duplexing.
|
||||||
|
FullDuplexCall(TestService_FullDuplexCallServer) error
|
||||||
|
// A sequence of requests followed by a sequence of responses.
|
||||||
|
// The server buffers all the client requests and then serves them in order. A
|
||||||
|
// stream of responses are returned to the client when the server starts with
|
||||||
|
// first request.
|
||||||
|
HalfDuplexCall(TestService_HalfDuplexCallServer) error
|
||||||
|
mustEmbedUnimplementedTestServiceServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnimplementedTestServiceServer must be embedded to have forward compatible implementations.
|
||||||
|
type UnimplementedTestServiceServer struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (UnimplementedTestServiceServer) EmptyCall(context.Context, *Empty) (*Empty, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method EmptyCall not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedTestServiceServer) UnaryCall(context.Context, *SimpleRequest) (*SimpleResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method UnaryCall not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedTestServiceServer) StreamingOutputCall(*StreamingOutputCallRequest, TestService_StreamingOutputCallServer) error {
|
||||||
|
return status.Errorf(codes.Unimplemented, "method StreamingOutputCall not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedTestServiceServer) StreamingInputCall(TestService_StreamingInputCallServer) error {
|
||||||
|
return status.Errorf(codes.Unimplemented, "method StreamingInputCall not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedTestServiceServer) FullDuplexCall(TestService_FullDuplexCallServer) error {
|
||||||
|
return status.Errorf(codes.Unimplemented, "method FullDuplexCall not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedTestServiceServer) HalfDuplexCall(TestService_HalfDuplexCallServer) error {
|
||||||
|
return status.Errorf(codes.Unimplemented, "method HalfDuplexCall not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedTestServiceServer) mustEmbedUnimplementedTestServiceServer() {}
|
||||||
|
|
||||||
|
// UnsafeTestServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||||
|
// Use of this interface is not recommended, as added methods to TestServiceServer will
|
||||||
|
// result in compilation errors.
|
||||||
|
type UnsafeTestServiceServer interface {
|
||||||
|
mustEmbedUnimplementedTestServiceServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterTestServiceServer(s grpc.ServiceRegistrar, srv TestServiceServer) {
|
||||||
|
s.RegisterService(&TestService_ServiceDesc, srv)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _TestService_EmptyCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(Empty)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(TestServiceServer).EmptyCall(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/testing.TestService/EmptyCall",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(TestServiceServer).EmptyCall(ctx, req.(*Empty))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _TestService_UnaryCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(SimpleRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(TestServiceServer).UnaryCall(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/testing.TestService/UnaryCall",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(TestServiceServer).UnaryCall(ctx, req.(*SimpleRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _TestService_StreamingOutputCall_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||||
|
m := new(StreamingOutputCallRequest)
|
||||||
|
if err := stream.RecvMsg(m); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return srv.(TestServiceServer).StreamingOutputCall(m, &testServiceStreamingOutputCallServer{stream})
|
||||||
|
}
|
||||||
|
|
||||||
|
type TestService_StreamingOutputCallServer interface {
|
||||||
|
Send(*StreamingOutputCallResponse) error
|
||||||
|
grpc.ServerStream
|
||||||
|
}
|
||||||
|
|
||||||
|
type testServiceStreamingOutputCallServer struct {
|
||||||
|
grpc.ServerStream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *testServiceStreamingOutputCallServer) Send(m *StreamingOutputCallResponse) error {
|
||||||
|
return x.ServerStream.SendMsg(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _TestService_StreamingInputCall_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||||
|
return srv.(TestServiceServer).StreamingInputCall(&testServiceStreamingInputCallServer{stream})
|
||||||
|
}
|
||||||
|
|
||||||
|
type TestService_StreamingInputCallServer interface {
|
||||||
|
SendAndClose(*StreamingInputCallResponse) error
|
||||||
|
Recv() (*StreamingInputCallRequest, error)
|
||||||
|
grpc.ServerStream
|
||||||
|
}
|
||||||
|
|
||||||
|
type testServiceStreamingInputCallServer struct {
|
||||||
|
grpc.ServerStream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *testServiceStreamingInputCallServer) SendAndClose(m *StreamingInputCallResponse) error {
|
||||||
|
return x.ServerStream.SendMsg(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *testServiceStreamingInputCallServer) Recv() (*StreamingInputCallRequest, error) {
|
||||||
|
m := new(StreamingInputCallRequest)
|
||||||
|
if err := x.ServerStream.RecvMsg(m); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func _TestService_FullDuplexCall_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||||
|
return srv.(TestServiceServer).FullDuplexCall(&testServiceFullDuplexCallServer{stream})
|
||||||
|
}
|
||||||
|
|
||||||
|
type TestService_FullDuplexCallServer interface {
|
||||||
|
Send(*StreamingOutputCallResponse) error
|
||||||
|
Recv() (*StreamingOutputCallRequest, error)
|
||||||
|
grpc.ServerStream
|
||||||
|
}
|
||||||
|
|
||||||
|
type testServiceFullDuplexCallServer struct {
|
||||||
|
grpc.ServerStream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *testServiceFullDuplexCallServer) Send(m *StreamingOutputCallResponse) error {
|
||||||
|
return x.ServerStream.SendMsg(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *testServiceFullDuplexCallServer) Recv() (*StreamingOutputCallRequest, error) {
|
||||||
|
m := new(StreamingOutputCallRequest)
|
||||||
|
if err := x.ServerStream.RecvMsg(m); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func _TestService_HalfDuplexCall_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||||
|
return srv.(TestServiceServer).HalfDuplexCall(&testServiceHalfDuplexCallServer{stream})
|
||||||
|
}
|
||||||
|
|
||||||
|
type TestService_HalfDuplexCallServer interface {
|
||||||
|
Send(*StreamingOutputCallResponse) error
|
||||||
|
Recv() (*StreamingOutputCallRequest, error)
|
||||||
|
grpc.ServerStream
|
||||||
|
}
|
||||||
|
|
||||||
|
type testServiceHalfDuplexCallServer struct {
|
||||||
|
grpc.ServerStream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *testServiceHalfDuplexCallServer) Send(m *StreamingOutputCallResponse) error {
|
||||||
|
return x.ServerStream.SendMsg(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *testServiceHalfDuplexCallServer) Recv() (*StreamingOutputCallRequest, error) {
|
||||||
|
m := new(StreamingOutputCallRequest)
|
||||||
|
if err := x.ServerStream.RecvMsg(m); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// TestService_ServiceDesc is the grpc.ServiceDesc for TestService service.
|
||||||
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
|
// and not to be introspected or modified (even as a copy)
|
||||||
|
var TestService_ServiceDesc = grpc.ServiceDesc{
|
||||||
|
ServiceName: "testing.TestService",
|
||||||
|
HandlerType: (*TestServiceServer)(nil),
|
||||||
|
Methods: []grpc.MethodDesc{
|
||||||
|
{
|
||||||
|
MethodName: "EmptyCall",
|
||||||
|
Handler: _TestService_EmptyCall_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "UnaryCall",
|
||||||
|
Handler: _TestService_UnaryCall_Handler,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Streams: []grpc.StreamDesc{
|
||||||
|
{
|
||||||
|
StreamName: "StreamingOutputCall",
|
||||||
|
Handler: _TestService_StreamingOutputCall_Handler,
|
||||||
|
ServerStreams: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
StreamName: "StreamingInputCall",
|
||||||
|
Handler: _TestService_StreamingInputCall_Handler,
|
||||||
|
ClientStreams: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
StreamName: "FullDuplexCall",
|
||||||
|
Handler: _TestService_FullDuplexCall_Handler,
|
||||||
|
ServerStreams: true,
|
||||||
|
ClientStreams: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
StreamName: "HalfDuplexCall",
|
||||||
|
Handler: _TestService_HalfDuplexCall_Handler,
|
||||||
|
ServerStreams: true,
|
||||||
|
ClientStreams: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Metadata: "test.proto",
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnimplementedServiceClient is the client API for UnimplementedService service.
|
||||||
|
//
|
||||||
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||||
|
type UnimplementedServiceClient interface {
|
||||||
|
// A call that no server should implement
|
||||||
|
UnimplementedCall(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type unimplementedServiceClient struct {
|
||||||
|
cc grpc.ClientConnInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewUnimplementedServiceClient(cc grpc.ClientConnInterface) UnimplementedServiceClient {
|
||||||
|
return &unimplementedServiceClient{cc}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *unimplementedServiceClient) UnimplementedCall(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) {
|
||||||
|
out := new(Empty)
|
||||||
|
err := c.cc.Invoke(ctx, "/testing.UnimplementedService/UnimplementedCall", in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnimplementedServiceServer is the server API for UnimplementedService service.
|
||||||
|
// All implementations must embed UnimplementedUnimplementedServiceServer
|
||||||
|
// for forward compatibility
|
||||||
|
type UnimplementedServiceServer interface {
|
||||||
|
// A call that no server should implement
|
||||||
|
UnimplementedCall(context.Context, *Empty) (*Empty, error)
|
||||||
|
mustEmbedUnimplementedUnimplementedServiceServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnimplementedUnimplementedServiceServer must be embedded to have forward compatible implementations.
|
||||||
|
type UnimplementedUnimplementedServiceServer struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (UnimplementedUnimplementedServiceServer) UnimplementedCall(context.Context, *Empty) (*Empty, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method UnimplementedCall not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedUnimplementedServiceServer) mustEmbedUnimplementedUnimplementedServiceServer() {}
|
||||||
|
|
||||||
|
// UnsafeUnimplementedServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||||
|
// Use of this interface is not recommended, as added methods to UnimplementedServiceServer will
|
||||||
|
// result in compilation errors.
|
||||||
|
type UnsafeUnimplementedServiceServer interface {
|
||||||
|
mustEmbedUnimplementedUnimplementedServiceServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterUnimplementedServiceServer(s grpc.ServiceRegistrar, srv UnimplementedServiceServer) {
|
||||||
|
s.RegisterService(&UnimplementedService_ServiceDesc, srv)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _UnimplementedService_UnimplementedCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(Empty)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(UnimplementedServiceServer).UnimplementedCall(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/testing.UnimplementedService/UnimplementedCall",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(UnimplementedServiceServer).UnimplementedCall(ctx, req.(*Empty))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnimplementedService_ServiceDesc is the grpc.ServiceDesc for UnimplementedService service.
|
||||||
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
|
// and not to be introspected or modified (even as a copy)
|
||||||
|
var UnimplementedService_ServiceDesc = grpc.ServiceDesc{
|
||||||
|
ServiceName: "testing.UnimplementedService",
|
||||||
|
HandlerType: (*UnimplementedServiceServer)(nil),
|
||||||
|
Methods: []grpc.MethodDesc{
|
||||||
|
{
|
||||||
|
MethodName: "UnimplementedCall",
|
||||||
|
Handler: _UnimplementedService_UnimplementedCall_Handler,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Streams: []grpc.StreamDesc{},
|
||||||
|
Metadata: "test.proto",
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package testing
|
package testing
|
||||||
|
|
||||||
//go:generate protoc --go_out=plugins=grpc:./ test.proto
|
//go:generate protoc --go_out=. --go-grpc_out=. test.proto
|
||||||
//go:generate protoc --descriptor_set_out=./test.protoset test.proto
|
//go:generate protoc --descriptor_set_out=./test.protoset test.proto
|
||||||
//go:generate protoc --descriptor_set_out=./example.protoset --include_imports example.proto
|
//go:generate protoc --descriptor_set_out=./example.protoset --include_imports example.proto
|
||||||
|
|
||||||
|
|
@ -19,7 +19,9 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestServer implements the TestService interface defined in example.proto.
|
// TestServer implements the TestService interface defined in example.proto.
|
||||||
type TestServer struct{}
|
type TestServer struct {
|
||||||
|
UnimplementedTestServiceServer
|
||||||
|
}
|
||||||
|
|
||||||
// EmptyCall accepts one empty request and issues one empty response.
|
// EmptyCall accepts one empty request and issues one empty response.
|
||||||
func (TestServer) EmptyCall(ctx context.Context, req *Empty) (*Empty, error) {
|
func (TestServer) EmptyCall(ctx context.Context, req *Empty) (*Empty, error) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue