mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-01-24 09:40:24 +08:00
20 lines
395 B
Go
20 lines
395 B
Go
|
package mock
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
|
||
|
"google.golang.org/grpc/codes"
|
||
|
"google.golang.org/grpc/status"
|
||
|
)
|
||
|
|
||
|
type DepositServer struct {
|
||
|
}
|
||
|
|
||
|
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
|
||
|
}
|