Documentation
¶
Overview ¶
Package ticketgenerator is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterTicketGeneratorHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterTicketGeneratorHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TicketGeneratorClient) error
- func RegisterTicketGeneratorHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterTicketGeneratorHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TicketGeneratorServer) error
- func RegisterTicketGeneratorServer(s grpc.ServiceRegistrar, srv TicketGeneratorServer)
- type IDReply
- type TicketGeneratorClient
- type TicketGeneratorServer
- type TicketRequset
- func (*TicketRequset) Descriptor() ([]byte, []int)deprecated
- func (x *TicketRequset) GetId() int64
- func (x *TicketRequset) GetPrice() float32
- func (x *TicketRequset) GetSeat() int64
- func (x *TicketRequset) GetTime() string
- func (x *TicketRequset) GetTitle() string
- func (*TicketRequset) ProtoMessage()
- func (x *TicketRequset) ProtoReflect() protoreflect.Message
- func (x *TicketRequset) Reset()
- func (x *TicketRequset) String() string
- type UnimplementedTicketGeneratorServer
- type UnsafeTicketGeneratorServer
Constants ¶
This section is empty.
Variables ¶
var File_generator_proto protoreflect.FileDescriptor
var TicketGenerator_ServiceDesc = grpc.ServiceDesc{ ServiceName: "transactions.TicketGenerator", HandlerType: (*TicketGeneratorServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "GetTicket", Handler: _TicketGenerator_GetTicket_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "generator.proto", }
TicketGenerator_ServiceDesc is the grpc.ServiceDesc for TicketGenerator service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterTicketGeneratorHandler ¶
func RegisterTicketGeneratorHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterTicketGeneratorHandler registers the http handlers for service TicketGenerator to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterTicketGeneratorHandlerClient ¶
func RegisterTicketGeneratorHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TicketGeneratorClient) error
RegisterTicketGeneratorHandlerClient registers the http handlers for service TicketGenerator to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "TicketGeneratorClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "TicketGeneratorClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "TicketGeneratorClient" to call the correct interceptors.
func RegisterTicketGeneratorHandlerFromEndpoint ¶
func RegisterTicketGeneratorHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterTicketGeneratorHandlerFromEndpoint is same as RegisterTicketGeneratorHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterTicketGeneratorHandlerServer ¶
func RegisterTicketGeneratorHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TicketGeneratorServer) error
RegisterTicketGeneratorHandlerServer registers the http handlers for service TicketGenerator to "mux". UnaryRPC :call TicketGeneratorServer 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 RegisterTicketGeneratorHandlerFromEndpoint instead.
func RegisterTicketGeneratorServer ¶
func RegisterTicketGeneratorServer(s grpc.ServiceRegistrar, srv TicketGeneratorServer)
Types ¶
type IDReply ¶
type IDReply struct { ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` // contains filtered or unexported fields }
func (*IDReply) Descriptor
deprecated
func (*IDReply) ProtoMessage ¶
func (*IDReply) ProtoMessage()
func (*IDReply) ProtoReflect ¶
func (x *IDReply) ProtoReflect() protoreflect.Message
type TicketGeneratorClient ¶
type TicketGeneratorClient interface {
GetTicket(ctx context.Context, in *TicketRequset, opts ...grpc.CallOption) (*IDReply, error)
}
TicketGeneratorClient is the client API for TicketGenerator 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 NewTicketGeneratorClient ¶
func NewTicketGeneratorClient(cc grpc.ClientConnInterface) TicketGeneratorClient
type TicketGeneratorServer ¶
type TicketGeneratorServer interface { GetTicket(context.Context, *TicketRequset) (*IDReply, error) // contains filtered or unexported methods }
TicketGeneratorServer is the server API for TicketGenerator service. All implementations must embed UnimplementedTicketGeneratorServer for forward compatibility
type TicketRequset ¶
type TicketRequset struct { Time string `protobuf:"bytes,1,opt,name=time,proto3" json:"time,omitempty"` Price float32 `protobuf:"fixed32,2,opt,name=price,proto3" json:"price,omitempty"` Seat int64 `protobuf:"varint,3,opt,name=seat,proto3" json:"seat,omitempty"` Id int64 `protobuf:"varint,4,opt,name=id,proto3" json:"id,omitempty"` Title string `protobuf:"bytes,5,opt,name=title,proto3" json:"title,omitempty"` // contains filtered or unexported fields }
func (*TicketRequset) Descriptor
deprecated
func (*TicketRequset) Descriptor() ([]byte, []int)
Deprecated: Use TicketRequset.ProtoReflect.Descriptor instead.
func (*TicketRequset) GetId ¶
func (x *TicketRequset) GetId() int64
func (*TicketRequset) GetPrice ¶
func (x *TicketRequset) GetPrice() float32
func (*TicketRequset) GetSeat ¶
func (x *TicketRequset) GetSeat() int64
func (*TicketRequset) GetTime ¶
func (x *TicketRequset) GetTime() string
func (*TicketRequset) GetTitle ¶
func (x *TicketRequset) GetTitle() string
func (*TicketRequset) ProtoMessage ¶
func (*TicketRequset) ProtoMessage()
func (*TicketRequset) ProtoReflect ¶
func (x *TicketRequset) ProtoReflect() protoreflect.Message
func (*TicketRequset) Reset ¶
func (x *TicketRequset) Reset()
func (*TicketRequset) String ¶
func (x *TicketRequset) String() string
type UnimplementedTicketGeneratorServer ¶
type UnimplementedTicketGeneratorServer struct { }
UnimplementedTicketGeneratorServer must be embedded to have forward compatible implementations.
func (UnimplementedTicketGeneratorServer) GetTicket ¶
func (UnimplementedTicketGeneratorServer) GetTicket(context.Context, *TicketRequset) (*IDReply, error)
type UnsafeTicketGeneratorServer ¶
type UnsafeTicketGeneratorServer interface {
// contains filtered or unexported methods
}
UnsafeTicketGeneratorServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to TicketGeneratorServer will result in compilation errors.