mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-19 22:15:24 +00:00
Comments service (#21)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// Code generated by protoc-gen-micro. DO NOT EDIT.
|
||||
// source: github.com/micro/services/blog/comments/proto/comments.proto
|
||||
// source: proto/comments.proto
|
||||
|
||||
package comments
|
||||
|
||||
@@ -42,7 +42,8 @@ func NewCommentsEndpoints() []*api.Endpoint {
|
||||
// Client API for Comments service
|
||||
|
||||
type CommentsService interface {
|
||||
Save(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error)
|
||||
New(ctx context.Context, in *NewRequest, opts ...client.CallOption) (*NewResponse, error)
|
||||
List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error)
|
||||
}
|
||||
|
||||
type commentsService struct {
|
||||
@@ -57,9 +58,19 @@ func NewCommentsService(name string, c client.Client) CommentsService {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *commentsService) Save(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error) {
|
||||
req := c.c.NewRequest(c.name, "Comments.Save", in)
|
||||
out := new(Response)
|
||||
func (c *commentsService) New(ctx context.Context, in *NewRequest, opts ...client.CallOption) (*NewResponse, error) {
|
||||
req := c.c.NewRequest(c.name, "Comments.New", in)
|
||||
out := new(NewResponse)
|
||||
err := c.c.Call(ctx, req, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *commentsService) List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error) {
|
||||
req := c.c.NewRequest(c.name, "Comments.List", in)
|
||||
out := new(ListResponse)
|
||||
err := c.c.Call(ctx, req, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -70,12 +81,14 @@ func (c *commentsService) Save(ctx context.Context, in *Request, opts ...client.
|
||||
// Server API for Comments service
|
||||
|
||||
type CommentsHandler interface {
|
||||
Save(context.Context, *Request, *Response) error
|
||||
New(context.Context, *NewRequest, *NewResponse) error
|
||||
List(context.Context, *ListRequest, *ListResponse) error
|
||||
}
|
||||
|
||||
func RegisterCommentsHandler(s server.Server, hdlr CommentsHandler, opts ...server.HandlerOption) error {
|
||||
type comments interface {
|
||||
Save(ctx context.Context, in *Request, out *Response) error
|
||||
New(ctx context.Context, in *NewRequest, out *NewResponse) error
|
||||
List(ctx context.Context, in *ListRequest, out *ListResponse) error
|
||||
}
|
||||
type Comments struct {
|
||||
comments
|
||||
@@ -88,6 +101,10 @@ type commentsHandler struct {
|
||||
CommentsHandler
|
||||
}
|
||||
|
||||
func (h *commentsHandler) Save(ctx context.Context, in *Request, out *Response) error {
|
||||
return h.CommentsHandler.Save(ctx, in, out)
|
||||
func (h *commentsHandler) New(ctx context.Context, in *NewRequest, out *NewResponse) error {
|
||||
return h.CommentsHandler.New(ctx, in, out)
|
||||
}
|
||||
|
||||
func (h *commentsHandler) List(ctx context.Context, in *ListRequest, out *ListResponse) error {
|
||||
return h.CommentsHandler.List(ctx, in, out)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user