depositserver.go 395 B

12345678910111213141516171819
  1. package mock
  2. import (
  3. "context"
  4. "google.golang.org/grpc/codes"
  5. "google.golang.org/grpc/status"
  6. )
  7. type DepositServer struct {
  8. }
  9. func (*DepositServer) Deposit(ctx context.Context, req *DepositRequest) (*DepositResponse, error) {
  10. if req.GetAmount() < 0 {
  11. return nil, status.Errorf(codes.InvalidArgument, "cannot deposit %v", req.GetAmount())
  12. }
  13. return &DepositResponse{Ok: true}, nil
  14. }