dev
This commit is contained in:
parent
7d46f7178d
commit
d94b2744c0
|
@ -0,0 +1,2 @@
|
|||
go build -o C:\Users\david\go\bin\protoc-gen-slc.exe main.go
|
||||
protoc ./proto/*.proto --go_out=./pb --go-grpc_out=./pb --proto_path=./proto --slc_out=./slc
|
5
go.mod
5
go.mod
|
@ -2,4 +2,7 @@ module protoc-gen-slc
|
|||
|
||||
go 1.24.0
|
||||
|
||||
require google.golang.org/protobuf v1.36.6
|
||||
require (
|
||||
golang.org/x/mod v0.24.0
|
||||
google.golang.org/protobuf v1.36.6
|
||||
)
|
||||
|
|
2
go.sum
2
go.sum
|
@ -1,5 +1,7 @@
|
|||
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU=
|
||||
golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
|
||||
|
|
|
@ -0,0 +1,202 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"google.golang.org/protobuf/compiler/protogen"
|
||||
"google.golang.org/protobuf/types/pluginpb"
|
||||
)
|
||||
|
||||
func main() {
|
||||
protogen.Options{}.Run(func(gen *protogen.Plugin) error {
|
||||
gen.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL)
|
||||
for _, f := range gen.Files {
|
||||
if len(f.Services) == 0 {
|
||||
continue
|
||||
}
|
||||
if err := generateFiles(gen, f); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func generateFiles(gen *protogen.Plugin, file *protogen.File) error {
|
||||
for _, service := range file.Services {
|
||||
// Generate server file
|
||||
if err := generateServerFile(gen, file, service); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Generate client file
|
||||
if err := generateClientFile(gen, file, service); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Generate logic file
|
||||
if err := generateLogicFile(gen, file, service); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func generateServerFile(gen *protogen.Plugin, file *protogen.File, service *protogen.Service) error {
|
||||
filename := fmt.Sprintf("%s_server.pb.go", strings.ToLower(service.GoName))
|
||||
g := gen.NewGeneratedFile(filename, file.GoImportPath)
|
||||
|
||||
// Package declaration
|
||||
g.P("// Code generated by protoc-gen-slc. DO NOT EDIT.")
|
||||
g.P()
|
||||
g.P("package ", file.GoPackageName)
|
||||
g.P()
|
||||
|
||||
// Imports
|
||||
g.P("import (")
|
||||
g.P("\t\"context\"")
|
||||
g.P("\t\"errors\"")
|
||||
g.P()
|
||||
g.P("\t\"google.golang.org/grpc\"")
|
||||
g.P("\t\"google.golang.org/grpc/codes\"")
|
||||
g.P("\t\"google.golang.org/grpc/status\"")
|
||||
g.P(")")
|
||||
g.P()
|
||||
|
||||
// Server struct
|
||||
g.P("type ", service.GoName, "Server struct {")
|
||||
g.P("\tUnimplemented", service.GoName, "Server")
|
||||
g.P("\tlogic *", service.GoName, "Logic")
|
||||
g.P("}")
|
||||
g.P()
|
||||
|
||||
// NewServer function
|
||||
g.P("func New", service.GoName, "Server(logic *", service.GoName, "Logic) *", service.GoName, "Server {")
|
||||
g.P("\treturn &", service.GoName, "Server{logic: logic}")
|
||||
g.P("}")
|
||||
g.P()
|
||||
|
||||
// Register function
|
||||
g.P("func Register", service.GoName, "Server(s *grpc.Server, logic *", service.GoName, "Logic) {")
|
||||
g.P("\tserver := New", service.GoName, "Server(logic)")
|
||||
g.P("\tRegister", service.GoName, "Server(s, server)")
|
||||
g.P("}")
|
||||
g.P()
|
||||
|
||||
// Service methods
|
||||
for _, method := range service.Methods {
|
||||
g.P("func (s *", service.GoName, "Server) ", methodSignature(g, method), " {")
|
||||
g.P("\t// Add your server-side logic here")
|
||||
g.P("\tresp, err := s.logic.", method.GoName, "(ctx, req)")
|
||||
g.P("\tif err != nil {")
|
||||
g.P("\t\treturn nil, status.Errorf(codes.Internal, \"%v\", err)")
|
||||
g.P("\t}")
|
||||
g.P("\treturn resp, nil")
|
||||
g.P("}")
|
||||
g.P()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func generateClientFile(gen *protogen.Plugin, file *protogen.File, service *protogen.Service) error {
|
||||
filename := fmt.Sprintf("%s_client.pb.go", strings.ToLower(service.GoName))
|
||||
g := gen.NewGeneratedFile(filename, file.GoImportPath)
|
||||
|
||||
// Package declaration
|
||||
g.P("// Code generated by protoc-gen-layered. DO NOT EDIT.")
|
||||
g.P()
|
||||
g.P("package ", file.GoPackageName)
|
||||
g.P()
|
||||
|
||||
// Imports
|
||||
g.P("import (")
|
||||
g.P("\t\"context\"")
|
||||
g.P()
|
||||
g.P("\t\"google.golang.org/grpc\"")
|
||||
g.P(")")
|
||||
g.P()
|
||||
|
||||
// Client struct
|
||||
g.P("type ", service.GoName, "Client struct {")
|
||||
g.P("\tcc grpc.ClientConnInterface")
|
||||
g.P("}")
|
||||
g.P()
|
||||
|
||||
// NewClient function
|
||||
g.P("func New", service.GoName, "Client(cc grpc.ClientConnInterface) *", service.GoName, "Client {")
|
||||
g.P("\treturn &", service.GoName, "Client{cc}")
|
||||
g.P("}")
|
||||
g.P()
|
||||
|
||||
// Client methods
|
||||
for _, method := range service.Methods {
|
||||
g.P("func (c *", service.GoName, "Client) ", methodSignature(g, method), " {")
|
||||
g.P("\tout := new(", method.Output.GoIdent, ")")
|
||||
g.P("\terr := c.cc.Invoke(ctx, \"", fullMethodName(file, service, method), "\", req, out)")
|
||||
g.P("\tif err != nil {")
|
||||
g.P("\t\treturn nil, err")
|
||||
g.P("\t}")
|
||||
g.P("\treturn out, nil")
|
||||
g.P("}")
|
||||
g.P()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func generateLogicFile(gen *protogen.Plugin, file *protogen.File, service *protogen.Service) error {
|
||||
filename := fmt.Sprintf("%s_logic.pb.go", strings.ToLower(service.GoName))
|
||||
g := gen.NewGeneratedFile(filename, file.GoImportPath)
|
||||
|
||||
// Package declaration
|
||||
g.P("// Code generated by protoc-gen-layered. DO NOT EDIT.")
|
||||
g.P()
|
||||
g.P("package ", file.GoPackageName)
|
||||
g.P()
|
||||
|
||||
// Imports
|
||||
g.P("import (")
|
||||
g.P("\t\"context\"")
|
||||
g.P("\t\"errors\"")
|
||||
g.P(")")
|
||||
g.P()
|
||||
|
||||
// Logic struct
|
||||
g.P("type ", service.GoName, "Logic struct {")
|
||||
g.P("\t// Add your dependencies here")
|
||||
g.P("}")
|
||||
g.P()
|
||||
|
||||
// NewLogic function
|
||||
g.P("func New", service.GoName, "Logic() *", service.GoName, "Logic {")
|
||||
g.P("\treturn &", service.GoName, "Logic{}")
|
||||
g.P("}")
|
||||
g.P()
|
||||
|
||||
// Logic methods
|
||||
for _, method := range service.Methods {
|
||||
g.P("func (l *", service.GoName, "Logic) ", method.GoName, "(ctx context.Context, req *", method.Input.GoIdent, ") (*", method.Output.GoIdent, ", error) {")
|
||||
g.P("\t// Implement your business logic here")
|
||||
g.P("\treturn nil, errors.New(\"not implemented\")")
|
||||
g.P("}")
|
||||
g.P()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func methodSignature(g *protogen.GeneratedFile, method *protogen.Method) string {
|
||||
return fmt.Sprintf("%s(ctx context.Context, req *%s) (*%s, error)",
|
||||
method.GoName,
|
||||
method.Input.GoIdent,
|
||||
method.Output.GoIdent)
|
||||
}
|
||||
|
||||
func fullMethodName(file *protogen.File, service *protogen.Service, method *protogen.Method) string {
|
||||
return fmt.Sprintf("/%s.%s/%s",
|
||||
file.Proto.GetPackage(),
|
||||
service.GoName,
|
||||
method.GoName)
|
||||
}
|
261
main.go
261
main.go
|
@ -1,13 +1,22 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"go/format"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"protoc-gen-slc/tpl"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/mod/modfile"
|
||||
"google.golang.org/protobuf/compiler/protogen"
|
||||
"google.golang.org/protobuf/types/pluginpb"
|
||||
)
|
||||
|
||||
var ServicesName []string
|
||||
|
||||
func main() {
|
||||
protogen.Options{}.Run(func(gen *protogen.Plugin) error {
|
||||
gen.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL)
|
||||
|
@ -19,176 +28,115 @@ func main() {
|
|||
return err
|
||||
}
|
||||
}
|
||||
|
||||
generateNewServerFile(ServicesName)
|
||||
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func generateFiles(gen *protogen.Plugin, file *protogen.File) error {
|
||||
for _, service := range file.Services {
|
||||
ServicesName = append(ServicesName, service.GoName)
|
||||
// Generate server file
|
||||
if err := generateServerFile(gen, file, service); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Generate client file
|
||||
if err := generateClientFile(gen, file, service); err != nil {
|
||||
return err
|
||||
}
|
||||
// // Generate client file
|
||||
// if err := generateClientFile(gen, file, service); err != nil {
|
||||
// return err
|
||||
// }
|
||||
|
||||
// Generate logic file
|
||||
if err := generateLogicFile(gen, file, service); err != nil {
|
||||
return err
|
||||
}
|
||||
// // Generate logic file
|
||||
// if err := generateLogicFile(gen, file, service); err != nil {
|
||||
// return err
|
||||
// }
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func generateNewServerFile(services []string) error {
|
||||
moduleName := getModuleName()
|
||||
|
||||
//create new.go
|
||||
code := tpl.NewFile
|
||||
newImports := []string{
|
||||
"pb \"" + moduleName + "/pb\"",
|
||||
}
|
||||
code = strings.ReplaceAll(code, "{import}", strings.Join(newImports, "\n"))
|
||||
var register []string
|
||||
for _, service := range services {
|
||||
register = append(register, "pb.Register"+service+"Server(srv, New"+service+"Server())")
|
||||
}
|
||||
|
||||
code = strings.ReplaceAll(code, "{register}", strings.Join(register, "\n"))
|
||||
|
||||
// 格式化代码
|
||||
formattedCode, err := format.Source([]byte(code))
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to format generated code: %w", err)
|
||||
}
|
||||
|
||||
StringToFile("./server/new.go", string(formattedCode))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func generateServerFile(gen *protogen.Plugin, file *protogen.File, service *protogen.Service) error {
|
||||
filename := fmt.Sprintf("%s_server.pb.go", strings.ToLower(service.GoName))
|
||||
g := gen.NewGeneratedFile(filename, file.GoImportPath)
|
||||
filename := fmt.Sprintf("./server/%s_server.go", strings.ToLower(service.GoName))
|
||||
moduleName := getModuleName()
|
||||
|
||||
// Package declaration
|
||||
g.P("// Code generated by protoc-gen-layered. DO NOT EDIT.")
|
||||
g.P()
|
||||
g.P("package ", file.GoPackageName)
|
||||
g.P()
|
||||
|
||||
// Imports
|
||||
g.P("import (")
|
||||
g.P("\t\"context\"")
|
||||
g.P("\t\"errors\"")
|
||||
g.P()
|
||||
g.P("\t\"google.golang.org/grpc\"")
|
||||
g.P("\t\"google.golang.org/grpc/codes\"")
|
||||
g.P("\t\"google.golang.org/grpc/status\"")
|
||||
g.P(")")
|
||||
g.P()
|
||||
|
||||
// Server struct
|
||||
g.P("type ", service.GoName, "Server struct {")
|
||||
g.P("\tUnimplemented", service.GoName, "Server")
|
||||
g.P("\tlogic *", service.GoName, "Logic")
|
||||
g.P("}")
|
||||
g.P()
|
||||
|
||||
// NewServer function
|
||||
g.P("func New", service.GoName, "Server(logic *", service.GoName, "Logic) *", service.GoName, "Server {")
|
||||
g.P("\treturn &", service.GoName, "Server{logic: logic}")
|
||||
g.P("}")
|
||||
g.P()
|
||||
|
||||
// Register function
|
||||
g.P("func Register", service.GoName, "Server(s *grpc.Server, logic *", service.GoName, "Logic) {")
|
||||
g.P("\tserver := New", service.GoName, "Server(logic)")
|
||||
g.P("\tRegister", service.GoName, "Server(s, server)")
|
||||
g.P("}")
|
||||
g.P()
|
||||
|
||||
// Service methods
|
||||
for _, method := range service.Methods {
|
||||
g.P("func (s *", service.GoName, "Server) ", methodSignature(g, method), " {")
|
||||
g.P("\t// Add your server-side logic here")
|
||||
g.P("\tresp, err := s.logic.", method.GoName, "(ctx, req)")
|
||||
g.P("\tif err != nil {")
|
||||
g.P("\t\treturn nil, status.Errorf(codes.Internal, \"%v\", err)")
|
||||
g.P("\t}")
|
||||
g.P("\treturn resp, nil")
|
||||
g.P("}")
|
||||
g.P()
|
||||
//create servers.
|
||||
code := tpl.Server
|
||||
imports := []string{
|
||||
"\"" + moduleName + "/internal/logic/" + strings.ToLower(service.GoName) + "\"",
|
||||
"pb \"" + moduleName + "/pb\"",
|
||||
}
|
||||
|
||||
code = strings.ReplaceAll(code, "{import}", strings.Join(imports, "\n"))
|
||||
code = strings.ReplaceAll(code, "{service}", service.GoName)
|
||||
|
||||
var codeMethods []string
|
||||
for _, method := range service.Methods {
|
||||
commit := strings.TrimSpace(method.Comments.Leading.String())
|
||||
methodCode := tpl.Method
|
||||
methodCode = strings.ReplaceAll(methodCode, "{service}", service.GoName)
|
||||
methodCode = strings.ReplaceAll(methodCode, "{serviceLower}", strings.ToLower(service.GoName))
|
||||
methodCode = strings.ReplaceAll(methodCode, "{func}", method.GoName)
|
||||
methodCode = strings.ReplaceAll(methodCode, "{comment}", commit)
|
||||
methodCode = strings.ReplaceAll(methodCode, "{input}", method.Input.GoIdent.GoName)
|
||||
methodCode = strings.ReplaceAll(methodCode, "{output}", method.Output.GoIdent.GoName)
|
||||
codeMethods = append(codeMethods, methodCode)
|
||||
}
|
||||
code = strings.ReplaceAll(code, "{method}", strings.Join(codeMethods, "\n"))
|
||||
|
||||
// 格式化代码
|
||||
formattedCode, err := format.Source([]byte(code))
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to format generated code: %w", err)
|
||||
}
|
||||
|
||||
StringToFile(filename, string(formattedCode))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func generateClientFile(gen *protogen.Plugin, file *protogen.File, service *protogen.Service) error {
|
||||
filename := fmt.Sprintf("%s_client.pb.go", strings.ToLower(service.GoName))
|
||||
g := gen.NewGeneratedFile(filename, file.GoImportPath)
|
||||
|
||||
// Package declaration
|
||||
g.P("// Code generated by protoc-gen-layered. DO NOT EDIT.")
|
||||
g.P()
|
||||
g.P("package ", file.GoPackageName)
|
||||
g.P()
|
||||
|
||||
// Imports
|
||||
g.P("import (")
|
||||
g.P("\t\"context\"")
|
||||
g.P()
|
||||
g.P("\t\"google.golang.org/grpc\"")
|
||||
g.P(")")
|
||||
g.P()
|
||||
|
||||
// Client struct
|
||||
g.P("type ", service.GoName, "Client struct {")
|
||||
g.P("\tcc grpc.ClientConnInterface")
|
||||
g.P("}")
|
||||
g.P()
|
||||
|
||||
// NewClient function
|
||||
g.P("func New", service.GoName, "Client(cc grpc.ClientConnInterface) *", service.GoName, "Client {")
|
||||
g.P("\treturn &", service.GoName, "Client{cc}")
|
||||
g.P("}")
|
||||
g.P()
|
||||
|
||||
// Client methods
|
||||
for _, method := range service.Methods {
|
||||
g.P("func (c *", service.GoName, "Client) ", methodSignature(g, method), " {")
|
||||
g.P("\tout := new(", method.Output.GoIdent, ")")
|
||||
g.P("\terr := c.cc.Invoke(ctx, \"", fullMethodName(file, service, method), "\", req, out)")
|
||||
g.P("\tif err != nil {")
|
||||
g.P("\t\treturn nil, err")
|
||||
g.P("\t}")
|
||||
g.P("\treturn out, nil")
|
||||
g.P("}")
|
||||
g.P()
|
||||
}
|
||||
|
||||
fmt.Println(filename, file.GoImportPath)
|
||||
return nil
|
||||
}
|
||||
|
||||
func generateLogicFile(gen *protogen.Plugin, file *protogen.File, service *protogen.Service) error {
|
||||
filename := fmt.Sprintf("%s_logic.pb.go", strings.ToLower(service.GoName))
|
||||
g := gen.NewGeneratedFile(filename, file.GoImportPath)
|
||||
|
||||
// Package declaration
|
||||
g.P("// Code generated by protoc-gen-layered. DO NOT EDIT.")
|
||||
g.P()
|
||||
g.P("package ", file.GoPackageName)
|
||||
g.P()
|
||||
|
||||
// Imports
|
||||
g.P("import (")
|
||||
g.P("\t\"context\"")
|
||||
g.P("\t\"errors\"")
|
||||
g.P(")")
|
||||
g.P()
|
||||
|
||||
// Logic struct
|
||||
g.P("type ", service.GoName, "Logic struct {")
|
||||
g.P("\t// Add your dependencies here")
|
||||
g.P("}")
|
||||
g.P()
|
||||
|
||||
// NewLogic function
|
||||
g.P("func New", service.GoName, "Logic() *", service.GoName, "Logic {")
|
||||
g.P("\treturn &", service.GoName, "Logic{}")
|
||||
g.P("}")
|
||||
g.P()
|
||||
|
||||
// Logic methods
|
||||
for _, method := range service.Methods {
|
||||
g.P("func (l *", service.GoName, "Logic) ", method.GoName, "(ctx context.Context, req *", method.Input.GoIdent, ") (*", method.Output.GoIdent, ", error) {")
|
||||
g.P("\t// Implement your business logic here")
|
||||
g.P("\treturn nil, errors.New(\"not implemented\")")
|
||||
g.P("}")
|
||||
g.P()
|
||||
}
|
||||
|
||||
fmt.Println(filename, file.GoImportPath)
|
||||
return nil
|
||||
}
|
||||
|
||||
func methodSignature(g *protogen.GeneratedFile, method *protogen.Method) string {
|
||||
return fmt.Sprintf("%s(ctx context.Context, req *%s) (*%s, error)",
|
||||
return fmt.Sprintf("%s(ctx context.Context, req pb%s) (*%s, error)",
|
||||
method.GoName,
|
||||
method.Input.GoIdent,
|
||||
method.Output.GoIdent)
|
||||
|
@ -200,3 +148,44 @@ func fullMethodName(file *protogen.File, service *protogen.Service, method *prot
|
|||
service.GoName,
|
||||
method.GoName)
|
||||
}
|
||||
|
||||
func getModuleName() (modulePath string) {
|
||||
// 获取当前工作目录
|
||||
cwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
fmt.Errorf("failed to get current working directory: %w", err)
|
||||
return
|
||||
}
|
||||
|
||||
// 读取 go.mod 文件
|
||||
modFilePath := filepath.Join(cwd, "go.mod")
|
||||
modFileBytes, err := os.ReadFile(modFilePath)
|
||||
if err != nil {
|
||||
fmt.Errorf("failed to read go.mod file: %w", err)
|
||||
return
|
||||
}
|
||||
|
||||
// 解析 go.mod 文件
|
||||
modFile, err := modfile.Parse(modFilePath, modFileBytes, nil)
|
||||
if err != nil {
|
||||
fmt.Errorf("failed to parse go.mod file: %w", err)
|
||||
return
|
||||
}
|
||||
|
||||
// 获取模块路径
|
||||
return modFile.Module.Mod.Path
|
||||
}
|
||||
|
||||
// 将字符串写入文件
|
||||
func StringToFile(path, content string) error {
|
||||
startF, err := os.Create(path)
|
||||
if err != nil {
|
||||
return errors.New("os.Create create file " + path + " error:" + err.Error())
|
||||
}
|
||||
defer startF.Close()
|
||||
_, err = io.WriteString(startF, content)
|
||||
if err != nil {
|
||||
return errors.New("io.WriteString to " + path + " error:" + err.Error())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -0,0 +1,408 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.6
|
||||
// protoc v6.30.1
|
||||
// source: blocks.proto
|
||||
|
||||
package content
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
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)
|
||||
)
|
||||
|
||||
type FetchRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
PageNo int64 `protobuf:"varint,1,opt,name=page_no,json=pageNo,proto3" json:"page_no,omitempty"` // 页数
|
||||
PageSize int64 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` // 每页记录数
|
||||
Params map[string]string `protobuf:"bytes,3,rep,name=params,proto3" json:"params,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` // 条件参数,key=val,eg key:category_id=?,vlaue=11
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *FetchRequest) Reset() {
|
||||
*x = FetchRequest{}
|
||||
mi := &file_blocks_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *FetchRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*FetchRequest) ProtoMessage() {}
|
||||
|
||||
func (x *FetchRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_blocks_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use FetchRequest.ProtoReflect.Descriptor instead.
|
||||
func (*FetchRequest) Descriptor() ([]byte, []int) {
|
||||
return file_blocks_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *FetchRequest) GetPageNo() int64 {
|
||||
if x != nil {
|
||||
return x.PageNo
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *FetchRequest) GetPageSize() int64 {
|
||||
if x != nil {
|
||||
return x.PageSize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *FetchRequest) GetParams() map[string]string {
|
||||
if x != nil {
|
||||
return x.Params
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type IdentRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // 唯一ID
|
||||
Identity string `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"` // 唯一码
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *IdentRequest) Reset() {
|
||||
*x = IdentRequest{}
|
||||
mi := &file_blocks_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *IdentRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*IdentRequest) ProtoMessage() {}
|
||||
|
||||
func (x *IdentRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_blocks_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use IdentRequest.ProtoReflect.Descriptor instead.
|
||||
func (*IdentRequest) Descriptor() ([]byte, []int) {
|
||||
return file_blocks_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *IdentRequest) GetId() int64 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *IdentRequest) GetIdentity() string {
|
||||
if x != nil {
|
||||
return x.Identity
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type VersionRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Version int64 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` // 时序版本号
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *VersionRequest) Reset() {
|
||||
*x = VersionRequest{}
|
||||
mi := &file_blocks_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *VersionRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*VersionRequest) ProtoMessage() {}
|
||||
|
||||
func (x *VersionRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_blocks_proto_msgTypes[2]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use VersionRequest.ProtoReflect.Descriptor instead.
|
||||
func (*VersionRequest) Descriptor() ([]byte, []int) {
|
||||
return file_blocks_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *VersionRequest) GetVersion() int64 {
|
||||
if x != nil {
|
||||
return x.Version
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type SearchRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Keyword string `protobuf:"bytes,1,opt,name=keyword,proto3" json:"keyword,omitempty"` //关键词
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *SearchRequest) Reset() {
|
||||
*x = SearchRequest{}
|
||||
mi := &file_blocks_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *SearchRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SearchRequest) ProtoMessage() {}
|
||||
|
||||
func (x *SearchRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_blocks_proto_msgTypes[3]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SearchRequest.ProtoReflect.Descriptor instead.
|
||||
func (*SearchRequest) Descriptor() ([]byte, []int) {
|
||||
return file_blocks_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *SearchRequest) GetKeyword() string {
|
||||
if x != nil {
|
||||
return x.Keyword
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type StatusReply struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Status int64 `protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"` // 状态码
|
||||
Identity string `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"` // 标识码
|
||||
Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` //状态说明
|
||||
Timeseq int64 `protobuf:"varint,4,opt,name=timeseq,proto3" json:"timeseq,omitempty"` // 响应时间序列
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *StatusReply) Reset() {
|
||||
*x = StatusReply{}
|
||||
mi := &file_blocks_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *StatusReply) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*StatusReply) ProtoMessage() {}
|
||||
|
||||
func (x *StatusReply) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_blocks_proto_msgTypes[4]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use StatusReply.ProtoReflect.Descriptor instead.
|
||||
func (*StatusReply) Descriptor() ([]byte, []int) {
|
||||
return file_blocks_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *StatusReply) GetStatus() int64 {
|
||||
if x != nil {
|
||||
return x.Status
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *StatusReply) GetIdentity() string {
|
||||
if x != nil {
|
||||
return x.Identity
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *StatusReply) GetMessage() string {
|
||||
if x != nil {
|
||||
return x.Message
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *StatusReply) GetTimeseq() int64 {
|
||||
if x != nil {
|
||||
return x.Timeseq
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type Empty struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *Empty) Reset() {
|
||||
*x = Empty{}
|
||||
mi := &file_blocks_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *Empty) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Empty) ProtoMessage() {}
|
||||
|
||||
func (x *Empty) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_blocks_proto_msgTypes[5]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Empty.ProtoReflect.Descriptor instead.
|
||||
func (*Empty) Descriptor() ([]byte, []int) {
|
||||
return file_blocks_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
var File_blocks_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_blocks_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\fblocks.proto\x12\acontent\"\xba\x01\n" +
|
||||
"\fFetchRequest\x12\x17\n" +
|
||||
"\apage_no\x18\x01 \x01(\x03R\x06pageNo\x12\x1b\n" +
|
||||
"\tpage_size\x18\x02 \x01(\x03R\bpageSize\x129\n" +
|
||||
"\x06params\x18\x03 \x03(\v2!.content.FetchRequest.ParamsEntryR\x06params\x1a9\n" +
|
||||
"\vParamsEntry\x12\x10\n" +
|
||||
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
|
||||
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\":\n" +
|
||||
"\fIdentRequest\x12\x0e\n" +
|
||||
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x1a\n" +
|
||||
"\bidentity\x18\x02 \x01(\tR\bidentity\"*\n" +
|
||||
"\x0eVersionRequest\x12\x18\n" +
|
||||
"\aversion\x18\x01 \x01(\x03R\aversion\")\n" +
|
||||
"\rSearchRequest\x12\x18\n" +
|
||||
"\akeyword\x18\x01 \x01(\tR\akeyword\"u\n" +
|
||||
"\vStatusReply\x12\x16\n" +
|
||||
"\x06status\x18\x01 \x01(\x03R\x06status\x12\x1a\n" +
|
||||
"\bidentity\x18\x02 \x01(\tR\bidentity\x12\x18\n" +
|
||||
"\amessage\x18\x03 \x01(\tR\amessage\x12\x18\n" +
|
||||
"\atimeseq\x18\x04 \x01(\x03R\atimeseq\"\a\n" +
|
||||
"\x05EmptyB\fZ\n" +
|
||||
"./;contentb\x06proto3"
|
||||
|
||||
var (
|
||||
file_blocks_proto_rawDescOnce sync.Once
|
||||
file_blocks_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_blocks_proto_rawDescGZIP() []byte {
|
||||
file_blocks_proto_rawDescOnce.Do(func() {
|
||||
file_blocks_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_blocks_proto_rawDesc), len(file_blocks_proto_rawDesc)))
|
||||
})
|
||||
return file_blocks_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_blocks_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
|
||||
var file_blocks_proto_goTypes = []any{
|
||||
(*FetchRequest)(nil), // 0: content.FetchRequest
|
||||
(*IdentRequest)(nil), // 1: content.IdentRequest
|
||||
(*VersionRequest)(nil), // 2: content.VersionRequest
|
||||
(*SearchRequest)(nil), // 3: content.SearchRequest
|
||||
(*StatusReply)(nil), // 4: content.StatusReply
|
||||
(*Empty)(nil), // 5: content.Empty
|
||||
nil, // 6: content.FetchRequest.ParamsEntry
|
||||
}
|
||||
var file_blocks_proto_depIdxs = []int32{
|
||||
6, // 0: content.FetchRequest.params:type_name -> content.FetchRequest.ParamsEntry
|
||||
1, // [1:1] is the sub-list for method output_type
|
||||
1, // [1:1] is the sub-list for method input_type
|
||||
1, // [1:1] is the sub-list for extension type_name
|
||||
1, // [1:1] is the sub-list for extension extendee
|
||||
0, // [0:1] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_blocks_proto_init() }
|
||||
func file_blocks_proto_init() {
|
||||
if File_blocks_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_blocks_proto_rawDesc), len(file_blocks_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 7,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_blocks_proto_goTypes,
|
||||
DependencyIndexes: file_blocks_proto_depIdxs,
|
||||
MessageInfos: file_blocks_proto_msgTypes,
|
||||
}.Build()
|
||||
File_blocks_proto = out.File
|
||||
file_blocks_proto_goTypes = nil
|
||||
file_blocks_proto_depIdxs = nil
|
||||
}
|
|
@ -0,0 +1,585 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.6
|
||||
// protoc v6.30.1
|
||||
// source: category.proto
|
||||
|
||||
package content
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
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)
|
||||
)
|
||||
|
||||
// 无限极分类
|
||||
type CategoryItem struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Identity string `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"`
|
||||
ParentIdentity string `protobuf:"bytes,2,opt,name=parent_identity,json=parentIdentity,proto3" json:"parent_identity,omitempty"` // 为空表示顶级分类
|
||||
Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"`
|
||||
CoverPath string `protobuf:"bytes,4,opt,name=cover_path,json=coverPath,proto3" json:"cover_path,omitempty"`
|
||||
Intro string `protobuf:"bytes,5,opt,name=intro,proto3" json:"intro,omitempty"`
|
||||
CreatedAt string `protobuf:"bytes,6,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
|
||||
UpdatedAt string `protobuf:"bytes,7,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
|
||||
Data []*CategoryItem `protobuf:"bytes,8,rep,name=data,proto3" json:"data,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *CategoryItem) Reset() {
|
||||
*x = CategoryItem{}
|
||||
mi := &file_category_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *CategoryItem) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CategoryItem) ProtoMessage() {}
|
||||
|
||||
func (x *CategoryItem) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_category_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use CategoryItem.ProtoReflect.Descriptor instead.
|
||||
func (*CategoryItem) Descriptor() ([]byte, []int) {
|
||||
return file_category_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *CategoryItem) GetIdentity() string {
|
||||
if x != nil {
|
||||
return x.Identity
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CategoryItem) GetParentIdentity() string {
|
||||
if x != nil {
|
||||
return x.ParentIdentity
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CategoryItem) GetTitle() string {
|
||||
if x != nil {
|
||||
return x.Title
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CategoryItem) GetCoverPath() string {
|
||||
if x != nil {
|
||||
return x.CoverPath
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CategoryItem) GetIntro() string {
|
||||
if x != nil {
|
||||
return x.Intro
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CategoryItem) GetCreatedAt() string {
|
||||
if x != nil {
|
||||
return x.CreatedAt
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CategoryItem) GetUpdatedAt() string {
|
||||
if x != nil {
|
||||
return x.UpdatedAt
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CategoryItem) GetData() []*CategoryItem {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type CategoryListReply struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Data []*CategoryItem `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"`
|
||||
Count int64 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *CategoryListReply) Reset() {
|
||||
*x = CategoryListReply{}
|
||||
mi := &file_category_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *CategoryListReply) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CategoryListReply) ProtoMessage() {}
|
||||
|
||||
func (x *CategoryListReply) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_category_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use CategoryListReply.ProtoReflect.Descriptor instead.
|
||||
func (*CategoryListReply) Descriptor() ([]byte, []int) {
|
||||
return file_category_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *CategoryListReply) GetData() []*CategoryItem {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *CategoryListReply) GetCount() int64 {
|
||||
if x != nil {
|
||||
return x.Count
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type AddCategoryResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Identity string `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` // 新增数据的唯一码
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *AddCategoryResponse) Reset() {
|
||||
*x = AddCategoryResponse{}
|
||||
mi := &file_category_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *AddCategoryResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*AddCategoryResponse) ProtoMessage() {}
|
||||
|
||||
func (x *AddCategoryResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_category_proto_msgTypes[2]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use AddCategoryResponse.ProtoReflect.Descriptor instead.
|
||||
func (*AddCategoryResponse) Descriptor() ([]byte, []int) {
|
||||
return file_category_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *AddCategoryResponse) GetIdentity() string {
|
||||
if x != nil {
|
||||
return x.Identity
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type AddCategoryRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Identity string `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` //
|
||||
ParentIdentity string `protobuf:"bytes,2,opt,name=parent_identity,json=parentIdentity,proto3" json:"parent_identity,omitempty"` // 为空表示顶级分类
|
||||
Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"`
|
||||
CoverPath string `protobuf:"bytes,4,opt,name=cover_path,json=coverPath,proto3" json:"cover_path,omitempty"`
|
||||
Intro string `protobuf:"bytes,5,opt,name=intro,proto3" json:"intro,omitempty"`
|
||||
CreatedAt string `protobuf:"bytes,6,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
|
||||
UpdatedAt string `protobuf:"bytes,7,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
|
||||
Data []*CategoryItem `protobuf:"bytes,8,rep,name=data,proto3" json:"data,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *AddCategoryRequest) Reset() {
|
||||
*x = AddCategoryRequest{}
|
||||
mi := &file_category_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *AddCategoryRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*AddCategoryRequest) ProtoMessage() {}
|
||||
|
||||
func (x *AddCategoryRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_category_proto_msgTypes[3]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use AddCategoryRequest.ProtoReflect.Descriptor instead.
|
||||
func (*AddCategoryRequest) Descriptor() ([]byte, []int) {
|
||||
return file_category_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *AddCategoryRequest) GetIdentity() string {
|
||||
if x != nil {
|
||||
return x.Identity
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AddCategoryRequest) GetParentIdentity() string {
|
||||
if x != nil {
|
||||
return x.ParentIdentity
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AddCategoryRequest) GetTitle() string {
|
||||
if x != nil {
|
||||
return x.Title
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AddCategoryRequest) GetCoverPath() string {
|
||||
if x != nil {
|
||||
return x.CoverPath
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AddCategoryRequest) GetIntro() string {
|
||||
if x != nil {
|
||||
return x.Intro
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AddCategoryRequest) GetCreatedAt() string {
|
||||
if x != nil {
|
||||
return x.CreatedAt
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AddCategoryRequest) GetUpdatedAt() string {
|
||||
if x != nil {
|
||||
return x.UpdatedAt
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AddCategoryRequest) GetData() []*CategoryItem {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ModifyCategoryRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Identity string `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` //
|
||||
ParentIdentity string `protobuf:"bytes,2,opt,name=parent_identity,json=parentIdentity,proto3" json:"parent_identity,omitempty"` // 为空表示顶级分类
|
||||
Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"`
|
||||
CoverPath string `protobuf:"bytes,4,opt,name=cover_path,json=coverPath,proto3" json:"cover_path,omitempty"`
|
||||
Intro string `protobuf:"bytes,5,opt,name=intro,proto3" json:"intro,omitempty"`
|
||||
CreatedAt string `protobuf:"bytes,6,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
|
||||
UpdatedAt string `protobuf:"bytes,7,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
|
||||
Data []*CategoryItem `protobuf:"bytes,8,rep,name=data,proto3" json:"data,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ModifyCategoryRequest) Reset() {
|
||||
*x = ModifyCategoryRequest{}
|
||||
mi := &file_category_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ModifyCategoryRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ModifyCategoryRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ModifyCategoryRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_category_proto_msgTypes[4]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ModifyCategoryRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ModifyCategoryRequest) Descriptor() ([]byte, []int) {
|
||||
return file_category_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *ModifyCategoryRequest) GetIdentity() string {
|
||||
if x != nil {
|
||||
return x.Identity
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ModifyCategoryRequest) GetParentIdentity() string {
|
||||
if x != nil {
|
||||
return x.ParentIdentity
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ModifyCategoryRequest) GetTitle() string {
|
||||
if x != nil {
|
||||
return x.Title
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ModifyCategoryRequest) GetCoverPath() string {
|
||||
if x != nil {
|
||||
return x.CoverPath
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ModifyCategoryRequest) GetIntro() string {
|
||||
if x != nil {
|
||||
return x.Intro
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ModifyCategoryRequest) GetCreatedAt() string {
|
||||
if x != nil {
|
||||
return x.CreatedAt
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ModifyCategoryRequest) GetUpdatedAt() string {
|
||||
if x != nil {
|
||||
return x.UpdatedAt
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ModifyCategoryRequest) GetData() []*CategoryItem {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type DeleteCategoryRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Identity string `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` //
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *DeleteCategoryRequest) Reset() {
|
||||
*x = DeleteCategoryRequest{}
|
||||
mi := &file_category_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *DeleteCategoryRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DeleteCategoryRequest) ProtoMessage() {}
|
||||
|
||||
func (x *DeleteCategoryRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_category_proto_msgTypes[5]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use DeleteCategoryRequest.ProtoReflect.Descriptor instead.
|
||||
func (*DeleteCategoryRequest) Descriptor() ([]byte, []int) {
|
||||
return file_category_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *DeleteCategoryRequest) GetIdentity() string {
|
||||
if x != nil {
|
||||
return x.Identity
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_category_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_category_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x0ecategory.proto\x12\acontent\x1a\fblocks.proto\"\x87\x02\n" +
|
||||
"\fCategoryItem\x12\x1a\n" +
|
||||
"\bidentity\x18\x01 \x01(\tR\bidentity\x12'\n" +
|
||||
"\x0fparent_identity\x18\x02 \x01(\tR\x0eparentIdentity\x12\x14\n" +
|
||||
"\x05title\x18\x03 \x01(\tR\x05title\x12\x1d\n" +
|
||||
"\n" +
|
||||
"cover_path\x18\x04 \x01(\tR\tcoverPath\x12\x14\n" +
|
||||
"\x05intro\x18\x05 \x01(\tR\x05intro\x12\x1d\n" +
|
||||
"\n" +
|
||||
"created_at\x18\x06 \x01(\tR\tcreatedAt\x12\x1d\n" +
|
||||
"\n" +
|
||||
"updated_at\x18\a \x01(\tR\tupdatedAt\x12)\n" +
|
||||
"\x04data\x18\b \x03(\v2\x15.content.CategoryItemR\x04data\"T\n" +
|
||||
"\x11CategoryListReply\x12)\n" +
|
||||
"\x04data\x18\x01 \x03(\v2\x15.content.CategoryItemR\x04data\x12\x14\n" +
|
||||
"\x05count\x18\x02 \x01(\x03R\x05count\"1\n" +
|
||||
"\x13AddCategoryResponse\x12\x1a\n" +
|
||||
"\bidentity\x18\x01 \x01(\tR\bidentity\"\x8d\x02\n" +
|
||||
"\x12AddCategoryRequest\x12\x1a\n" +
|
||||
"\bidentity\x18\x01 \x01(\tR\bidentity\x12'\n" +
|
||||
"\x0fparent_identity\x18\x02 \x01(\tR\x0eparentIdentity\x12\x14\n" +
|
||||
"\x05title\x18\x03 \x01(\tR\x05title\x12\x1d\n" +
|
||||
"\n" +
|
||||
"cover_path\x18\x04 \x01(\tR\tcoverPath\x12\x14\n" +
|
||||
"\x05intro\x18\x05 \x01(\tR\x05intro\x12\x1d\n" +
|
||||
"\n" +
|
||||
"created_at\x18\x06 \x01(\tR\tcreatedAt\x12\x1d\n" +
|
||||
"\n" +
|
||||
"updated_at\x18\a \x01(\tR\tupdatedAt\x12)\n" +
|
||||
"\x04data\x18\b \x03(\v2\x15.content.CategoryItemR\x04data\"\x90\x02\n" +
|
||||
"\x15ModifyCategoryRequest\x12\x1a\n" +
|
||||
"\bidentity\x18\x01 \x01(\tR\bidentity\x12'\n" +
|
||||
"\x0fparent_identity\x18\x02 \x01(\tR\x0eparentIdentity\x12\x14\n" +
|
||||
"\x05title\x18\x03 \x01(\tR\x05title\x12\x1d\n" +
|
||||
"\n" +
|
||||
"cover_path\x18\x04 \x01(\tR\tcoverPath\x12\x14\n" +
|
||||
"\x05intro\x18\x05 \x01(\tR\x05intro\x12\x1d\n" +
|
||||
"\n" +
|
||||
"created_at\x18\x06 \x01(\tR\tcreatedAt\x12\x1d\n" +
|
||||
"\n" +
|
||||
"updated_at\x18\a \x01(\tR\tupdatedAt\x12)\n" +
|
||||
"\x04data\x18\b \x03(\v2\x15.content.CategoryItemR\x04data\"3\n" +
|
||||
"\x15DeleteCategoryRequest\x12\x1a\n" +
|
||||
"\bidentity\x18\x01 \x01(\tR\bidentity2\x9c\x02\n" +
|
||||
"\bCategory\x12<\n" +
|
||||
"\fCategoryList\x12\x0e.content.Empty\x1a\x1a.content.CategoryListReply\"\x00\x12J\n" +
|
||||
"\vAddCategory\x12\x1b.content.AddCategoryRequest\x1a\x1c.content.AddCategoryResponse\"\x00\x12B\n" +
|
||||
"\x0eModifyCategory\x12\x1e.content.ModifyCategoryRequest\x1a\x0e.content.Empty\"\x00\x12B\n" +
|
||||
"\x0eDeleteCategory\x12\x1e.content.DeleteCategoryRequest\x1a\x0e.content.Empty\"\x00B\fZ\n" +
|
||||
"./;contentb\x06proto3"
|
||||
|
||||
var (
|
||||
file_category_proto_rawDescOnce sync.Once
|
||||
file_category_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_category_proto_rawDescGZIP() []byte {
|
||||
file_category_proto_rawDescOnce.Do(func() {
|
||||
file_category_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_category_proto_rawDesc), len(file_category_proto_rawDesc)))
|
||||
})
|
||||
return file_category_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_category_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
|
||||
var file_category_proto_goTypes = []any{
|
||||
(*CategoryItem)(nil), // 0: content.CategoryItem
|
||||
(*CategoryListReply)(nil), // 1: content.CategoryListReply
|
||||
(*AddCategoryResponse)(nil), // 2: content.AddCategoryResponse
|
||||
(*AddCategoryRequest)(nil), // 3: content.AddCategoryRequest
|
||||
(*ModifyCategoryRequest)(nil), // 4: content.ModifyCategoryRequest
|
||||
(*DeleteCategoryRequest)(nil), // 5: content.DeleteCategoryRequest
|
||||
(*Empty)(nil), // 6: content.Empty
|
||||
}
|
||||
var file_category_proto_depIdxs = []int32{
|
||||
0, // 0: content.CategoryItem.data:type_name -> content.CategoryItem
|
||||
0, // 1: content.CategoryListReply.data:type_name -> content.CategoryItem
|
||||
0, // 2: content.AddCategoryRequest.data:type_name -> content.CategoryItem
|
||||
0, // 3: content.ModifyCategoryRequest.data:type_name -> content.CategoryItem
|
||||
6, // 4: content.Category.CategoryList:input_type -> content.Empty
|
||||
3, // 5: content.Category.AddCategory:input_type -> content.AddCategoryRequest
|
||||
4, // 6: content.Category.ModifyCategory:input_type -> content.ModifyCategoryRequest
|
||||
5, // 7: content.Category.DeleteCategory:input_type -> content.DeleteCategoryRequest
|
||||
1, // 8: content.Category.CategoryList:output_type -> content.CategoryListReply
|
||||
2, // 9: content.Category.AddCategory:output_type -> content.AddCategoryResponse
|
||||
6, // 10: content.Category.ModifyCategory:output_type -> content.Empty
|
||||
6, // 11: content.Category.DeleteCategory:output_type -> content.Empty
|
||||
8, // [8:12] is the sub-list for method output_type
|
||||
4, // [4:8] is the sub-list for method input_type
|
||||
4, // [4:4] is the sub-list for extension type_name
|
||||
4, // [4:4] is the sub-list for extension extendee
|
||||
0, // [0:4] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_category_proto_init() }
|
||||
func file_category_proto_init() {
|
||||
if File_category_proto != nil {
|
||||
return
|
||||
}
|
||||
file_blocks_proto_init()
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_category_proto_rawDesc), len(file_category_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 6,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_category_proto_goTypes,
|
||||
DependencyIndexes: file_category_proto_depIdxs,
|
||||
MessageInfos: file_category_proto_msgTypes,
|
||||
}.Build()
|
||||
File_category_proto = out.File
|
||||
file_category_proto_goTypes = nil
|
||||
file_category_proto_depIdxs = nil
|
||||
}
|
|
@ -0,0 +1,241 @@
|
|||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.5.1
|
||||
// - protoc v6.30.1
|
||||
// source: category.proto
|
||||
|
||||
package content
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.64.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
Category_CategoryList_FullMethodName = "/content.Category/CategoryList"
|
||||
Category_AddCategory_FullMethodName = "/content.Category/AddCategory"
|
||||
Category_ModifyCategory_FullMethodName = "/content.Category/ModifyCategory"
|
||||
Category_DeleteCategory_FullMethodName = "/content.Category/DeleteCategory"
|
||||
)
|
||||
|
||||
// CategoryClient is the client API for Category 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.
|
||||
//
|
||||
// 系统分类
|
||||
type CategoryClient interface {
|
||||
// 分类列表
|
||||
CategoryList(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*CategoryListReply, error)
|
||||
AddCategory(ctx context.Context, in *AddCategoryRequest, opts ...grpc.CallOption) (*AddCategoryResponse, error)
|
||||
ModifyCategory(ctx context.Context, in *ModifyCategoryRequest, opts ...grpc.CallOption) (*Empty, error)
|
||||
DeleteCategory(ctx context.Context, in *DeleteCategoryRequest, opts ...grpc.CallOption) (*Empty, error)
|
||||
}
|
||||
|
||||
type categoryClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewCategoryClient(cc grpc.ClientConnInterface) CategoryClient {
|
||||
return &categoryClient{cc}
|
||||
}
|
||||
|
||||
func (c *categoryClient) CategoryList(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*CategoryListReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(CategoryListReply)
|
||||
err := c.cc.Invoke(ctx, Category_CategoryList_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *categoryClient) AddCategory(ctx context.Context, in *AddCategoryRequest, opts ...grpc.CallOption) (*AddCategoryResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(AddCategoryResponse)
|
||||
err := c.cc.Invoke(ctx, Category_AddCategory_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *categoryClient) ModifyCategory(ctx context.Context, in *ModifyCategoryRequest, opts ...grpc.CallOption) (*Empty, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(Empty)
|
||||
err := c.cc.Invoke(ctx, Category_ModifyCategory_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *categoryClient) DeleteCategory(ctx context.Context, in *DeleteCategoryRequest, opts ...grpc.CallOption) (*Empty, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(Empty)
|
||||
err := c.cc.Invoke(ctx, Category_DeleteCategory_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// CategoryServer is the server API for Category service.
|
||||
// All implementations must embed UnimplementedCategoryServer
|
||||
// for forward compatibility.
|
||||
//
|
||||
// 系统分类
|
||||
type CategoryServer interface {
|
||||
// 分类列表
|
||||
CategoryList(context.Context, *Empty) (*CategoryListReply, error)
|
||||
AddCategory(context.Context, *AddCategoryRequest) (*AddCategoryResponse, error)
|
||||
ModifyCategory(context.Context, *ModifyCategoryRequest) (*Empty, error)
|
||||
DeleteCategory(context.Context, *DeleteCategoryRequest) (*Empty, error)
|
||||
mustEmbedUnimplementedCategoryServer()
|
||||
}
|
||||
|
||||
// UnimplementedCategoryServer must be embedded to have
|
||||
// forward compatible implementations.
|
||||
//
|
||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedCategoryServer struct{}
|
||||
|
||||
func (UnimplementedCategoryServer) CategoryList(context.Context, *Empty) (*CategoryListReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CategoryList not implemented")
|
||||
}
|
||||
func (UnimplementedCategoryServer) AddCategory(context.Context, *AddCategoryRequest) (*AddCategoryResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method AddCategory not implemented")
|
||||
}
|
||||
func (UnimplementedCategoryServer) ModifyCategory(context.Context, *ModifyCategoryRequest) (*Empty, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ModifyCategory not implemented")
|
||||
}
|
||||
func (UnimplementedCategoryServer) DeleteCategory(context.Context, *DeleteCategoryRequest) (*Empty, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DeleteCategory not implemented")
|
||||
}
|
||||
func (UnimplementedCategoryServer) mustEmbedUnimplementedCategoryServer() {}
|
||||
func (UnimplementedCategoryServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeCategoryServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to CategoryServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeCategoryServer interface {
|
||||
mustEmbedUnimplementedCategoryServer()
|
||||
}
|
||||
|
||||
func RegisterCategoryServer(s grpc.ServiceRegistrar, srv CategoryServer) {
|
||||
// If the following call pancis, it indicates UnimplementedCategoryServer was
|
||||
// embedded by pointer and is nil. This will cause panics if an
|
||||
// unimplemented method is ever invoked, so we test this at initialization
|
||||
// time to prevent it from happening at runtime later due to I/O.
|
||||
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||
t.testEmbeddedByValue()
|
||||
}
|
||||
s.RegisterService(&Category_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _Category_CategoryList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(Empty)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(CategoryServer).CategoryList(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Category_CategoryList_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(CategoryServer).CategoryList(ctx, req.(*Empty))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Category_AddCategory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(AddCategoryRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(CategoryServer).AddCategory(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Category_AddCategory_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(CategoryServer).AddCategory(ctx, req.(*AddCategoryRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Category_ModifyCategory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ModifyCategoryRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(CategoryServer).ModifyCategory(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Category_ModifyCategory_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(CategoryServer).ModifyCategory(ctx, req.(*ModifyCategoryRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Category_DeleteCategory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DeleteCategoryRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(CategoryServer).DeleteCategory(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Category_DeleteCategory_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(CategoryServer).DeleteCategory(ctx, req.(*DeleteCategoryRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Category_ServiceDesc is the grpc.ServiceDesc for Category service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var Category_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "content.Category",
|
||||
HandlerType: (*CategoryServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "CategoryList",
|
||||
Handler: _Category_CategoryList_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "AddCategory",
|
||||
Handler: _Category_AddCategory_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ModifyCategory",
|
||||
Handler: _Category_ModifyCategory_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DeleteCategory",
|
||||
Handler: _Category_DeleteCategory_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "category.proto",
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,759 @@
|
|||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.5.1
|
||||
// - protoc v6.30.1
|
||||
// source: post.proto
|
||||
|
||||
package content
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.64.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
Post_PostList_FullMethodName = "/content.Post/PostList"
|
||||
Post_GetPost_FullMethodName = "/content.Post/GetPost"
|
||||
Post_AddPost_FullMethodName = "/content.Post/AddPost"
|
||||
Post_ModifyPost_FullMethodName = "/content.Post/ModifyPost"
|
||||
Post_DeletePost_FullMethodName = "/content.Post/DeletePost"
|
||||
Post_IncrPostLike_FullMethodName = "/content.Post/IncrPostLike"
|
||||
Post_DescPostLike_FullMethodName = "/content.Post/DescPostLike"
|
||||
Post_IncrPostUnlike_FullMethodName = "/content.Post/IncrPostUnlike"
|
||||
Post_DescPostUnlike_FullMethodName = "/content.Post/DescPostUnlike"
|
||||
Post_CommentList_FullMethodName = "/content.Post/CommentList"
|
||||
Post_AddComment_FullMethodName = "/content.Post/AddComment"
|
||||
Post_ModifyComment_FullMethodName = "/content.Post/ModifyComment"
|
||||
Post_DeleteComment_FullMethodName = "/content.Post/DeleteComment"
|
||||
Post_IncrCommentLike_FullMethodName = "/content.Post/IncrCommentLike"
|
||||
Post_DescCommentLike_FullMethodName = "/content.Post/DescCommentLike"
|
||||
Post_IncrCommentUnlike_FullMethodName = "/content.Post/IncrCommentUnlike"
|
||||
Post_DescCommentUnlike_FullMethodName = "/content.Post/DescCommentUnlike"
|
||||
)
|
||||
|
||||
// PostClient is the client API for Post 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.
|
||||
//
|
||||
// 正文
|
||||
type PostClient interface {
|
||||
// 文章列表
|
||||
PostList(ctx context.Context, in *PostListRequest, opts ...grpc.CallOption) (*PostListReply, error)
|
||||
// 获取文章详情
|
||||
GetPost(ctx context.Context, in *GetPostRequest, opts ...grpc.CallOption) (*PostItem, error)
|
||||
// 发布文章
|
||||
AddPost(ctx context.Context, in *PostItem, opts ...grpc.CallOption) (*StatusReply, error)
|
||||
// 修改文章
|
||||
ModifyPost(ctx context.Context, in *PostItem, opts ...grpc.CallOption) (*StatusReply, error)
|
||||
// 删除文章
|
||||
DeletePost(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error)
|
||||
// 文章点赞处理
|
||||
IncrPostLike(ctx context.Context, in *PostOpIdentityRequest, opts ...grpc.CallOption) (*StatusReply, error)
|
||||
DescPostLike(ctx context.Context, in *PostOpIdentityRequest, opts ...grpc.CallOption) (*StatusReply, error)
|
||||
// 文章点踩处理
|
||||
IncrPostUnlike(ctx context.Context, in *PostOpIdentityRequest, opts ...grpc.CallOption) (*StatusReply, error)
|
||||
DescPostUnlike(ctx context.Context, in *PostOpIdentityRequest, opts ...grpc.CallOption) (*StatusReply, error)
|
||||
// 评论列表
|
||||
CommentList(ctx context.Context, in *CommentListRequest, opts ...grpc.CallOption) (*CommentListResponse, error)
|
||||
// 发布评论
|
||||
AddComment(ctx context.Context, in *CommentItem, opts ...grpc.CallOption) (*StatusReply, error)
|
||||
// 修改评论
|
||||
ModifyComment(ctx context.Context, in *CommentItem, opts ...grpc.CallOption) (*StatusReply, error)
|
||||
// 删除评论
|
||||
DeleteComment(ctx context.Context, in *DeleteCommentRequest, opts ...grpc.CallOption) (*StatusReply, error)
|
||||
// 评论点赞处理
|
||||
IncrCommentLike(ctx context.Context, in *CommentOpIdentityRequest, opts ...grpc.CallOption) (*StatusReply, error)
|
||||
DescCommentLike(ctx context.Context, in *CommentOpIdentityRequest, opts ...grpc.CallOption) (*StatusReply, error)
|
||||
// 评论点踩处理
|
||||
IncrCommentUnlike(ctx context.Context, in *CommentOpIdentityRequest, opts ...grpc.CallOption) (*StatusReply, error)
|
||||
DescCommentUnlike(ctx context.Context, in *CommentOpIdentityRequest, opts ...grpc.CallOption) (*StatusReply, error)
|
||||
}
|
||||
|
||||
type postClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewPostClient(cc grpc.ClientConnInterface) PostClient {
|
||||
return &postClient{cc}
|
||||
}
|
||||
|
||||
func (c *postClient) PostList(ctx context.Context, in *PostListRequest, opts ...grpc.CallOption) (*PostListReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(PostListReply)
|
||||
err := c.cc.Invoke(ctx, Post_PostList_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *postClient) GetPost(ctx context.Context, in *GetPostRequest, opts ...grpc.CallOption) (*PostItem, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(PostItem)
|
||||
err := c.cc.Invoke(ctx, Post_GetPost_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *postClient) AddPost(ctx context.Context, in *PostItem, opts ...grpc.CallOption) (*StatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(StatusReply)
|
||||
err := c.cc.Invoke(ctx, Post_AddPost_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *postClient) ModifyPost(ctx context.Context, in *PostItem, opts ...grpc.CallOption) (*StatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(StatusReply)
|
||||
err := c.cc.Invoke(ctx, Post_ModifyPost_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *postClient) DeletePost(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(StatusReply)
|
||||
err := c.cc.Invoke(ctx, Post_DeletePost_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *postClient) IncrPostLike(ctx context.Context, in *PostOpIdentityRequest, opts ...grpc.CallOption) (*StatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(StatusReply)
|
||||
err := c.cc.Invoke(ctx, Post_IncrPostLike_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *postClient) DescPostLike(ctx context.Context, in *PostOpIdentityRequest, opts ...grpc.CallOption) (*StatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(StatusReply)
|
||||
err := c.cc.Invoke(ctx, Post_DescPostLike_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *postClient) IncrPostUnlike(ctx context.Context, in *PostOpIdentityRequest, opts ...grpc.CallOption) (*StatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(StatusReply)
|
||||
err := c.cc.Invoke(ctx, Post_IncrPostUnlike_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *postClient) DescPostUnlike(ctx context.Context, in *PostOpIdentityRequest, opts ...grpc.CallOption) (*StatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(StatusReply)
|
||||
err := c.cc.Invoke(ctx, Post_DescPostUnlike_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *postClient) CommentList(ctx context.Context, in *CommentListRequest, opts ...grpc.CallOption) (*CommentListResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(CommentListResponse)
|
||||
err := c.cc.Invoke(ctx, Post_CommentList_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *postClient) AddComment(ctx context.Context, in *CommentItem, opts ...grpc.CallOption) (*StatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(StatusReply)
|
||||
err := c.cc.Invoke(ctx, Post_AddComment_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *postClient) ModifyComment(ctx context.Context, in *CommentItem, opts ...grpc.CallOption) (*StatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(StatusReply)
|
||||
err := c.cc.Invoke(ctx, Post_ModifyComment_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *postClient) DeleteComment(ctx context.Context, in *DeleteCommentRequest, opts ...grpc.CallOption) (*StatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(StatusReply)
|
||||
err := c.cc.Invoke(ctx, Post_DeleteComment_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *postClient) IncrCommentLike(ctx context.Context, in *CommentOpIdentityRequest, opts ...grpc.CallOption) (*StatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(StatusReply)
|
||||
err := c.cc.Invoke(ctx, Post_IncrCommentLike_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *postClient) DescCommentLike(ctx context.Context, in *CommentOpIdentityRequest, opts ...grpc.CallOption) (*StatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(StatusReply)
|
||||
err := c.cc.Invoke(ctx, Post_DescCommentLike_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *postClient) IncrCommentUnlike(ctx context.Context, in *CommentOpIdentityRequest, opts ...grpc.CallOption) (*StatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(StatusReply)
|
||||
err := c.cc.Invoke(ctx, Post_IncrCommentUnlike_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *postClient) DescCommentUnlike(ctx context.Context, in *CommentOpIdentityRequest, opts ...grpc.CallOption) (*StatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(StatusReply)
|
||||
err := c.cc.Invoke(ctx, Post_DescCommentUnlike_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// PostServer is the server API for Post service.
|
||||
// All implementations must embed UnimplementedPostServer
|
||||
// for forward compatibility.
|
||||
//
|
||||
// 正文
|
||||
type PostServer interface {
|
||||
// 文章列表
|
||||
PostList(context.Context, *PostListRequest) (*PostListReply, error)
|
||||
// 获取文章详情
|
||||
GetPost(context.Context, *GetPostRequest) (*PostItem, error)
|
||||
// 发布文章
|
||||
AddPost(context.Context, *PostItem) (*StatusReply, error)
|
||||
// 修改文章
|
||||
ModifyPost(context.Context, *PostItem) (*StatusReply, error)
|
||||
// 删除文章
|
||||
DeletePost(context.Context, *IdentRequest) (*StatusReply, error)
|
||||
// 文章点赞处理
|
||||
IncrPostLike(context.Context, *PostOpIdentityRequest) (*StatusReply, error)
|
||||
DescPostLike(context.Context, *PostOpIdentityRequest) (*StatusReply, error)
|
||||
// 文章点踩处理
|
||||
IncrPostUnlike(context.Context, *PostOpIdentityRequest) (*StatusReply, error)
|
||||
DescPostUnlike(context.Context, *PostOpIdentityRequest) (*StatusReply, error)
|
||||
// 评论列表
|
||||
CommentList(context.Context, *CommentListRequest) (*CommentListResponse, error)
|
||||
// 发布评论
|
||||
AddComment(context.Context, *CommentItem) (*StatusReply, error)
|
||||
// 修改评论
|
||||
ModifyComment(context.Context, *CommentItem) (*StatusReply, error)
|
||||
// 删除评论
|
||||
DeleteComment(context.Context, *DeleteCommentRequest) (*StatusReply, error)
|
||||
// 评论点赞处理
|
||||
IncrCommentLike(context.Context, *CommentOpIdentityRequest) (*StatusReply, error)
|
||||
DescCommentLike(context.Context, *CommentOpIdentityRequest) (*StatusReply, error)
|
||||
// 评论点踩处理
|
||||
IncrCommentUnlike(context.Context, *CommentOpIdentityRequest) (*StatusReply, error)
|
||||
DescCommentUnlike(context.Context, *CommentOpIdentityRequest) (*StatusReply, error)
|
||||
mustEmbedUnimplementedPostServer()
|
||||
}
|
||||
|
||||
// UnimplementedPostServer must be embedded to have
|
||||
// forward compatible implementations.
|
||||
//
|
||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedPostServer struct{}
|
||||
|
||||
func (UnimplementedPostServer) PostList(context.Context, *PostListRequest) (*PostListReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method PostList not implemented")
|
||||
}
|
||||
func (UnimplementedPostServer) GetPost(context.Context, *GetPostRequest) (*PostItem, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetPost not implemented")
|
||||
}
|
||||
func (UnimplementedPostServer) AddPost(context.Context, *PostItem) (*StatusReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method AddPost not implemented")
|
||||
}
|
||||
func (UnimplementedPostServer) ModifyPost(context.Context, *PostItem) (*StatusReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ModifyPost not implemented")
|
||||
}
|
||||
func (UnimplementedPostServer) DeletePost(context.Context, *IdentRequest) (*StatusReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DeletePost not implemented")
|
||||
}
|
||||
func (UnimplementedPostServer) IncrPostLike(context.Context, *PostOpIdentityRequest) (*StatusReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method IncrPostLike not implemented")
|
||||
}
|
||||
func (UnimplementedPostServer) DescPostLike(context.Context, *PostOpIdentityRequest) (*StatusReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DescPostLike not implemented")
|
||||
}
|
||||
func (UnimplementedPostServer) IncrPostUnlike(context.Context, *PostOpIdentityRequest) (*StatusReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method IncrPostUnlike not implemented")
|
||||
}
|
||||
func (UnimplementedPostServer) DescPostUnlike(context.Context, *PostOpIdentityRequest) (*StatusReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DescPostUnlike not implemented")
|
||||
}
|
||||
func (UnimplementedPostServer) CommentList(context.Context, *CommentListRequest) (*CommentListResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CommentList not implemented")
|
||||
}
|
||||
func (UnimplementedPostServer) AddComment(context.Context, *CommentItem) (*StatusReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method AddComment not implemented")
|
||||
}
|
||||
func (UnimplementedPostServer) ModifyComment(context.Context, *CommentItem) (*StatusReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ModifyComment not implemented")
|
||||
}
|
||||
func (UnimplementedPostServer) DeleteComment(context.Context, *DeleteCommentRequest) (*StatusReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DeleteComment not implemented")
|
||||
}
|
||||
func (UnimplementedPostServer) IncrCommentLike(context.Context, *CommentOpIdentityRequest) (*StatusReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method IncrCommentLike not implemented")
|
||||
}
|
||||
func (UnimplementedPostServer) DescCommentLike(context.Context, *CommentOpIdentityRequest) (*StatusReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DescCommentLike not implemented")
|
||||
}
|
||||
func (UnimplementedPostServer) IncrCommentUnlike(context.Context, *CommentOpIdentityRequest) (*StatusReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method IncrCommentUnlike not implemented")
|
||||
}
|
||||
func (UnimplementedPostServer) DescCommentUnlike(context.Context, *CommentOpIdentityRequest) (*StatusReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DescCommentUnlike not implemented")
|
||||
}
|
||||
func (UnimplementedPostServer) mustEmbedUnimplementedPostServer() {}
|
||||
func (UnimplementedPostServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafePostServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to PostServer will
|
||||
// result in compilation errors.
|
||||
type UnsafePostServer interface {
|
||||
mustEmbedUnimplementedPostServer()
|
||||
}
|
||||
|
||||
func RegisterPostServer(s grpc.ServiceRegistrar, srv PostServer) {
|
||||
// If the following call pancis, it indicates UnimplementedPostServer was
|
||||
// embedded by pointer and is nil. This will cause panics if an
|
||||
// unimplemented method is ever invoked, so we test this at initialization
|
||||
// time to prevent it from happening at runtime later due to I/O.
|
||||
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||
t.testEmbeddedByValue()
|
||||
}
|
||||
s.RegisterService(&Post_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _Post_PostList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(PostListRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PostServer).PostList(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Post_PostList_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PostServer).PostList(ctx, req.(*PostListRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Post_GetPost_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetPostRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PostServer).GetPost(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Post_GetPost_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PostServer).GetPost(ctx, req.(*GetPostRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Post_AddPost_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(PostItem)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PostServer).AddPost(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Post_AddPost_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PostServer).AddPost(ctx, req.(*PostItem))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Post_ModifyPost_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(PostItem)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PostServer).ModifyPost(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Post_ModifyPost_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PostServer).ModifyPost(ctx, req.(*PostItem))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Post_DeletePost_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(IdentRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PostServer).DeletePost(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Post_DeletePost_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PostServer).DeletePost(ctx, req.(*IdentRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Post_IncrPostLike_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(PostOpIdentityRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PostServer).IncrPostLike(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Post_IncrPostLike_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PostServer).IncrPostLike(ctx, req.(*PostOpIdentityRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Post_DescPostLike_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(PostOpIdentityRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PostServer).DescPostLike(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Post_DescPostLike_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PostServer).DescPostLike(ctx, req.(*PostOpIdentityRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Post_IncrPostUnlike_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(PostOpIdentityRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PostServer).IncrPostUnlike(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Post_IncrPostUnlike_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PostServer).IncrPostUnlike(ctx, req.(*PostOpIdentityRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Post_DescPostUnlike_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(PostOpIdentityRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PostServer).DescPostUnlike(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Post_DescPostUnlike_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PostServer).DescPostUnlike(ctx, req.(*PostOpIdentityRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Post_CommentList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CommentListRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PostServer).CommentList(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Post_CommentList_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PostServer).CommentList(ctx, req.(*CommentListRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Post_AddComment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CommentItem)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PostServer).AddComment(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Post_AddComment_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PostServer).AddComment(ctx, req.(*CommentItem))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Post_ModifyComment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CommentItem)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PostServer).ModifyComment(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Post_ModifyComment_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PostServer).ModifyComment(ctx, req.(*CommentItem))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Post_DeleteComment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DeleteCommentRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PostServer).DeleteComment(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Post_DeleteComment_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PostServer).DeleteComment(ctx, req.(*DeleteCommentRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Post_IncrCommentLike_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CommentOpIdentityRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PostServer).IncrCommentLike(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Post_IncrCommentLike_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PostServer).IncrCommentLike(ctx, req.(*CommentOpIdentityRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Post_DescCommentLike_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CommentOpIdentityRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PostServer).DescCommentLike(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Post_DescCommentLike_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PostServer).DescCommentLike(ctx, req.(*CommentOpIdentityRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Post_IncrCommentUnlike_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CommentOpIdentityRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PostServer).IncrCommentUnlike(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Post_IncrCommentUnlike_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PostServer).IncrCommentUnlike(ctx, req.(*CommentOpIdentityRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Post_DescCommentUnlike_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CommentOpIdentityRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PostServer).DescCommentUnlike(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Post_DescCommentUnlike_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PostServer).DescCommentUnlike(ctx, req.(*CommentOpIdentityRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Post_ServiceDesc is the grpc.ServiceDesc for Post service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var Post_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "content.Post",
|
||||
HandlerType: (*PostServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "PostList",
|
||||
Handler: _Post_PostList_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetPost",
|
||||
Handler: _Post_GetPost_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "AddPost",
|
||||
Handler: _Post_AddPost_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ModifyPost",
|
||||
Handler: _Post_ModifyPost_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DeletePost",
|
||||
Handler: _Post_DeletePost_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "IncrPostLike",
|
||||
Handler: _Post_IncrPostLike_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DescPostLike",
|
||||
Handler: _Post_DescPostLike_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "IncrPostUnlike",
|
||||
Handler: _Post_IncrPostUnlike_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DescPostUnlike",
|
||||
Handler: _Post_DescPostUnlike_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CommentList",
|
||||
Handler: _Post_CommentList_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "AddComment",
|
||||
Handler: _Post_AddComment_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ModifyComment",
|
||||
Handler: _Post_ModifyComment_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DeleteComment",
|
||||
Handler: _Post_DeleteComment_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "IncrCommentLike",
|
||||
Handler: _Post_IncrCommentLike_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DescCommentLike",
|
||||
Handler: _Post_DescCommentLike_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "IncrCommentUnlike",
|
||||
Handler: _Post_IncrCommentUnlike_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DescCommentUnlike",
|
||||
Handler: _Post_DescCommentUnlike_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "post.proto",
|
||||
}
|
|
@ -0,0 +1,247 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.6
|
||||
// protoc v6.30.1
|
||||
// source: tags.proto
|
||||
|
||||
package content
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
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)
|
||||
)
|
||||
|
||||
// 无限极标签
|
||||
type TagsItem struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Identity string `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"`
|
||||
ParentIdentity string `protobuf:"bytes,2,opt,name=parent_identity,json=parentIdentity,proto3" json:"parent_identity,omitempty"` // 为空表示顶级主题
|
||||
Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"`
|
||||
CoverPath string `protobuf:"bytes,4,opt,name=cover_path,json=coverPath,proto3" json:"cover_path,omitempty"`
|
||||
Intro string `protobuf:"bytes,5,opt,name=intro,proto3" json:"intro,omitempty"`
|
||||
List []*TagsItem `protobuf:"bytes,9,rep,name=list,proto3" json:"list,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *TagsItem) Reset() {
|
||||
*x = TagsItem{}
|
||||
mi := &file_tags_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *TagsItem) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*TagsItem) ProtoMessage() {}
|
||||
|
||||
func (x *TagsItem) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_tags_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use TagsItem.ProtoReflect.Descriptor instead.
|
||||
func (*TagsItem) Descriptor() ([]byte, []int) {
|
||||
return file_tags_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *TagsItem) GetIdentity() string {
|
||||
if x != nil {
|
||||
return x.Identity
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *TagsItem) GetParentIdentity() string {
|
||||
if x != nil {
|
||||
return x.ParentIdentity
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *TagsItem) GetTitle() string {
|
||||
if x != nil {
|
||||
return x.Title
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *TagsItem) GetCoverPath() string {
|
||||
if x != nil {
|
||||
return x.CoverPath
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *TagsItem) GetIntro() string {
|
||||
if x != nil {
|
||||
return x.Intro
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *TagsItem) GetList() []*TagsItem {
|
||||
if x != nil {
|
||||
return x.List
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type TagsListReply struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
List []*TagsItem `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"`
|
||||
Count int64 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *TagsListReply) Reset() {
|
||||
*x = TagsListReply{}
|
||||
mi := &file_tags_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *TagsListReply) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*TagsListReply) ProtoMessage() {}
|
||||
|
||||
func (x *TagsListReply) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_tags_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use TagsListReply.ProtoReflect.Descriptor instead.
|
||||
func (*TagsListReply) Descriptor() ([]byte, []int) {
|
||||
return file_tags_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *TagsListReply) GetList() []*TagsItem {
|
||||
if x != nil {
|
||||
return x.List
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *TagsListReply) GetCount() int64 {
|
||||
if x != nil {
|
||||
return x.Count
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
var File_tags_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_tags_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
"tags.proto\x12\acontent\x1a\fblocks.proto\"\xc1\x01\n" +
|
||||
"\bTagsItem\x12\x1a\n" +
|
||||
"\bidentity\x18\x01 \x01(\tR\bidentity\x12'\n" +
|
||||
"\x0fparent_identity\x18\x02 \x01(\tR\x0eparentIdentity\x12\x14\n" +
|
||||
"\x05title\x18\x03 \x01(\tR\x05title\x12\x1d\n" +
|
||||
"\n" +
|
||||
"cover_path\x18\x04 \x01(\tR\tcoverPath\x12\x14\n" +
|
||||
"\x05intro\x18\x05 \x01(\tR\x05intro\x12%\n" +
|
||||
"\x04list\x18\t \x03(\v2\x11.content.TagsItemR\x04list\"L\n" +
|
||||
"\rTagsListReply\x12%\n" +
|
||||
"\x04list\x18\x01 \x03(\v2\x11.content.TagsItemR\x04list\x12\x14\n" +
|
||||
"\x05count\x18\x02 \x01(\x03R\x05count2\xef\x01\n" +
|
||||
"\x04Tags\x12;\n" +
|
||||
"\bTagsList\x12\x15.content.IdentRequest\x1a\x16.content.TagsListReply\"\x00\x124\n" +
|
||||
"\aAddTags\x12\x11.content.TagsItem\x1a\x14.content.StatusReply\"\x00\x127\n" +
|
||||
"\n" +
|
||||
"ModifyTags\x12\x11.content.TagsItem\x1a\x14.content.StatusReply\"\x00\x12;\n" +
|
||||
"\n" +
|
||||
"DeleteTags\x12\x15.content.IdentRequest\x1a\x14.content.StatusReply\"\x00B\fZ\n" +
|
||||
"./;contentb\x06proto3"
|
||||
|
||||
var (
|
||||
file_tags_proto_rawDescOnce sync.Once
|
||||
file_tags_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_tags_proto_rawDescGZIP() []byte {
|
||||
file_tags_proto_rawDescOnce.Do(func() {
|
||||
file_tags_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tags_proto_rawDesc), len(file_tags_proto_rawDesc)))
|
||||
})
|
||||
return file_tags_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_tags_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_tags_proto_goTypes = []any{
|
||||
(*TagsItem)(nil), // 0: content.TagsItem
|
||||
(*TagsListReply)(nil), // 1: content.TagsListReply
|
||||
(*IdentRequest)(nil), // 2: content.IdentRequest
|
||||
(*StatusReply)(nil), // 3: content.StatusReply
|
||||
}
|
||||
var file_tags_proto_depIdxs = []int32{
|
||||
0, // 0: content.TagsItem.list:type_name -> content.TagsItem
|
||||
0, // 1: content.TagsListReply.list:type_name -> content.TagsItem
|
||||
2, // 2: content.Tags.TagsList:input_type -> content.IdentRequest
|
||||
0, // 3: content.Tags.AddTags:input_type -> content.TagsItem
|
||||
0, // 4: content.Tags.ModifyTags:input_type -> content.TagsItem
|
||||
2, // 5: content.Tags.DeleteTags:input_type -> content.IdentRequest
|
||||
1, // 6: content.Tags.TagsList:output_type -> content.TagsListReply
|
||||
3, // 7: content.Tags.AddTags:output_type -> content.StatusReply
|
||||
3, // 8: content.Tags.ModifyTags:output_type -> content.StatusReply
|
||||
3, // 9: content.Tags.DeleteTags:output_type -> content.StatusReply
|
||||
6, // [6:10] is the sub-list for method output_type
|
||||
2, // [2:6] is the sub-list for method input_type
|
||||
2, // [2:2] is the sub-list for extension type_name
|
||||
2, // [2:2] is the sub-list for extension extendee
|
||||
0, // [0:2] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_tags_proto_init() }
|
||||
func file_tags_proto_init() {
|
||||
if File_tags_proto != nil {
|
||||
return
|
||||
}
|
||||
file_blocks_proto_init()
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_tags_proto_rawDesc), len(file_tags_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 2,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_tags_proto_goTypes,
|
||||
DependencyIndexes: file_tags_proto_depIdxs,
|
||||
MessageInfos: file_tags_proto_msgTypes,
|
||||
}.Build()
|
||||
File_tags_proto = out.File
|
||||
file_tags_proto_goTypes = nil
|
||||
file_tags_proto_depIdxs = nil
|
||||
}
|
|
@ -0,0 +1,247 @@
|
|||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.5.1
|
||||
// - protoc v6.30.1
|
||||
// source: tags.proto
|
||||
|
||||
package content
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.64.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
Tags_TagsList_FullMethodName = "/content.Tags/TagsList"
|
||||
Tags_AddTags_FullMethodName = "/content.Tags/AddTags"
|
||||
Tags_ModifyTags_FullMethodName = "/content.Tags/ModifyTags"
|
||||
Tags_DeleteTags_FullMethodName = "/content.Tags/DeleteTags"
|
||||
)
|
||||
|
||||
// TagsClient is the client API for Tags 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.
|
||||
//
|
||||
// 标签
|
||||
type TagsClient interface {
|
||||
// 标签列表
|
||||
TagsList(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*TagsListReply, error)
|
||||
// 创建标签
|
||||
AddTags(ctx context.Context, in *TagsItem, opts ...grpc.CallOption) (*StatusReply, error)
|
||||
// 修改标签
|
||||
ModifyTags(ctx context.Context, in *TagsItem, opts ...grpc.CallOption) (*StatusReply, error)
|
||||
// 删除标签
|
||||
DeleteTags(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error)
|
||||
}
|
||||
|
||||
type tagsClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewTagsClient(cc grpc.ClientConnInterface) TagsClient {
|
||||
return &tagsClient{cc}
|
||||
}
|
||||
|
||||
func (c *tagsClient) TagsList(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*TagsListReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(TagsListReply)
|
||||
err := c.cc.Invoke(ctx, Tags_TagsList_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *tagsClient) AddTags(ctx context.Context, in *TagsItem, opts ...grpc.CallOption) (*StatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(StatusReply)
|
||||
err := c.cc.Invoke(ctx, Tags_AddTags_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *tagsClient) ModifyTags(ctx context.Context, in *TagsItem, opts ...grpc.CallOption) (*StatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(StatusReply)
|
||||
err := c.cc.Invoke(ctx, Tags_ModifyTags_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *tagsClient) DeleteTags(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(StatusReply)
|
||||
err := c.cc.Invoke(ctx, Tags_DeleteTags_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// TagsServer is the server API for Tags service.
|
||||
// All implementations must embed UnimplementedTagsServer
|
||||
// for forward compatibility.
|
||||
//
|
||||
// 标签
|
||||
type TagsServer interface {
|
||||
// 标签列表
|
||||
TagsList(context.Context, *IdentRequest) (*TagsListReply, error)
|
||||
// 创建标签
|
||||
AddTags(context.Context, *TagsItem) (*StatusReply, error)
|
||||
// 修改标签
|
||||
ModifyTags(context.Context, *TagsItem) (*StatusReply, error)
|
||||
// 删除标签
|
||||
DeleteTags(context.Context, *IdentRequest) (*StatusReply, error)
|
||||
mustEmbedUnimplementedTagsServer()
|
||||
}
|
||||
|
||||
// UnimplementedTagsServer must be embedded to have
|
||||
// forward compatible implementations.
|
||||
//
|
||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedTagsServer struct{}
|
||||
|
||||
func (UnimplementedTagsServer) TagsList(context.Context, *IdentRequest) (*TagsListReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method TagsList not implemented")
|
||||
}
|
||||
func (UnimplementedTagsServer) AddTags(context.Context, *TagsItem) (*StatusReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method AddTags not implemented")
|
||||
}
|
||||
func (UnimplementedTagsServer) ModifyTags(context.Context, *TagsItem) (*StatusReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ModifyTags not implemented")
|
||||
}
|
||||
func (UnimplementedTagsServer) DeleteTags(context.Context, *IdentRequest) (*StatusReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DeleteTags not implemented")
|
||||
}
|
||||
func (UnimplementedTagsServer) mustEmbedUnimplementedTagsServer() {}
|
||||
func (UnimplementedTagsServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeTagsServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to TagsServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeTagsServer interface {
|
||||
mustEmbedUnimplementedTagsServer()
|
||||
}
|
||||
|
||||
func RegisterTagsServer(s grpc.ServiceRegistrar, srv TagsServer) {
|
||||
// If the following call pancis, it indicates UnimplementedTagsServer was
|
||||
// embedded by pointer and is nil. This will cause panics if an
|
||||
// unimplemented method is ever invoked, so we test this at initialization
|
||||
// time to prevent it from happening at runtime later due to I/O.
|
||||
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||
t.testEmbeddedByValue()
|
||||
}
|
||||
s.RegisterService(&Tags_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _Tags_TagsList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(IdentRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(TagsServer).TagsList(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Tags_TagsList_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(TagsServer).TagsList(ctx, req.(*IdentRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Tags_AddTags_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(TagsItem)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(TagsServer).AddTags(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Tags_AddTags_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(TagsServer).AddTags(ctx, req.(*TagsItem))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Tags_ModifyTags_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(TagsItem)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(TagsServer).ModifyTags(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Tags_ModifyTags_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(TagsServer).ModifyTags(ctx, req.(*TagsItem))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Tags_DeleteTags_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(IdentRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(TagsServer).DeleteTags(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Tags_DeleteTags_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(TagsServer).DeleteTags(ctx, req.(*IdentRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Tags_ServiceDesc is the grpc.ServiceDesc for Tags service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var Tags_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "content.Tags",
|
||||
HandlerType: (*TagsServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "TagsList",
|
||||
Handler: _Tags_TagsList_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "AddTags",
|
||||
Handler: _Tags_AddTags_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ModifyTags",
|
||||
Handler: _Tags_ModifyTags_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DeleteTags",
|
||||
Handler: _Tags_DeleteTags_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "tags.proto",
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
syntax = "proto3";
|
||||
package content;
|
||||
option go_package = "./;content";
|
||||
|
||||
message FetchRequest {
|
||||
int64 page_no=1; // 页数
|
||||
int64 page_size=2; // 每页记录数
|
||||
map<string,string> params=3; // 条件参数,key=val,eg key:category_id=?,vlaue=11
|
||||
}
|
||||
|
||||
message IdentRequest{
|
||||
int64 id = 1; // 唯一ID
|
||||
string identity = 2; // 唯一码
|
||||
}
|
||||
|
||||
message VersionRequest {
|
||||
int64 version=1; // 时序版本号
|
||||
}
|
||||
|
||||
|
||||
message SearchRequest {
|
||||
string keyword=1; //关键词
|
||||
}
|
||||
|
||||
|
||||
message StatusReply{
|
||||
int64 status = 1; // 状态码
|
||||
string identity=2; // 标识码
|
||||
string message=3; //状态说明
|
||||
int64 timeseq=4; // 响应时间序列
|
||||
}
|
||||
|
||||
message Empty{
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
syntax = "proto3";
|
||||
package content;
|
||||
option go_package = "./;content";
|
||||
import "blocks.proto";
|
||||
|
||||
// 系统分类
|
||||
service Category {
|
||||
//分类列表
|
||||
rpc CategoryList (Empty) returns (CategoryListReply) {};
|
||||
rpc AddCategory (AddCategoryRequest) returns (AddCategoryResponse) {};
|
||||
rpc ModifyCategory (ModifyCategoryRequest) returns (Empty) {};
|
||||
rpc DeleteCategory (DeleteCategoryRequest) returns (Empty) {};
|
||||
}
|
||||
|
||||
// 无限极分类
|
||||
message CategoryItem{
|
||||
string identity = 1;
|
||||
string parent_identity = 2; // 为空表示顶级分类
|
||||
string title = 3;
|
||||
string cover_path = 4;
|
||||
string intro=5;
|
||||
string created_at = 6;
|
||||
string updated_at = 7;
|
||||
repeated CategoryItem data = 8;
|
||||
}
|
||||
|
||||
message CategoryListReply {
|
||||
repeated CategoryItem data = 1;
|
||||
int64 count = 2;
|
||||
}
|
||||
|
||||
message AddCategoryResponse{
|
||||
string identity = 1; // 新增数据的唯一码
|
||||
}
|
||||
|
||||
message AddCategoryRequest{
|
||||
string identity = 1; //
|
||||
string parent_identity = 2; // 为空表示顶级分类
|
||||
string title = 3;
|
||||
string cover_path = 4;
|
||||
string intro=5;
|
||||
string created_at = 6;
|
||||
string updated_at = 7;
|
||||
repeated CategoryItem data = 8;
|
||||
}
|
||||
message ModifyCategoryRequest{
|
||||
string identity = 1; //
|
||||
string parent_identity = 2; // 为空表示顶级分类
|
||||
string title = 3;
|
||||
string cover_path = 4;
|
||||
string intro=5;
|
||||
string created_at = 6;
|
||||
string updated_at = 7;
|
||||
repeated CategoryItem data = 8;
|
||||
}
|
||||
|
||||
message DeleteCategoryRequest{
|
||||
string identity = 1; //
|
||||
}
|
|
@ -0,0 +1,133 @@
|
|||
syntax = "proto3";
|
||||
package content;
|
||||
option go_package = "./;content";
|
||||
import "blocks.proto";
|
||||
|
||||
// 正文
|
||||
service Post{
|
||||
//文章列表
|
||||
rpc PostList(PostListRequest) returns (PostListReply) {};
|
||||
|
||||
//获取文章详情
|
||||
rpc GetPost (GetPostRequest) returns (PostItem) {};
|
||||
|
||||
//发布文章
|
||||
rpc AddPost(PostItem) returns (StatusReply) {};
|
||||
|
||||
//修改文章
|
||||
rpc ModifyPost(PostItem) returns (StatusReply) {};
|
||||
|
||||
//删除文章
|
||||
rpc DeletePost(IdentRequest) returns (StatusReply) {};
|
||||
|
||||
// 文章点赞处理
|
||||
rpc IncrPostLike(PostOpIdentityRequest) returns (StatusReply) {};
|
||||
rpc DescPostLike(PostOpIdentityRequest) returns (StatusReply) {};
|
||||
|
||||
// 文章点踩处理
|
||||
rpc IncrPostUnlike(PostOpIdentityRequest) returns (StatusReply) {};
|
||||
rpc DescPostUnlike(PostOpIdentityRequest) returns (StatusReply) {};
|
||||
|
||||
//评论列表
|
||||
rpc CommentList(CommentListRequest) returns (CommentListResponse) {};
|
||||
|
||||
//发布评论
|
||||
rpc AddComment(CommentItem) returns (StatusReply) {};
|
||||
|
||||
//修改评论
|
||||
rpc ModifyComment(CommentItem) returns (StatusReply) {};
|
||||
|
||||
//删除评论
|
||||
rpc DeleteComment(DeleteCommentRequest) returns (StatusReply) {};
|
||||
|
||||
// 评论点赞处理
|
||||
rpc IncrCommentLike(CommentOpIdentityRequest) returns (StatusReply) {};
|
||||
rpc DescCommentLike(CommentOpIdentityRequest) returns (StatusReply) {};
|
||||
|
||||
// 评论点踩处理
|
||||
rpc IncrCommentUnlike(CommentOpIdentityRequest) returns (StatusReply) {};
|
||||
rpc DescCommentUnlike(CommentOpIdentityRequest) returns (StatusReply) {};
|
||||
}
|
||||
message DeleteCommentRequest{
|
||||
string identity = 1; // 需要删除的评论的唯一标识
|
||||
string post_identity = 2; // 文章唯一标识
|
||||
}
|
||||
message PostItem{
|
||||
string identity = 1; // 文章唯一标识
|
||||
int64 passport_id =2; // 作者ID
|
||||
string passport_identity =3; // 作者唯一标识
|
||||
repeated string category_identity_list = 4; //所属分类Identity 列表
|
||||
repeated string tags_identity_list = 5; // 标签集
|
||||
string title = 6;
|
||||
string cover_path = 7; //封面
|
||||
string author = 8;
|
||||
string content = 9;
|
||||
string target_url = 10;// 跳转目标地址
|
||||
string source_url = 11; // 文章来源地址
|
||||
int64 hits = 12; //点击量
|
||||
repeated string accessory = 13; //附件列表
|
||||
bool has_accessory = 14;//是否有附件,默认没有
|
||||
string created_at=15;
|
||||
string updated_at=16;
|
||||
string description = 17;//简介
|
||||
int64 like_hits = 18; //点赞量
|
||||
int64 unlike_hits = 19; //点踩量
|
||||
int64 comment_hits = 20; //评论量
|
||||
int32 type = 22;// 用户自定义文章类型
|
||||
string rights=23; //权限
|
||||
}
|
||||
|
||||
|
||||
message PostListRequest{
|
||||
int64 page = 1; // 页码,默认第一页
|
||||
int64 size = 2; // 单页显示数量,默认10,最多50
|
||||
string author_identity = 3; //发布者唯一标识,可选
|
||||
string category_identity = 4; // 文章类型,可选
|
||||
string keyword = 5;// 根据文章名称模糊查找
|
||||
int32 type = 6;// 根据用户自定义文章类型过滤,可选,默认0,全部查找
|
||||
|
||||
}
|
||||
message PostListReply{
|
||||
repeated PostItem data = 1;
|
||||
int64 count = 2;
|
||||
}
|
||||
|
||||
message GetPostRequest {
|
||||
string identity = 1; // 必传
|
||||
string author_identity = 2; // 必传
|
||||
}
|
||||
|
||||
message CommentItem {
|
||||
string identity = 1;
|
||||
string Post_identity = 2;
|
||||
string parent_identity = 3;
|
||||
string content = 4;
|
||||
string reply_identity = 5;// 回复者唯一 标识
|
||||
string created_at = 6;
|
||||
string updated_at = 7;
|
||||
repeated CommentItem list = 8;//回复列表
|
||||
int64 like_hits = 9; //点赞量
|
||||
int64 unlike_hits = 10; //点踩量
|
||||
int64 comment_hits = 11; //评论量
|
||||
}
|
||||
|
||||
message CommentListRequest{
|
||||
string Post_identity = 1;//必填
|
||||
int64 page = 2; // 页码,默认第一页
|
||||
int64 size = 3; // 单页显示数量,默认10,最多50
|
||||
}
|
||||
|
||||
message CommentListResponse{
|
||||
repeated CommentItem list =1;
|
||||
int64 count = 2;
|
||||
}
|
||||
|
||||
message PostOpIdentityRequest{
|
||||
string post_identity = 1; //必传
|
||||
string op_identity = 2; // 必传
|
||||
}
|
||||
|
||||
message CommentOpIdentityRequest{
|
||||
string comment_identity = 1; //必填
|
||||
string op_identity = 2;//必填
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
syntax = "proto3";
|
||||
package content;
|
||||
option go_package = "./;content";
|
||||
import "blocks.proto";
|
||||
|
||||
// 标签
|
||||
service Tags {
|
||||
//标签列表
|
||||
rpc TagsList (IdentRequest) returns (TagsListReply) {};
|
||||
|
||||
//创建标签
|
||||
rpc AddTags(TagsItem) returns (StatusReply) {};
|
||||
|
||||
//修改标签
|
||||
rpc ModifyTags(TagsItem) returns (StatusReply) {};
|
||||
|
||||
//删除标签
|
||||
rpc DeleteTags(IdentRequest) returns (StatusReply) {};
|
||||
}
|
||||
|
||||
// 无限极标签
|
||||
message TagsItem{
|
||||
string identity = 1;
|
||||
string parent_identity = 2; // 为空表示顶级主题
|
||||
string title = 3;
|
||||
string cover_path = 4;
|
||||
string intro=5;
|
||||
repeated TagsItem list = 9;
|
||||
}
|
||||
|
||||
message TagsListReply {
|
||||
repeated TagsItem list = 1;
|
||||
int64 count = 2;
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
// Code generated by protoc-gen-slc. DO NOT EDIT.
|
||||
package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
"protoc-gen-slc/internal/logic/category"
|
||||
pb "protoc-gen-slc/pb"
|
||||
)
|
||||
|
||||
type CategoryServer struct {
|
||||
pb.UnimplementedCategoryServer
|
||||
}
|
||||
|
||||
func NewCategoryServer() *CategoryServer {
|
||||
return &CategoryServer{}
|
||||
}
|
||||
|
||||
// 分类列表
|
||||
func (s *CategoryServer) CategoryList(ctx context.Context, in *pb.Empty) (*pb.CategoryListReply, error) {
|
||||
return category.CategoryList(ctx, in)
|
||||
}
|
||||
|
||||
func (s *CategoryServer) AddCategory(ctx context.Context, in *pb.AddCategoryRequest) (*pb.AddCategoryResponse, error) {
|
||||
return category.AddCategory(ctx, in)
|
||||
}
|
||||
|
||||
func (s *CategoryServer) ModifyCategory(ctx context.Context, in *pb.ModifyCategoryRequest) (*pb.Empty, error) {
|
||||
return category.ModifyCategory(ctx, in)
|
||||
}
|
||||
|
||||
func (s *CategoryServer) DeleteCategory(ctx context.Context, in *pb.DeleteCategoryRequest) (*pb.Empty, error) {
|
||||
return category.DeleteCategory(ctx, in)
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
// Code generated by protoc-gen-slc. DO NOT EDIT.
|
||||
package server
|
||||
|
||||
import (
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/reflection"
|
||||
pb "protoc-gen-slc/pb"
|
||||
)
|
||||
|
||||
func New() *grpc.Server {
|
||||
srv := grpc.NewServer()
|
||||
|
||||
// register service to grpc.Server
|
||||
pb.RegisterCategoryServer(srv, NewCategoryServer())
|
||||
pb.RegisterPostServer(srv, NewPostServer())
|
||||
pb.RegisterTagsServer(srv, NewTagsServer())
|
||||
|
||||
reflection.Register(srv)
|
||||
|
||||
return srv
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
// Code generated by protoc-gen-slc. DO NOT EDIT.
|
||||
package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
"protoc-gen-slc/internal/logic/post"
|
||||
pb "protoc-gen-slc/pb"
|
||||
)
|
||||
|
||||
type PostServer struct {
|
||||
pb.UnimplementedPostServer
|
||||
}
|
||||
|
||||
func NewPostServer() *PostServer {
|
||||
return &PostServer{}
|
||||
}
|
||||
|
||||
// 文章列表
|
||||
func (s *PostServer) PostList(ctx context.Context, in *pb.PostListRequest) (*pb.PostListReply, error) {
|
||||
return post.PostList(ctx, in)
|
||||
}
|
||||
|
||||
// 获取文章详情
|
||||
func (s *PostServer) GetPost(ctx context.Context, in *pb.GetPostRequest) (*pb.PostItem, error) {
|
||||
return post.GetPost(ctx, in)
|
||||
}
|
||||
|
||||
// 发布文章
|
||||
func (s *PostServer) AddPost(ctx context.Context, in *pb.PostItem) (*pb.StatusReply, error) {
|
||||
return post.AddPost(ctx, in)
|
||||
}
|
||||
|
||||
// 修改文章
|
||||
func (s *PostServer) ModifyPost(ctx context.Context, in *pb.PostItem) (*pb.StatusReply, error) {
|
||||
return post.ModifyPost(ctx, in)
|
||||
}
|
||||
|
||||
// 删除文章
|
||||
func (s *PostServer) DeletePost(ctx context.Context, in *pb.IdentRequest) (*pb.StatusReply, error) {
|
||||
return post.DeletePost(ctx, in)
|
||||
}
|
||||
|
||||
// 文章点赞处理
|
||||
func (s *PostServer) IncrPostLike(ctx context.Context, in *pb.PostOpIdentityRequest) (*pb.StatusReply, error) {
|
||||
return post.IncrPostLike(ctx, in)
|
||||
}
|
||||
|
||||
func (s *PostServer) DescPostLike(ctx context.Context, in *pb.PostOpIdentityRequest) (*pb.StatusReply, error) {
|
||||
return post.DescPostLike(ctx, in)
|
||||
}
|
||||
|
||||
// 文章点踩处理
|
||||
func (s *PostServer) IncrPostUnlike(ctx context.Context, in *pb.PostOpIdentityRequest) (*pb.StatusReply, error) {
|
||||
return post.IncrPostUnlike(ctx, in)
|
||||
}
|
||||
|
||||
func (s *PostServer) DescPostUnlike(ctx context.Context, in *pb.PostOpIdentityRequest) (*pb.StatusReply, error) {
|
||||
return post.DescPostUnlike(ctx, in)
|
||||
}
|
||||
|
||||
// 评论列表
|
||||
func (s *PostServer) CommentList(ctx context.Context, in *pb.CommentListRequest) (*pb.CommentListResponse, error) {
|
||||
return post.CommentList(ctx, in)
|
||||
}
|
||||
|
||||
// 发布评论
|
||||
func (s *PostServer) AddComment(ctx context.Context, in *pb.CommentItem) (*pb.StatusReply, error) {
|
||||
return post.AddComment(ctx, in)
|
||||
}
|
||||
|
||||
// 修改评论
|
||||
func (s *PostServer) ModifyComment(ctx context.Context, in *pb.CommentItem) (*pb.StatusReply, error) {
|
||||
return post.ModifyComment(ctx, in)
|
||||
}
|
||||
|
||||
// 删除评论
|
||||
func (s *PostServer) DeleteComment(ctx context.Context, in *pb.DeleteCommentRequest) (*pb.StatusReply, error) {
|
||||
return post.DeleteComment(ctx, in)
|
||||
}
|
||||
|
||||
// 评论点赞处理
|
||||
func (s *PostServer) IncrCommentLike(ctx context.Context, in *pb.CommentOpIdentityRequest) (*pb.StatusReply, error) {
|
||||
return post.IncrCommentLike(ctx, in)
|
||||
}
|
||||
|
||||
func (s *PostServer) DescCommentLike(ctx context.Context, in *pb.CommentOpIdentityRequest) (*pb.StatusReply, error) {
|
||||
return post.DescCommentLike(ctx, in)
|
||||
}
|
||||
|
||||
// 评论点踩处理
|
||||
func (s *PostServer) IncrCommentUnlike(ctx context.Context, in *pb.CommentOpIdentityRequest) (*pb.StatusReply, error) {
|
||||
return post.IncrCommentUnlike(ctx, in)
|
||||
}
|
||||
|
||||
func (s *PostServer) DescCommentUnlike(ctx context.Context, in *pb.CommentOpIdentityRequest) (*pb.StatusReply, error) {
|
||||
return post.DescCommentUnlike(ctx, in)
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
// Code generated by protoc-gen-slc. DO NOT EDIT.
|
||||
package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
"protoc-gen-slc/internal/logic/tags"
|
||||
pb "protoc-gen-slc/pb"
|
||||
)
|
||||
|
||||
type TagsServer struct {
|
||||
pb.UnimplementedTagsServer
|
||||
}
|
||||
|
||||
func NewTagsServer() *TagsServer {
|
||||
return &TagsServer{}
|
||||
}
|
||||
|
||||
// 标签列表
|
||||
func (s *TagsServer) TagsList(ctx context.Context, in *pb.IdentRequest) (*pb.TagsListReply, error) {
|
||||
return tags.TagsList(ctx, in)
|
||||
}
|
||||
|
||||
// 创建标签
|
||||
func (s *TagsServer) AddTags(ctx context.Context, in *pb.TagsItem) (*pb.StatusReply, error) {
|
||||
return tags.AddTags(ctx, in)
|
||||
}
|
||||
|
||||
// 修改标签
|
||||
func (s *TagsServer) ModifyTags(ctx context.Context, in *pb.TagsItem) (*pb.StatusReply, error) {
|
||||
return tags.ModifyTags(ctx, in)
|
||||
}
|
||||
|
||||
// 删除标签
|
||||
func (s *TagsServer) DeleteTags(ctx context.Context, in *pb.IdentRequest) (*pb.StatusReply, error) {
|
||||
return tags.DeleteTags(ctx, in)
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package tpl
|
||||
|
||||
var NewFile = `
|
||||
// Code generated by protoc-gen-slc. DO NOT EDIT.
|
||||
package server
|
||||
|
||||
import (
|
||||
{import}
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/reflection"
|
||||
)
|
||||
|
||||
func New() *grpc.Server {
|
||||
srv := grpc.NewServer()
|
||||
|
||||
// register service to grpc.Server
|
||||
{register}
|
||||
|
||||
reflection.Register(srv)
|
||||
|
||||
return srv
|
||||
}
|
||||
|
||||
`
|
||||
|
||||
var Server = `
|
||||
// Code generated by protoc-gen-slc. DO NOT EDIT.
|
||||
package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
{import}
|
||||
)
|
||||
|
||||
type {service}Server struct {
|
||||
pb.Unimplemented{service}Server
|
||||
}
|
||||
|
||||
func New{service}Server() *{service}Server {
|
||||
return &{service}Server{}
|
||||
}
|
||||
|
||||
{method}
|
||||
`
|
||||
var Method = `
|
||||
{comment}
|
||||
func (s *{service}Server) {func}(ctx context.Context,in *pb.{input}) (*pb.{output},error) {
|
||||
return {serviceLower}.{func}(ctx, in)
|
||||
}
|
||||
`
|
Loading…
Reference in New Issue