You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-zero/zrpc/internal/mock/depositserver.go

22 lines
474 B
Go

package mock
import (
"context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
// DepositServer is used for mocking.
type DepositServer struct {
}
// Deposit handles the deposit requests.
func (*DepositServer) Deposit(ctx context.Context, req *DepositRequest) (*DepositResponse, error) {
if req.GetAmount() < 0 {
return nil, status.Errorf(codes.InvalidArgument, "cannot deposit %v", req.GetAmount())
}
return &DepositResponse{Ok: true}, nil
}