This commit is contained in:
Asim Aslam
2020-10-02 11:13:01 +01:00
commit 61fe9c169b
62 changed files with 4428 additions and 0 deletions

View File

@@ -0,0 +1,218 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.22.0
// protoc v3.11.4
// source: github.com/micro/services/blog/comments/proto/comments.proto
package comments
import (
proto "github.com/golang/protobuf/proto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// This is a compile-time assertion that a sufficiently up-to-date version
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
type Request struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// post to comment on
PostId string `protobuf:"bytes,1,opt,name=post_id,json=postId,proto3" json:"post_id,omitempty"`
// message to leave
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
}
func (x *Request) Reset() {
*x = Request{}
if protoimpl.UnsafeEnabled {
mi := &file_github_com_micro_services_blog_comments_proto_comments_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Request) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Request) ProtoMessage() {}
func (x *Request) ProtoReflect() protoreflect.Message {
mi := &file_github_com_micro_services_blog_comments_proto_comments_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Request.ProtoReflect.Descriptor instead.
func (*Request) Descriptor() ([]byte, []int) {
return file_github_com_micro_services_blog_comments_proto_comments_proto_rawDescGZIP(), []int{0}
}
func (x *Request) GetPostId() string {
if x != nil {
return x.PostId
}
return ""
}
func (x *Request) GetMessage() string {
if x != nil {
return x.Message
}
return ""
}
type Response struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *Response) Reset() {
*x = Response{}
if protoimpl.UnsafeEnabled {
mi := &file_github_com_micro_services_blog_comments_proto_comments_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Response) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Response) ProtoMessage() {}
func (x *Response) ProtoReflect() protoreflect.Message {
mi := &file_github_com_micro_services_blog_comments_proto_comments_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Response.ProtoReflect.Descriptor instead.
func (*Response) Descriptor() ([]byte, []int) {
return file_github_com_micro_services_blog_comments_proto_comments_proto_rawDescGZIP(), []int{1}
}
var File_github_com_micro_services_blog_comments_proto_comments_proto protoreflect.FileDescriptor
var file_github_com_micro_services_blog_comments_proto_comments_proto_rawDesc = []byte{
0x0a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x69, 0x63,
0x72, 0x6f, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x62, 0x6c, 0x6f, 0x67,
0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f,
0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08,
0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x3c, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x6f, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x6f, 0x73, 0x74, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07,
0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d,
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x0a, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x32, 0x3b, 0x0a, 0x08, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x2f,
0x0a, 0x04, 0x53, 0x61, 0x76, 0x65, 0x12, 0x11, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74,
0x73, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x63, 0x6f, 0x6d, 0x6d,
0x65, 0x6e, 0x74, 0x73, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_github_com_micro_services_blog_comments_proto_comments_proto_rawDescOnce sync.Once
file_github_com_micro_services_blog_comments_proto_comments_proto_rawDescData = file_github_com_micro_services_blog_comments_proto_comments_proto_rawDesc
)
func file_github_com_micro_services_blog_comments_proto_comments_proto_rawDescGZIP() []byte {
file_github_com_micro_services_blog_comments_proto_comments_proto_rawDescOnce.Do(func() {
file_github_com_micro_services_blog_comments_proto_comments_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_micro_services_blog_comments_proto_comments_proto_rawDescData)
})
return file_github_com_micro_services_blog_comments_proto_comments_proto_rawDescData
}
var file_github_com_micro_services_blog_comments_proto_comments_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_github_com_micro_services_blog_comments_proto_comments_proto_goTypes = []interface{}{
(*Request)(nil), // 0: comments.Request
(*Response)(nil), // 1: comments.Response
}
var file_github_com_micro_services_blog_comments_proto_comments_proto_depIdxs = []int32{
0, // 0: comments.Comments.Save:input_type -> comments.Request
1, // 1: comments.Comments.Save:output_type -> comments.Response
1, // [1:2] is the sub-list for method output_type
0, // [0:1] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_github_com_micro_services_blog_comments_proto_comments_proto_init() }
func file_github_com_micro_services_blog_comments_proto_comments_proto_init() {
if File_github_com_micro_services_blog_comments_proto_comments_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_github_com_micro_services_blog_comments_proto_comments_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Request); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_github_com_micro_services_blog_comments_proto_comments_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Response); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_github_com_micro_services_blog_comments_proto_comments_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_github_com_micro_services_blog_comments_proto_comments_proto_goTypes,
DependencyIndexes: file_github_com_micro_services_blog_comments_proto_comments_proto_depIdxs,
MessageInfos: file_github_com_micro_services_blog_comments_proto_comments_proto_msgTypes,
}.Build()
File_github_com_micro_services_blog_comments_proto_comments_proto = out.File
file_github_com_micro_services_blog_comments_proto_comments_proto_rawDesc = nil
file_github_com_micro_services_blog_comments_proto_comments_proto_goTypes = nil
file_github_com_micro_services_blog_comments_proto_comments_proto_depIdxs = nil
}

View File

@@ -0,0 +1,93 @@
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: github.com/micro/services/blog/comments/proto/comments.proto
package comments
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
import (
context "context"
api "github.com/micro/go-micro/v3/api"
client "github.com/micro/go-micro/v3/client"
server "github.com/micro/go-micro/v3/server"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// Reference imports to suppress errors if they are not otherwise used.
var _ api.Endpoint
var _ context.Context
var _ client.Option
var _ server.Option
// Api Endpoints for Comments service
func NewCommentsEndpoints() []*api.Endpoint {
return []*api.Endpoint{}
}
// Client API for Comments service
type CommentsService interface {
Save(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error)
}
type commentsService struct {
c client.Client
name string
}
func NewCommentsService(name string, c client.Client) CommentsService {
return &commentsService{
c: c,
name: name,
}
}
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)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Comments service
type CommentsHandler interface {
Save(context.Context, *Request, *Response) error
}
func RegisterCommentsHandler(s server.Server, hdlr CommentsHandler, opts ...server.HandlerOption) error {
type comments interface {
Save(ctx context.Context, in *Request, out *Response) error
}
type Comments struct {
comments
}
h := &commentsHandler{hdlr}
return s.Handle(s.NewHandler(&Comments{h}, opts...))
}
type commentsHandler struct {
CommentsHandler
}
func (h *commentsHandler) Save(ctx context.Context, in *Request, out *Response) error {
return h.CommentsHandler.Save(ctx, in, out)
}

View File

@@ -0,0 +1,17 @@
syntax = "proto3";
package comments;
service Comments {
rpc Save(Request) returns (Response) {}
}
message Request {
// post to comment on
string post_id = 1;
// message to leave
string message = 2;
}
message Response {}