Documentation ¶
Overview ¶
Package v1 is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func RegisterPaymentHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterPaymentHandlerClient(ctx context.Context, mux *runtime.ServeMux, client PaymentClient) error
- func RegisterPaymentHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterPaymentHandlerServer(ctx context.Context, mux *runtime.ServeMux, server PaymentServer) error
- func RegisterPaymentServer(s grpc.ServiceRegistrar, srv PaymentServer)
- type CreatePaymentRequest
- func (*CreatePaymentRequest) Descriptor() ([]byte, []int)deprecated
- func (x *CreatePaymentRequest) GetOrderId() int64
- func (x *CreatePaymentRequest) GetTotalPrice() float32
- func (x *CreatePaymentRequest) GetUserId() int64
- func (*CreatePaymentRequest) ProtoMessage()
- func (x *CreatePaymentRequest) ProtoReflect() protoreflect.Message
- func (x *CreatePaymentRequest) Reset()
- func (x *CreatePaymentRequest) String() string
- type CreatePaymentResponse
- func (*CreatePaymentResponse) Descriptor() ([]byte, []int)deprecated
- func (x *CreatePaymentResponse) GetPaymentId() int64
- func (*CreatePaymentResponse) ProtoMessage()
- func (x *CreatePaymentResponse) ProtoReflect() protoreflect.Message
- func (x *CreatePaymentResponse) Reset()
- func (x *CreatePaymentResponse) String() string
- type PaymentClient
- type PaymentServer
- type UnimplementedPaymentServer
- type UnsafePaymentServer
Constants ¶
const (
Payment_Create_FullMethodName = "/payment.v1.Payment/Create"
)
Variables ¶
var File_payment_v1_payment_proto protoreflect.FileDescriptor
var Payment_ServiceDesc = grpc.ServiceDesc{ ServiceName: "payment.v1.Payment", HandlerType: (*PaymentServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Create", Handler: _Payment_Create_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "payment/v1/payment.proto", }
Payment_ServiceDesc is the grpc.ServiceDesc for Payment service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterPaymentHandler ¶
func RegisterPaymentHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterPaymentHandler registers the http handlers for service Payment to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterPaymentHandlerClient ¶
func RegisterPaymentHandlerClient(ctx context.Context, mux *runtime.ServeMux, client PaymentClient) error
RegisterPaymentHandlerClient registers the http handlers for service Payment to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "PaymentClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "PaymentClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "PaymentClient" to call the correct interceptors. This client ignores the HTTP middlewares.
func RegisterPaymentHandlerFromEndpoint ¶
func RegisterPaymentHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterPaymentHandlerFromEndpoint is same as RegisterPaymentHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterPaymentHandlerServer ¶
func RegisterPaymentHandlerServer(ctx context.Context, mux *runtime.ServeMux, server PaymentServer) error
RegisterPaymentHandlerServer registers the http handlers for service Payment to "mux". UnaryRPC :call PaymentServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterPaymentHandlerFromEndpoint instead. GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
func RegisterPaymentServer ¶
func RegisterPaymentServer(s grpc.ServiceRegistrar, srv PaymentServer)
Types ¶
type CreatePaymentRequest ¶
type CreatePaymentRequest struct { UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` OrderId int64 `protobuf:"varint,2,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"` TotalPrice float32 `protobuf:"fixed32,3,opt,name=total_price,json=totalPrice,proto3" json:"total_price,omitempty"` // contains filtered or unexported fields }
func (*CreatePaymentRequest) Descriptor
deprecated
func (*CreatePaymentRequest) Descriptor() ([]byte, []int)
Deprecated: Use CreatePaymentRequest.ProtoReflect.Descriptor instead.
func (*CreatePaymentRequest) GetOrderId ¶
func (x *CreatePaymentRequest) GetOrderId() int64
func (*CreatePaymentRequest) GetTotalPrice ¶
func (x *CreatePaymentRequest) GetTotalPrice() float32
func (*CreatePaymentRequest) GetUserId ¶
func (x *CreatePaymentRequest) GetUserId() int64
func (*CreatePaymentRequest) ProtoMessage ¶
func (*CreatePaymentRequest) ProtoMessage()
func (*CreatePaymentRequest) ProtoReflect ¶
func (x *CreatePaymentRequest) ProtoReflect() protoreflect.Message
func (*CreatePaymentRequest) Reset ¶
func (x *CreatePaymentRequest) Reset()
func (*CreatePaymentRequest) String ¶
func (x *CreatePaymentRequest) String() string
type CreatePaymentResponse ¶
type CreatePaymentResponse struct { PaymentId int64 `protobuf:"varint,1,opt,name=payment_id,json=paymentId,proto3" json:"payment_id,omitempty"` // contains filtered or unexported fields }
func (*CreatePaymentResponse) Descriptor
deprecated
func (*CreatePaymentResponse) Descriptor() ([]byte, []int)
Deprecated: Use CreatePaymentResponse.ProtoReflect.Descriptor instead.
func (*CreatePaymentResponse) GetPaymentId ¶
func (x *CreatePaymentResponse) GetPaymentId() int64
func (*CreatePaymentResponse) ProtoMessage ¶
func (*CreatePaymentResponse) ProtoMessage()
func (*CreatePaymentResponse) ProtoReflect ¶
func (x *CreatePaymentResponse) ProtoReflect() protoreflect.Message
func (*CreatePaymentResponse) Reset ¶
func (x *CreatePaymentResponse) Reset()
func (*CreatePaymentResponse) String ¶
func (x *CreatePaymentResponse) String() string
type PaymentClient ¶
type PaymentClient interface {
Create(ctx context.Context, in *CreatePaymentRequest, opts ...grpc.CallOption) (*CreatePaymentResponse, error)
}
PaymentClient is the client API for Payment 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.
func NewPaymentClient ¶
func NewPaymentClient(cc grpc.ClientConnInterface) PaymentClient
type PaymentServer ¶
type PaymentServer interface { Create(context.Context, *CreatePaymentRequest) (*CreatePaymentResponse, error) // contains filtered or unexported methods }
PaymentServer is the server API for Payment service. All implementations must embed UnimplementedPaymentServer for forward compatibility.
type UnimplementedPaymentServer ¶
type UnimplementedPaymentServer struct{}
UnimplementedPaymentServer must be embedded to have forward compatible implementations.
NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.
func (UnimplementedPaymentServer) Create ¶
func (UnimplementedPaymentServer) Create(context.Context, *CreatePaymentRequest) (*CreatePaymentResponse, error)
type UnsafePaymentServer ¶
type UnsafePaymentServer interface {
// contains filtered or unexported methods
}
UnsafePaymentServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to PaymentServer will result in compilation errors.