mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-22 07:15:25 +00:00
Add blog service & follow model changes in tags/posts (#22)
This commit is contained in:
116
blog/proto/blog.pb.go
Normal file
116
blog/proto/blog.pb.go
Normal file
@@ -0,0 +1,116 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: proto/blog.proto
|
||||
|
||||
package blog
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
proto1 "github.com/micro/services/blog/posts/proto"
|
||||
math "math"
|
||||
)
|
||||
|
||||
// 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
|
||||
|
||||
type LatestRequest struct {
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *LatestRequest) Reset() { *m = LatestRequest{} }
|
||||
func (m *LatestRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*LatestRequest) ProtoMessage() {}
|
||||
func (*LatestRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_fc5203cdc85000bc, []int{0}
|
||||
}
|
||||
|
||||
func (m *LatestRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_LatestRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *LatestRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_LatestRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *LatestRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_LatestRequest.Merge(m, src)
|
||||
}
|
||||
func (m *LatestRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_LatestRequest.Size(m)
|
||||
}
|
||||
func (m *LatestRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_LatestRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_LatestRequest proto.InternalMessageInfo
|
||||
|
||||
type LatestResponse struct {
|
||||
Latest *proto1.Post `protobuf:"bytes,1,opt,name=latest,proto3" json:"latest,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *LatestResponse) Reset() { *m = LatestResponse{} }
|
||||
func (m *LatestResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*LatestResponse) ProtoMessage() {}
|
||||
func (*LatestResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_fc5203cdc85000bc, []int{1}
|
||||
}
|
||||
|
||||
func (m *LatestResponse) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_LatestResponse.Unmarshal(m, b)
|
||||
}
|
||||
func (m *LatestResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_LatestResponse.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *LatestResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_LatestResponse.Merge(m, src)
|
||||
}
|
||||
func (m *LatestResponse) XXX_Size() int {
|
||||
return xxx_messageInfo_LatestResponse.Size(m)
|
||||
}
|
||||
func (m *LatestResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_LatestResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_LatestResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *LatestResponse) GetLatest() *proto1.Post {
|
||||
if m != nil {
|
||||
return m.Latest
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*LatestRequest)(nil), "blog.LatestRequest")
|
||||
proto.RegisterType((*LatestResponse)(nil), "blog.LatestResponse")
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterFile("proto/blog.proto", fileDescriptor_fc5203cdc85000bc)
|
||||
}
|
||||
|
||||
var fileDescriptor_fc5203cdc85000bc = []byte{
|
||||
// 169 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x12, 0x28, 0x28, 0xca, 0x2f,
|
||||
0xc9, 0xd7, 0x4f, 0xca, 0xc9, 0x4f, 0xd7, 0x03, 0x33, 0x85, 0x58, 0x40, 0x6c, 0x29, 0xb3, 0xf4,
|
||||
0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0xdc, 0xcc, 0xe4, 0xa2, 0x7c, 0xfd,
|
||||
0xe2, 0xd4, 0xa2, 0xb2, 0xcc, 0xe4, 0xd4, 0x62, 0xb0, 0x5a, 0xfd, 0x82, 0xfc, 0xe2, 0x92, 0x62,
|
||||
0x7d, 0x88, 0x66, 0x30, 0x1b, 0xa2, 0x5b, 0x89, 0x9f, 0x8b, 0xd7, 0x27, 0xb1, 0x24, 0xb5, 0xb8,
|
||||
0x24, 0x28, 0xb5, 0xb0, 0x14, 0x48, 0x29, 0x99, 0x72, 0xf1, 0xc1, 0x04, 0x8a, 0x0b, 0xf2, 0xf3,
|
||||
0x8a, 0x53, 0x85, 0x94, 0xb9, 0xd8, 0x72, 0xc0, 0x22, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xdc, 0x46,
|
||||
0xdc, 0x7a, 0x10, 0x03, 0x02, 0x80, 0x64, 0x10, 0x54, 0xca, 0xc8, 0x96, 0x8b, 0xc5, 0x09, 0x68,
|
||||
0x8f, 0x90, 0x29, 0x17, 0x1b, 0x44, 0xbb, 0x90, 0xb0, 0x1e, 0xd8, 0x91, 0x28, 0xa6, 0x4b, 0x89,
|
||||
0xa0, 0x0a, 0x42, 0x6c, 0x50, 0x62, 0x48, 0x62, 0x03, 0xbb, 0xc6, 0x18, 0x10, 0x00, 0x00, 0xff,
|
||||
0xff, 0xc0, 0x99, 0x61, 0x2b, 0xdf, 0x00, 0x00, 0x00,
|
||||
}
|
||||
94
blog/proto/blog.pb.micro.go
Normal file
94
blog/proto/blog.pb.micro.go
Normal file
@@ -0,0 +1,94 @@
|
||||
// Code generated by protoc-gen-micro. DO NOT EDIT.
|
||||
// source: proto/blog.proto
|
||||
|
||||
package blog
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
_ "github.com/micro/services/blog/posts/proto"
|
||||
math "math"
|
||||
)
|
||||
|
||||
import (
|
||||
context "context"
|
||||
api "github.com/micro/micro/v3/service/api"
|
||||
client "github.com/micro/micro/v3/service/client"
|
||||
server "github.com/micro/micro/v3/service/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 Blog service
|
||||
|
||||
func NewBlogEndpoints() []*api.Endpoint {
|
||||
return []*api.Endpoint{}
|
||||
}
|
||||
|
||||
// Client API for Blog service
|
||||
|
||||
type BlogService interface {
|
||||
Latest(ctx context.Context, in *LatestRequest, opts ...client.CallOption) (*LatestResponse, error)
|
||||
}
|
||||
|
||||
type blogService struct {
|
||||
c client.Client
|
||||
name string
|
||||
}
|
||||
|
||||
func NewBlogService(name string, c client.Client) BlogService {
|
||||
return &blogService{
|
||||
c: c,
|
||||
name: name,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *blogService) Latest(ctx context.Context, in *LatestRequest, opts ...client.CallOption) (*LatestResponse, error) {
|
||||
req := c.c.NewRequest(c.name, "Blog.Latest", in)
|
||||
out := new(LatestResponse)
|
||||
err := c.c.Call(ctx, req, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Server API for Blog service
|
||||
|
||||
type BlogHandler interface {
|
||||
Latest(context.Context, *LatestRequest, *LatestResponse) error
|
||||
}
|
||||
|
||||
func RegisterBlogHandler(s server.Server, hdlr BlogHandler, opts ...server.HandlerOption) error {
|
||||
type blog interface {
|
||||
Latest(ctx context.Context, in *LatestRequest, out *LatestResponse) error
|
||||
}
|
||||
type Blog struct {
|
||||
blog
|
||||
}
|
||||
h := &blogHandler{hdlr}
|
||||
return s.Handle(s.NewHandler(&Blog{h}, opts...))
|
||||
}
|
||||
|
||||
type blogHandler struct {
|
||||
BlogHandler
|
||||
}
|
||||
|
||||
func (h *blogHandler) Latest(ctx context.Context, in *LatestRequest, out *LatestResponse) error {
|
||||
return h.BlogHandler.Latest(ctx, in, out)
|
||||
}
|
||||
15
blog/proto/blog.proto
Normal file
15
blog/proto/blog.proto
Normal file
@@ -0,0 +1,15 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package blog;
|
||||
|
||||
import "github.com/micro/services/blog/posts/proto/posts.proto";
|
||||
|
||||
service Blog {
|
||||
rpc Latest(LatestRequest) returns (LatestResponse) {}
|
||||
}
|
||||
|
||||
message LatestRequest {}
|
||||
|
||||
message LatestResponse{
|
||||
posts.Post latest = 1;
|
||||
}
|
||||
Reference in New Issue
Block a user