Documentation ¶
Overview ¶
Package service is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterToDoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterToDoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ToDoServiceClient) error
- func RegisterToDoServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterToDoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ToDoServiceServer) error
- func RegisterToDoServiceServer(s *grpc.Server, srv ToDoServiceServer)
- type CreateRequest
- func (*CreateRequest) Descriptor() ([]byte, []int)deprecated
- func (x *CreateRequest) GetApi() string
- func (x *CreateRequest) GetToDo() *ToDo
- func (*CreateRequest) ProtoMessage()
- func (x *CreateRequest) ProtoReflect() protoreflect.Message
- func (x *CreateRequest) Reset()
- func (x *CreateRequest) String() string
- type CreateResponse
- func (*CreateResponse) Descriptor() ([]byte, []int)deprecated
- func (x *CreateResponse) GetApi() string
- func (x *CreateResponse) GetId() int64
- func (*CreateResponse) ProtoMessage()
- func (x *CreateResponse) ProtoReflect() protoreflect.Message
- func (x *CreateResponse) Reset()
- func (x *CreateResponse) String() string
- type DeleteRequest
- func (*DeleteRequest) Descriptor() ([]byte, []int)deprecated
- func (x *DeleteRequest) GetApi() string
- func (x *DeleteRequest) GetId() int64
- func (*DeleteRequest) ProtoMessage()
- func (x *DeleteRequest) ProtoReflect() protoreflect.Message
- func (x *DeleteRequest) Reset()
- func (x *DeleteRequest) String() string
- type DeleteResponse
- func (*DeleteResponse) Descriptor() ([]byte, []int)deprecated
- func (x *DeleteResponse) GetApi() string
- func (x *DeleteResponse) GetDeleted() int64
- func (*DeleteResponse) ProtoMessage()
- func (x *DeleteResponse) ProtoReflect() protoreflect.Message
- func (x *DeleteResponse) Reset()
- func (x *DeleteResponse) String() string
- type ReadAllRequest
- type ReadAllResponse
- func (*ReadAllResponse) Descriptor() ([]byte, []int)deprecated
- func (x *ReadAllResponse) GetApi() string
- func (x *ReadAllResponse) GetToDos() []*ToDo
- func (*ReadAllResponse) ProtoMessage()
- func (x *ReadAllResponse) ProtoReflect() protoreflect.Message
- func (x *ReadAllResponse) Reset()
- func (x *ReadAllResponse) String() string
- type ReadRequest
- type ReadResponse
- func (*ReadResponse) Descriptor() ([]byte, []int)deprecated
- func (x *ReadResponse) GetApi() string
- func (x *ReadResponse) GetToDo() *ToDo
- func (*ReadResponse) ProtoMessage()
- func (x *ReadResponse) ProtoReflect() protoreflect.Message
- func (x *ReadResponse) Reset()
- func (x *ReadResponse) String() string
- type ToDo
- func (*ToDo) Descriptor() ([]byte, []int)deprecated
- func (x *ToDo) GetDescription() string
- func (x *ToDo) GetId() int64
- func (x *ToDo) GetReminder() *timestamppb.Timestamp
- func (x *ToDo) GetTitle() string
- func (*ToDo) ProtoMessage()
- func (x *ToDo) ProtoReflect() protoreflect.Message
- func (x *ToDo) Reset()
- func (x *ToDo) String() string
- type ToDoServiceClient
- type ToDoServiceServer
- type UnimplementedToDoServiceServer
- func (*UnimplementedToDoServiceServer) Create(context.Context, *CreateRequest) (*CreateResponse, error)
- func (*UnimplementedToDoServiceServer) Delete(context.Context, *DeleteRequest) (*DeleteResponse, error)
- func (*UnimplementedToDoServiceServer) Read(context.Context, *ReadRequest) (*ReadResponse, error)
- func (*UnimplementedToDoServiceServer) ReadAll(context.Context, *ReadAllRequest) (*ReadAllResponse, error)
- func (*UnimplementedToDoServiceServer) Update(context.Context, *UpdateRequest) (*UpdateResponse, error)
- type UpdateRequest
- func (*UpdateRequest) Descriptor() ([]byte, []int)deprecated
- func (x *UpdateRequest) GetApi() string
- func (x *UpdateRequest) GetToDo() *ToDo
- func (*UpdateRequest) ProtoMessage()
- func (x *UpdateRequest) ProtoReflect() protoreflect.Message
- func (x *UpdateRequest) Reset()
- func (x *UpdateRequest) String() string
- type UpdateResponse
- func (*UpdateResponse) Descriptor() ([]byte, []int)deprecated
- func (x *UpdateResponse) GetApi() string
- func (x *UpdateResponse) GetUpdated() int64
- func (*UpdateResponse) ProtoMessage()
- func (x *UpdateResponse) ProtoReflect() protoreflect.Message
- func (x *UpdateResponse) Reset()
- func (x *UpdateResponse) String() string
Constants ¶
This section is empty.
Variables ¶
var File_todo_service_proto protoreflect.FileDescriptor
Functions ¶
func RegisterToDoServiceHandler ¶
func RegisterToDoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterToDoServiceHandler registers the http handlers for service ToDoService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterToDoServiceHandlerClient ¶
func RegisterToDoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ToDoServiceClient) error
RegisterToDoServiceHandlerClient registers the http handlers for service ToDoService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ToDoServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ToDoServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ToDoServiceClient" to call the correct interceptors.
func RegisterToDoServiceHandlerFromEndpoint ¶
func RegisterToDoServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterToDoServiceHandlerFromEndpoint is same as RegisterToDoServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterToDoServiceHandlerServer ¶
func RegisterToDoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ToDoServiceServer) error
RegisterToDoServiceHandlerServer registers the http handlers for service ToDoService to "mux". UnaryRPC :call ToDoServiceServer 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 RegisterToDoServiceHandlerFromEndpoint instead.
func RegisterToDoServiceServer ¶
func RegisterToDoServiceServer(s *grpc.Server, srv ToDoServiceServer)
Types ¶
type CreateRequest ¶
type CreateRequest struct { // API versioning: it is my best practice to specify version explicitly Api string `protobuf:"bytes,1,opt,name=api,proto3" json:"api,omitempty"` // Task entity to add ToDo *ToDo `protobuf:"bytes,2,opt,name=toDo,proto3" json:"toDo,omitempty"` // contains filtered or unexported fields }
Request data to create new todo task
func (*CreateRequest) Descriptor
deprecated
func (*CreateRequest) Descriptor() ([]byte, []int)
Deprecated: Use CreateRequest.ProtoReflect.Descriptor instead.
func (*CreateRequest) GetApi ¶
func (x *CreateRequest) GetApi() string
func (*CreateRequest) GetToDo ¶
func (x *CreateRequest) GetToDo() *ToDo
func (*CreateRequest) ProtoMessage ¶
func (*CreateRequest) ProtoMessage()
func (*CreateRequest) ProtoReflect ¶
func (x *CreateRequest) ProtoReflect() protoreflect.Message
func (*CreateRequest) Reset ¶
func (x *CreateRequest) Reset()
func (*CreateRequest) String ¶
func (x *CreateRequest) String() string
type CreateResponse ¶
type CreateResponse struct { // API versioning: it is my best practice to specify version explicitly Api string `protobuf:"bytes,1,opt,name=api,proto3" json:"api,omitempty"` // ID of created task Id int64 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"` // contains filtered or unexported fields }
Contains data of created todo task
func (*CreateResponse) Descriptor
deprecated
func (*CreateResponse) Descriptor() ([]byte, []int)
Deprecated: Use CreateResponse.ProtoReflect.Descriptor instead.
func (*CreateResponse) GetApi ¶
func (x *CreateResponse) GetApi() string
func (*CreateResponse) GetId ¶
func (x *CreateResponse) GetId() int64
func (*CreateResponse) ProtoMessage ¶
func (*CreateResponse) ProtoMessage()
func (*CreateResponse) ProtoReflect ¶
func (x *CreateResponse) ProtoReflect() protoreflect.Message
func (*CreateResponse) Reset ¶
func (x *CreateResponse) Reset()
func (*CreateResponse) String ¶
func (x *CreateResponse) String() string
type DeleteRequest ¶
type DeleteRequest struct { // API versioning: it is my best practice to specify version explicitly Api string `protobuf:"bytes,1,opt,name=api,proto3" json:"api,omitempty"` // Unique integer identifier of the todo task to delete Id int64 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"` // contains filtered or unexported fields }
Request data to delete todo task
func (*DeleteRequest) Descriptor
deprecated
func (*DeleteRequest) Descriptor() ([]byte, []int)
Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead.
func (*DeleteRequest) GetApi ¶
func (x *DeleteRequest) GetApi() string
func (*DeleteRequest) GetId ¶
func (x *DeleteRequest) GetId() int64
func (*DeleteRequest) ProtoMessage ¶
func (*DeleteRequest) ProtoMessage()
func (*DeleteRequest) ProtoReflect ¶
func (x *DeleteRequest) ProtoReflect() protoreflect.Message
func (*DeleteRequest) Reset ¶
func (x *DeleteRequest) Reset()
func (*DeleteRequest) String ¶
func (x *DeleteRequest) String() string
type DeleteResponse ¶
type DeleteResponse struct { // API versioning: it is my best practice to specify version explicitly Api string `protobuf:"bytes,1,opt,name=api,proto3" json:"api,omitempty"` // Contains number of entities have beed deleted // Equals 1 in case of succesfull delete Deleted int64 `protobuf:"varint,2,opt,name=deleted,proto3" json:"deleted,omitempty"` // contains filtered or unexported fields }
Contains status of delete operation
func (*DeleteResponse) Descriptor
deprecated
func (*DeleteResponse) Descriptor() ([]byte, []int)
Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead.
func (*DeleteResponse) GetApi ¶
func (x *DeleteResponse) GetApi() string
func (*DeleteResponse) GetDeleted ¶
func (x *DeleteResponse) GetDeleted() int64
func (*DeleteResponse) ProtoMessage ¶
func (*DeleteResponse) ProtoMessage()
func (*DeleteResponse) ProtoReflect ¶
func (x *DeleteResponse) ProtoReflect() protoreflect.Message
func (*DeleteResponse) Reset ¶
func (x *DeleteResponse) Reset()
func (*DeleteResponse) String ¶
func (x *DeleteResponse) String() string
type ReadAllRequest ¶
type ReadAllRequest struct { // API versioning: it is my best practice to specify version explicitly Api string `protobuf:"bytes,1,opt,name=api,proto3" json:"api,omitempty"` // contains filtered or unexported fields }
Request data to read all todo task
func (*ReadAllRequest) Descriptor
deprecated
func (*ReadAllRequest) Descriptor() ([]byte, []int)
Deprecated: Use ReadAllRequest.ProtoReflect.Descriptor instead.
func (*ReadAllRequest) GetApi ¶
func (x *ReadAllRequest) GetApi() string
func (*ReadAllRequest) ProtoMessage ¶
func (*ReadAllRequest) ProtoMessage()
func (*ReadAllRequest) ProtoReflect ¶
func (x *ReadAllRequest) ProtoReflect() protoreflect.Message
func (*ReadAllRequest) Reset ¶
func (x *ReadAllRequest) Reset()
func (*ReadAllRequest) String ¶
func (x *ReadAllRequest) String() string
type ReadAllResponse ¶
type ReadAllResponse struct { // API versioning: it is my best practice to specify version explicitly Api string `protobuf:"bytes,1,opt,name=api,proto3" json:"api,omitempty"` // List of all todo tasks ToDos []*ToDo `protobuf:"bytes,2,rep,name=toDos,proto3" json:"toDos,omitempty"` // contains filtered or unexported fields }
Contains list of all todo tasks
func (*ReadAllResponse) Descriptor
deprecated
func (*ReadAllResponse) Descriptor() ([]byte, []int)
Deprecated: Use ReadAllResponse.ProtoReflect.Descriptor instead.
func (*ReadAllResponse) GetApi ¶
func (x *ReadAllResponse) GetApi() string
func (*ReadAllResponse) GetToDos ¶
func (x *ReadAllResponse) GetToDos() []*ToDo
func (*ReadAllResponse) ProtoMessage ¶
func (*ReadAllResponse) ProtoMessage()
func (*ReadAllResponse) ProtoReflect ¶
func (x *ReadAllResponse) ProtoReflect() protoreflect.Message
func (*ReadAllResponse) Reset ¶
func (x *ReadAllResponse) Reset()
func (*ReadAllResponse) String ¶
func (x *ReadAllResponse) String() string
type ReadRequest ¶
type ReadRequest struct { // API versioning: it is my best practice to specify version explicitly Api string `protobuf:"bytes,1,opt,name=api,proto3" json:"api,omitempty"` // Unique integer identifier of the todo task Id int64 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"` // contains filtered or unexported fields }
Request data to read todo task
func (*ReadRequest) Descriptor
deprecated
func (*ReadRequest) Descriptor() ([]byte, []int)
Deprecated: Use ReadRequest.ProtoReflect.Descriptor instead.
func (*ReadRequest) GetApi ¶
func (x *ReadRequest) GetApi() string
func (*ReadRequest) GetId ¶
func (x *ReadRequest) GetId() int64
func (*ReadRequest) ProtoMessage ¶
func (*ReadRequest) ProtoMessage()
func (*ReadRequest) ProtoReflect ¶
func (x *ReadRequest) ProtoReflect() protoreflect.Message
func (*ReadRequest) Reset ¶
func (x *ReadRequest) Reset()
func (*ReadRequest) String ¶
func (x *ReadRequest) String() string
type ReadResponse ¶
type ReadResponse struct { // API versioning: it is my best practice to specify version explicitly Api string `protobuf:"bytes,1,opt,name=api,proto3" json:"api,omitempty"` // Task entity read by ID ToDo *ToDo `protobuf:"bytes,2,opt,name=toDo,proto3" json:"toDo,omitempty"` // contains filtered or unexported fields }
Contains todo task data specified in by ID request
func (*ReadResponse) Descriptor
deprecated
func (*ReadResponse) Descriptor() ([]byte, []int)
Deprecated: Use ReadResponse.ProtoReflect.Descriptor instead.
func (*ReadResponse) GetApi ¶
func (x *ReadResponse) GetApi() string
func (*ReadResponse) GetToDo ¶
func (x *ReadResponse) GetToDo() *ToDo
func (*ReadResponse) ProtoMessage ¶
func (*ReadResponse) ProtoMessage()
func (*ReadResponse) ProtoReflect ¶
func (x *ReadResponse) ProtoReflect() protoreflect.Message
func (*ReadResponse) Reset ¶
func (x *ReadResponse) Reset()
func (*ReadResponse) String ¶
func (x *ReadResponse) String() string
type ToDo ¶
type ToDo struct { // Unique integer identifier of the todo task Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // Title of the task Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` // Detail description of the todo task Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` // Date and time to remind the todo task Reminder *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=reminder,proto3" json:"reminder,omitempty"` // contains filtered or unexported fields }
Tasks we have to do
func (*ToDo) Descriptor
deprecated
func (*ToDo) GetDescription ¶
func (*ToDo) GetReminder ¶
func (x *ToDo) GetReminder() *timestamppb.Timestamp
func (*ToDo) ProtoMessage ¶
func (*ToDo) ProtoMessage()
func (*ToDo) ProtoReflect ¶
func (x *ToDo) ProtoReflect() protoreflect.Message
type ToDoServiceClient ¶
type ToDoServiceClient interface { // Read all todo tasks ReadAll(ctx context.Context, in *ReadAllRequest, opts ...grpc.CallOption) (*ReadAllResponse, error) // Create new todo task Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) // Read todo task Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (*ReadResponse, error) // Update todo task Update(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*UpdateResponse, error) // Delete todo task Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) }
ToDoServiceClient is the client API for ToDoService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewToDoServiceClient ¶
func NewToDoServiceClient(cc grpc.ClientConnInterface) ToDoServiceClient
type ToDoServiceServer ¶
type ToDoServiceServer interface { // Read all todo tasks ReadAll(context.Context, *ReadAllRequest) (*ReadAllResponse, error) // Create new todo task Create(context.Context, *CreateRequest) (*CreateResponse, error) // Read todo task Read(context.Context, *ReadRequest) (*ReadResponse, error) // Update todo task Update(context.Context, *UpdateRequest) (*UpdateResponse, error) // Delete todo task Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) }
ToDoServiceServer is the server API for ToDoService service.
type UnimplementedToDoServiceServer ¶
type UnimplementedToDoServiceServer struct { }
UnimplementedToDoServiceServer can be embedded to have forward compatible implementations.
func (*UnimplementedToDoServiceServer) Create ¶
func (*UnimplementedToDoServiceServer) Create(context.Context, *CreateRequest) (*CreateResponse, error)
func (*UnimplementedToDoServiceServer) Delete ¶
func (*UnimplementedToDoServiceServer) Delete(context.Context, *DeleteRequest) (*DeleteResponse, error)
func (*UnimplementedToDoServiceServer) Read ¶
func (*UnimplementedToDoServiceServer) Read(context.Context, *ReadRequest) (*ReadResponse, error)
func (*UnimplementedToDoServiceServer) ReadAll ¶
func (*UnimplementedToDoServiceServer) ReadAll(context.Context, *ReadAllRequest) (*ReadAllResponse, error)
func (*UnimplementedToDoServiceServer) Update ¶
func (*UnimplementedToDoServiceServer) Update(context.Context, *UpdateRequest) (*UpdateResponse, error)
type UpdateRequest ¶
type UpdateRequest struct { // API versioning: it is my best practice to specify version explicitly Api string `protobuf:"bytes,1,opt,name=api,proto3" json:"api,omitempty"` // Task entity to update ToDo *ToDo `protobuf:"bytes,2,opt,name=toDo,proto3" json:"toDo,omitempty"` // contains filtered or unexported fields }
Request data to update todo task
func (*UpdateRequest) Descriptor
deprecated
func (*UpdateRequest) Descriptor() ([]byte, []int)
Deprecated: Use UpdateRequest.ProtoReflect.Descriptor instead.
func (*UpdateRequest) GetApi ¶
func (x *UpdateRequest) GetApi() string
func (*UpdateRequest) GetToDo ¶
func (x *UpdateRequest) GetToDo() *ToDo
func (*UpdateRequest) ProtoMessage ¶
func (*UpdateRequest) ProtoMessage()
func (*UpdateRequest) ProtoReflect ¶
func (x *UpdateRequest) ProtoReflect() protoreflect.Message
func (*UpdateRequest) Reset ¶
func (x *UpdateRequest) Reset()
func (*UpdateRequest) String ¶
func (x *UpdateRequest) String() string
type UpdateResponse ¶
type UpdateResponse struct { // API versioning: it is my best practice to specify version explicitly Api string `protobuf:"bytes,1,opt,name=api,proto3" json:"api,omitempty"` // Contains number of entities have beed updated // Equals 1 in case of succesfull update Updated int64 `protobuf:"varint,2,opt,name=updated,proto3" json:"updated,omitempty"` // contains filtered or unexported fields }
Contains status of update operation
func (*UpdateResponse) Descriptor
deprecated
func (*UpdateResponse) Descriptor() ([]byte, []int)
Deprecated: Use UpdateResponse.ProtoReflect.Descriptor instead.
func (*UpdateResponse) GetApi ¶
func (x *UpdateResponse) GetApi() string
func (*UpdateResponse) GetUpdated ¶
func (x *UpdateResponse) GetUpdated() int64
func (*UpdateResponse) ProtoMessage ¶
func (*UpdateResponse) ProtoMessage()
func (*UpdateResponse) ProtoReflect ¶
func (x *UpdateResponse) ProtoReflect() protoreflect.Message
func (*UpdateResponse) Reset ¶
func (x *UpdateResponse) Reset()
func (*UpdateResponse) String ¶
func (x *UpdateResponse) String() string