feat: import services and standardize Go 1.26.5

This commit is contained in:
2026-08-09 10:43:45 +08:00
parent 689c74b28f
commit 86024fa81d
1456 changed files with 220765 additions and 2 deletions

View File

@@ -0,0 +1,750 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc (unknown)
// source: blocks.proto
package cms
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,proto3" json:"page_no,omitempty"` // 页数
PageSize int64 `protobuf:"varint,2,opt,name=page_size,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"` //<必传>, 关键词
PageNo int64 `protobuf:"varint,2,opt,name=page_no,proto3" json:"page_no,omitempty"` // 页数
PageSize int64 `protobuf:"varint,3,opt,name=page_size,proto3" json:"page_size,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 ""
}
func (x *SearchRequest) GetPageNo() int64 {
if x != nil {
return x.PageNo
}
return 0
}
func (x *SearchRequest) GetPageSize() int64 {
if x != nil {
return x.PageSize
}
return 0
}
type StatusReply struct {
state protoimpl.MessageState `protogen:"open.v1"`
Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` // 状态码
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` // 状态说明
Details string `protobuf:"bytes,3,opt,name=details,proto3" json:"details,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) GetCode() int32 {
if x != nil {
return x.Code
}
return 0
}
func (x *StatusReply) GetMessage() string {
if x != nil {
return x.Message
}
return ""
}
func (x *StatusReply) GetDetails() string {
if x != nil {
return x.Details
}
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}
}
// 分类
type CategoryItem struct {
state protoimpl.MessageState `protogen:"open.v1"`
SiteIdentity string `protobuf:"bytes,1,opt,name=site_identity,proto3" json:"site_identity,omitempty"`
Id int64 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"`
Identity string `protobuf:"bytes,3,opt,name=identity,proto3" json:"identity,omitempty"` // 唯一标识
ParentId int64 `protobuf:"varint,4,opt,name=parent_id,proto3" json:"parent_id,omitempty"` // 为空表示顶级分类
Title string `protobuf:"bytes,5,opt,name=title,proto3" json:"title,omitempty"` // 标题
CoverPath string `protobuf:"bytes,6,opt,name=cover_path,proto3" json:"cover_path,omitempty"` // 封面图片
Intro string `protobuf:"bytes,7,opt,name=intro,proto3" json:"intro,omitempty"` // 简介
CreatedAt string `protobuf:"bytes,8,opt,name=created_at,proto3" json:"created_at,omitempty"` // 创建时间
UpdatedAt string `protobuf:"bytes,9,opt,name=updated_at,proto3" json:"updated_at,omitempty"` // 更新时间
Child []*CategoryItem `protobuf:"bytes,10,rep,name=child,proto3" json:"child,omitempty"` // 子集
CategoryKey string `protobuf:"bytes,11,opt,name=category_key,proto3" json:"category_key,omitempty"` // 分类标识
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CategoryItem) Reset() {
*x = CategoryItem{}
mi := &file_blocks_proto_msgTypes[6]
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_blocks_proto_msgTypes[6]
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_blocks_proto_rawDescGZIP(), []int{6}
}
func (x *CategoryItem) GetSiteIdentity() string {
if x != nil {
return x.SiteIdentity
}
return ""
}
func (x *CategoryItem) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *CategoryItem) GetIdentity() string {
if x != nil {
return x.Identity
}
return ""
}
func (x *CategoryItem) GetParentId() int64 {
if x != nil {
return x.ParentId
}
return 0
}
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) GetChild() []*CategoryItem {
if x != nil {
return x.Child
}
return nil
}
func (x *CategoryItem) GetCategoryKey() string {
if x != nil {
return x.CategoryKey
}
return ""
}
// 标签
type TagsItem struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Identity string `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"` // 唯一标识
Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"` // 标题
CoverPath string `protobuf:"bytes,4,opt,name=cover_path,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,proto3" json:"created_at,omitempty"` //创建时间
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *TagsItem) Reset() {
*x = TagsItem{}
mi := &file_blocks_proto_msgTypes[7]
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_blocks_proto_msgTypes[7]
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_blocks_proto_rawDescGZIP(), []int{7}
}
func (x *TagsItem) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *TagsItem) GetIdentity() string {
if x != nil {
return x.Identity
}
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) GetCreatedAt() string {
if x != nil {
return x.CreatedAt
}
return ""
}
// 附件
type AccessoryItem struct {
state protoimpl.MessageState `protogen:"open.v1"`
Identity string `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` // 唯一标识
Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` // 附件标题
FilePath string `protobuf:"bytes,3,opt,name=file_path,proto3" json:"file_path,omitempty"` // 附件文件路径
CreatedAt string `protobuf:"bytes,4,opt,name=created_at,proto3" json:"created_at,omitempty"` //创建时间
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *AccessoryItem) Reset() {
*x = AccessoryItem{}
mi := &file_blocks_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *AccessoryItem) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AccessoryItem) ProtoMessage() {}
func (x *AccessoryItem) ProtoReflect() protoreflect.Message {
mi := &file_blocks_proto_msgTypes[8]
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 AccessoryItem.ProtoReflect.Descriptor instead.
func (*AccessoryItem) Descriptor() ([]byte, []int) {
return file_blocks_proto_rawDescGZIP(), []int{8}
}
func (x *AccessoryItem) GetIdentity() string {
if x != nil {
return x.Identity
}
return ""
}
func (x *AccessoryItem) GetTitle() string {
if x != nil {
return x.Title
}
return ""
}
func (x *AccessoryItem) GetFilePath() string {
if x != nil {
return x.FilePath
}
return ""
}
func (x *AccessoryItem) GetCreatedAt() string {
if x != nil {
return x.CreatedAt
}
return ""
}
var File_blocks_proto protoreflect.FileDescriptor
const file_blocks_proto_rawDesc = "" +
"\n" +
"\x10cms/blocks.proto\x12\x03cms\"\xb8\x01\n" +
"\fFetchRequest\x12\x18\n" +
"\apage_no\x18\x01 \x01(\x03R\apage_no\x12\x1c\n" +
"\tpage_size\x18\x02 \x01(\x03R\tpage_size\x125\n" +
"\x06params\x18\x03 \x03(\v2\x1d.cms.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\"a\n" +
"\rSearchRequest\x12\x18\n" +
"\akeyword\x18\x01 \x01(\tR\akeyword\x12\x18\n" +
"\apage_no\x18\x02 \x01(\x03R\apage_no\x12\x1c\n" +
"\tpage_size\x18\x03 \x01(\x03R\tpage_size\"o\n" +
"\vStatusReply\x12\x12\n" +
"\x04code\x18\x01 \x01(\x05R\x04code\x12\x18\n" +
"\amessage\x18\x02 \x01(\tR\amessage\x12\x18\n" +
"\adetails\x18\x03 \x01(\tR\adetails\x12\x18\n" +
"\atimeseq\x18\x04 \x01(\x03R\atimeseq\"\a\n" +
"\x05Empty\"\xd7\x02\n" +
"\fCategoryItem\x12$\n" +
"\rsite_identity\x18\x01 \x01(\tR\rsite_identity\x12\x0e\n" +
"\x02id\x18\x02 \x01(\x03R\x02id\x12\x1a\n" +
"\bidentity\x18\x03 \x01(\tR\bidentity\x12\x1c\n" +
"\tparent_id\x18\x04 \x01(\x03R\tparent_id\x12\x14\n" +
"\x05title\x18\x05 \x01(\tR\x05title\x12\x1e\n" +
"\n" +
"cover_path\x18\x06 \x01(\tR\n" +
"cover_path\x12\x14\n" +
"\x05intro\x18\a \x01(\tR\x05intro\x12\x1e\n" +
"\n" +
"created_at\x18\b \x01(\tR\n" +
"created_at\x12\x1e\n" +
"\n" +
"updated_at\x18\t \x01(\tR\n" +
"updated_at\x12'\n" +
"\x05child\x18\n" +
" \x03(\v2\x11.cms.CategoryItemR\x05child\x12\"\n" +
"\fcategory_key\x18\v \x01(\tR\fcategory_key\"\xa2\x01\n" +
"\bTagsItem\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x1a\n" +
"\bidentity\x18\x02 \x01(\tR\bidentity\x12\x14\n" +
"\x05title\x18\x03 \x01(\tR\x05title\x12\x1e\n" +
"\n" +
"cover_path\x18\x04 \x01(\tR\n" +
"cover_path\x12\x14\n" +
"\x05intro\x18\x05 \x01(\tR\x05intro\x12\x1e\n" +
"\n" +
"created_at\x18\x06 \x01(\tR\n" +
"created_at\"\x7f\n" +
"\rAccessoryItem\x12\x1a\n" +
"\bidentity\x18\x01 \x01(\tR\bidentity\x12\x14\n" +
"\x05title\x18\x02 \x01(\tR\x05title\x12\x1c\n" +
"\tfile_path\x18\x03 \x01(\tR\tfile_path\x12\x1e\n" +
"\n" +
"created_at\x18\x04 \x01(\tR\n" +
"created_atB\aZ\x05.;cmsb\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, 10)
var file_blocks_proto_goTypes = []any{
(*FetchRequest)(nil), // 0: cms.FetchRequest
(*IdentRequest)(nil), // 1: cms.IdentRequest
(*VersionRequest)(nil), // 2: cms.VersionRequest
(*SearchRequest)(nil), // 3: cms.SearchRequest
(*StatusReply)(nil), // 4: cms.StatusReply
(*Empty)(nil), // 5: cms.Empty
(*CategoryItem)(nil), // 6: cms.CategoryItem
(*TagsItem)(nil), // 7: cms.TagsItem
(*AccessoryItem)(nil), // 8: cms.AccessoryItem
nil, // 9: cms.FetchRequest.ParamsEntry
}
var file_blocks_proto_depIdxs = []int32{
9, // 0: cms.FetchRequest.params:type_name -> cms.FetchRequest.ParamsEntry
6, // 1: cms.CategoryItem.child:type_name -> cms.CategoryItem
2, // [2:2] is the sub-list for method output_type
2, // [2:2] 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_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: 10,
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
}

View File

@@ -0,0 +1,560 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc (unknown)
// source: category.proto
package cms
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 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[0]
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[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 CategoryListReply.ProtoReflect.Descriptor instead.
func (*CategoryListReply) Descriptor() ([]byte, []int) {
return file_category_proto_rawDescGZIP(), []int{0}
}
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[1]
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[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 AddCategoryResponse.ProtoReflect.Descriptor instead.
func (*AddCategoryResponse) Descriptor() ([]byte, []int) {
return file_category_proto_rawDescGZIP(), []int{1}
}
func (x *AddCategoryResponse) GetIdentity() string {
if x != nil {
return x.Identity
}
return ""
}
// 添加分类请求
type AddCategoryRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
SiteIdentity string `protobuf:"bytes,1,opt,name=site_identity,proto3" json:"site_identity,omitempty"`
Identity string `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"` // 添加分类请求唯一码
ParentId int64 `protobuf:"varint,3,opt,name=parent_id,proto3" json:"parent_id,omitempty"` // 为空表示顶级分类
Title string `protobuf:"bytes,4,opt,name=title,proto3" json:"title,omitempty"` // 标题
CoverPath string `protobuf:"bytes,5,opt,name=cover_path,proto3" json:"cover_path,omitempty"` // 封面图片
Intro string `protobuf:"bytes,6,opt,name=intro,proto3" json:"intro,omitempty"` // 简介
CreatedAt string `protobuf:"bytes,7,opt,name=created_at,proto3" json:"created_at,omitempty"` // 创建时间
UpdatedAt string `protobuf:"bytes,8,opt,name=updated_at,proto3" json:"updated_at,omitempty"` // 更新时间
Data []*CategoryItem `protobuf:"bytes,9,rep,name=data,proto3" json:"data,omitempty"` // 子集
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *AddCategoryRequest) Reset() {
*x = AddCategoryRequest{}
mi := &file_category_proto_msgTypes[2]
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[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 AddCategoryRequest.ProtoReflect.Descriptor instead.
func (*AddCategoryRequest) Descriptor() ([]byte, []int) {
return file_category_proto_rawDescGZIP(), []int{2}
}
func (x *AddCategoryRequest) GetSiteIdentity() string {
if x != nil {
return x.SiteIdentity
}
return ""
}
func (x *AddCategoryRequest) GetIdentity() string {
if x != nil {
return x.Identity
}
return ""
}
func (x *AddCategoryRequest) GetParentId() int64 {
if x != nil {
return x.ParentId
}
return 0
}
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"`
SiteIdentity string `protobuf:"bytes,1,opt,name=site_identity,proto3" json:"site_identity,omitempty"`
Identity string `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"` // 修改分类请求唯一标识
ParentId int64 `protobuf:"varint,3,opt,name=parent_id,proto3" json:"parent_id,omitempty"` // 为空表示顶级分类
Title string `protobuf:"bytes,4,opt,name=title,proto3" json:"title,omitempty"` // 标题
CoverPath string `protobuf:"bytes,5,opt,name=cover_path,proto3" json:"cover_path,omitempty"` // 封面图片
Intro string `protobuf:"bytes,6,opt,name=intro,proto3" json:"intro,omitempty"` // 简介
CreatedAt string `protobuf:"bytes,7,opt,name=created_at,proto3" json:"created_at,omitempty"` // 创建时间
UpdatedAt string `protobuf:"bytes,8,opt,name=updated_at,proto3" json:"updated_at,omitempty"` // 更新时间
Data []*CategoryItem `protobuf:"bytes,9,rep,name=data,proto3" json:"data,omitempty"` // 子集
CategoryKey string `protobuf:"bytes,10,opt,name=category_key,proto3" json:"category_key,omitempty"` // 分类标识
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ModifyCategoryRequest) Reset() {
*x = ModifyCategoryRequest{}
mi := &file_category_proto_msgTypes[3]
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[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 ModifyCategoryRequest.ProtoReflect.Descriptor instead.
func (*ModifyCategoryRequest) Descriptor() ([]byte, []int) {
return file_category_proto_rawDescGZIP(), []int{3}
}
func (x *ModifyCategoryRequest) GetSiteIdentity() string {
if x != nil {
return x.SiteIdentity
}
return ""
}
func (x *ModifyCategoryRequest) GetIdentity() string {
if x != nil {
return x.Identity
}
return ""
}
func (x *ModifyCategoryRequest) GetParentId() int64 {
if x != nil {
return x.ParentId
}
return 0
}
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
}
func (x *ModifyCategoryRequest) GetCategoryKey() string {
if x != nil {
return x.CategoryKey
}
return ""
}
// 删除分类请求
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[4]
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[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 DeleteCategoryRequest.ProtoReflect.Descriptor instead.
func (*DeleteCategoryRequest) Descriptor() ([]byte, []int) {
return file_category_proto_rawDescGZIP(), []int{4}
}
func (x *DeleteCategoryRequest) GetIdentity() string {
if x != nil {
return x.Identity
}
return ""
}
// 关键字分类
type KeywordRequest 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 *KeywordRequest) Reset() {
*x = KeywordRequest{}
mi := &file_category_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *KeywordRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*KeywordRequest) ProtoMessage() {}
func (x *KeywordRequest) 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 KeywordRequest.ProtoReflect.Descriptor instead.
func (*KeywordRequest) Descriptor() ([]byte, []int) {
return file_category_proto_rawDescGZIP(), []int{5}
}
func (x *KeywordRequest) GetKeyword() string {
if x != nil {
return x.Keyword
}
return ""
}
var File_category_proto protoreflect.FileDescriptor
const file_category_proto_rawDesc = "" +
"\n" +
"\x17base/cms/category.proto\x12\x03cms\x1a\x10cms/blocks.proto\"P\n" +
"\x11CategoryListReply\x12%\n" +
"\x04data\x18\x01 \x03(\v2\x11.cms.CategoryItemR\x04data\x12\x14\n" +
"\x05count\x18\x02 \x01(\x03R\x05count\"1\n" +
"\x13AddCategoryResponse\x12\x1a\n" +
"\bidentity\x18\x01 \x01(\tR\bidentity\"\xa7\x02\n" +
"\x12AddCategoryRequest\x12$\n" +
"\rsite_identity\x18\x01 \x01(\tR\rsite_identity\x12\x1a\n" +
"\bidentity\x18\x02 \x01(\tR\bidentity\x12\x1c\n" +
"\tparent_id\x18\x03 \x01(\x03R\tparent_id\x12\x14\n" +
"\x05title\x18\x04 \x01(\tR\x05title\x12\x1e\n" +
"\n" +
"cover_path\x18\x05 \x01(\tR\n" +
"cover_path\x12\x14\n" +
"\x05intro\x18\x06 \x01(\tR\x05intro\x12\x1e\n" +
"\n" +
"created_at\x18\a \x01(\tR\n" +
"created_at\x12\x1e\n" +
"\n" +
"updated_at\x18\b \x01(\tR\n" +
"updated_at\x12%\n" +
"\x04data\x18\t \x03(\v2\x11.cms.CategoryItemR\x04data\"\xce\x02\n" +
"\x15ModifyCategoryRequest\x12$\n" +
"\rsite_identity\x18\x01 \x01(\tR\rsite_identity\x12\x1a\n" +
"\bidentity\x18\x02 \x01(\tR\bidentity\x12\x1c\n" +
"\tparent_id\x18\x03 \x01(\x03R\tparent_id\x12\x14\n" +
"\x05title\x18\x04 \x01(\tR\x05title\x12\x1e\n" +
"\n" +
"cover_path\x18\x05 \x01(\tR\n" +
"cover_path\x12\x14\n" +
"\x05intro\x18\x06 \x01(\tR\x05intro\x12\x1e\n" +
"\n" +
"created_at\x18\a \x01(\tR\n" +
"created_at\x12\x1e\n" +
"\n" +
"updated_at\x18\b \x01(\tR\n" +
"updated_at\x12%\n" +
"\x04data\x18\t \x03(\v2\x11.cms.CategoryItemR\x04data\x12\"\n" +
"\fcategory_key\x18\n" +
" \x01(\tR\fcategory_key\"3\n" +
"\x15DeleteCategoryRequest\x12\x1a\n" +
"\bidentity\x18\x01 \x01(\tR\bidentity\"*\n" +
"\x0eKeywordRequest\x12\x18\n" +
"\akeyword\x18\x01 \x01(\tR\akeyword2\xe5\x01\n" +
"\bCategory\x124\n" +
"\x05Fetch\x12\x11.cms.IdentRequest\x1a\x16.cms.CategoryListReply\"\x00\x12/\n" +
"\x06Create\x12\x11.cms.CategoryItem\x1a\x10.cms.StatusReply\"\x00\x128\n" +
"\x06Modify\x12\x1a.cms.ModifyCategoryRequest\x1a\x10.cms.StatusReply\"\x00\x128\n" +
"\x06Delete\x12\x1a.cms.DeleteCategoryRequest\x1a\x10.cms.StatusReply\"\x00B\aZ\x05.;cmsb\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{
(*CategoryListReply)(nil), // 0: cms.CategoryListReply
(*AddCategoryResponse)(nil), // 1: cms.AddCategoryResponse
(*AddCategoryRequest)(nil), // 2: cms.AddCategoryRequest
(*ModifyCategoryRequest)(nil), // 3: cms.ModifyCategoryRequest
(*DeleteCategoryRequest)(nil), // 4: cms.DeleteCategoryRequest
(*KeywordRequest)(nil), // 5: cms.KeywordRequest
(*CategoryItem)(nil), // 6: cms.CategoryItem
(*IdentRequest)(nil), // 7: cms.IdentRequest
(*StatusReply)(nil), // 8: cms.StatusReply
}
var file_category_proto_depIdxs = []int32{
6, // 0: cms.CategoryListReply.data:type_name -> cms.CategoryItem
6, // 1: cms.AddCategoryRequest.data:type_name -> cms.CategoryItem
6, // 2: cms.ModifyCategoryRequest.data:type_name -> cms.CategoryItem
7, // 3: cms.Category.Fetch:input_type -> cms.IdentRequest
6, // 4: cms.Category.Create:input_type -> cms.CategoryItem
3, // 5: cms.Category.Modify:input_type -> cms.ModifyCategoryRequest
4, // 6: cms.Category.Delete:input_type -> cms.DeleteCategoryRequest
0, // 7: cms.Category.Fetch:output_type -> cms.CategoryListReply
8, // 8: cms.Category.Create:output_type -> cms.StatusReply
8, // 9: cms.Category.Modify:output_type -> cms.StatusReply
8, // 10: cms.Category.Delete:output_type -> cms.StatusReply
7, // [7:11] is the sub-list for method output_type
3, // [3:7] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] 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
}

View File

@@ -0,0 +1,355 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: category.proto
/*
Package cms is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package cms
import (
"context"
"errors"
"io"
"net/http"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
)
// Suppress "imported and not used" errors
var (
_ codes.Code
_ io.Reader
_ status.Status
_ = errors.New
_ = runtime.String
_ = utilities.NewDoubleArray
_ = metadata.Join
)
func request_Category_Fetch_0(ctx context.Context, marshaler runtime.Marshaler, client CategoryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq IdentRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Fetch(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Category_Fetch_0(ctx context.Context, marshaler runtime.Marshaler, server CategoryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq IdentRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Fetch(ctx, &protoReq)
return msg, metadata, err
}
func request_Category_Create_0(ctx context.Context, marshaler runtime.Marshaler, client CategoryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq CategoryItem
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Create(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Category_Create_0(ctx context.Context, marshaler runtime.Marshaler, server CategoryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq CategoryItem
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Create(ctx, &protoReq)
return msg, metadata, err
}
func request_Category_Modify_0(ctx context.Context, marshaler runtime.Marshaler, client CategoryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq ModifyCategoryRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Modify(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Category_Modify_0(ctx context.Context, marshaler runtime.Marshaler, server CategoryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq ModifyCategoryRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Modify(ctx, &protoReq)
return msg, metadata, err
}
func request_Category_Delete_0(ctx context.Context, marshaler runtime.Marshaler, client CategoryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq DeleteCategoryRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Delete(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Category_Delete_0(ctx context.Context, marshaler runtime.Marshaler, server CategoryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq DeleteCategoryRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Delete(ctx, &protoReq)
return msg, metadata, err
}
// RegisterCategoryHandlerServer registers the http handlers for service Category to "mux".
// UnaryRPC :call CategoryServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterCategoryHandlerFromEndpoint instead.
// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
func RegisterCategoryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CategoryServer) error {
mux.Handle(http.MethodPost, pattern_Category_Fetch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/cms.Category/Fetch", runtime.WithHTTPPathPattern("/cms.Category/Fetch"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Category_Fetch_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Category_Fetch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Category_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/cms.Category/Create", runtime.WithHTTPPathPattern("/cms.Category/Create"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Category_Create_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Category_Create_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Category_Modify_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/cms.Category/Modify", runtime.WithHTTPPathPattern("/cms.Category/Modify"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Category_Modify_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Category_Modify_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Category_Delete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/cms.Category/Delete", runtime.WithHTTPPathPattern("/cms.Category/Delete"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Category_Delete_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Category_Delete_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterCategoryHandlerFromEndpoint is same as RegisterCategoryHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterCategoryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.NewClient(endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterCategoryHandler(ctx, mux, conn)
}
// RegisterCategoryHandler registers the http handlers for service Category to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterCategoryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterCategoryHandlerClient(ctx, mux, NewCategoryClient(conn))
}
// RegisterCategoryHandlerClient registers the http handlers for service Category
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "CategoryClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "CategoryClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "CategoryClient" to call the correct interceptors. This client ignores the HTTP middlewares.
func RegisterCategoryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client CategoryClient) error {
mux.Handle(http.MethodPost, pattern_Category_Fetch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/cms.Category/Fetch", runtime.WithHTTPPathPattern("/cms.Category/Fetch"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Category_Fetch_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Category_Fetch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Category_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/cms.Category/Create", runtime.WithHTTPPathPattern("/cms.Category/Create"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Category_Create_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Category_Create_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Category_Modify_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/cms.Category/Modify", runtime.WithHTTPPathPattern("/cms.Category/Modify"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Category_Modify_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Category_Modify_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Category_Delete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/cms.Category/Delete", runtime.WithHTTPPathPattern("/cms.Category/Delete"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Category_Delete_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Category_Delete_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_Category_Fetch_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"cms.Category", "Fetch"}, ""))
pattern_Category_Create_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"cms.Category", "Create"}, ""))
pattern_Category_Modify_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"cms.Category", "Modify"}, ""))
pattern_Category_Delete_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"cms.Category", "Delete"}, ""))
)
var (
forward_Category_Fetch_0 = runtime.ForwardResponseMessage
forward_Category_Create_0 = runtime.ForwardResponseMessage
forward_Category_Modify_0 = runtime.ForwardResponseMessage
forward_Category_Delete_0 = runtime.ForwardResponseMessage
)

View File

@@ -0,0 +1,247 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc (unknown)
// source: category.proto
package cms
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_Fetch_FullMethodName = "/cms.Category/Fetch"
Category_Create_FullMethodName = "/cms.Category/Create"
Category_Modify_FullMethodName = "/cms.Category/Modify"
Category_Delete_FullMethodName = "/cms.Category/Delete"
)
// 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.
//
// CMS - 分类
type CategoryClient interface {
// 分类列表
Fetch(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*CategoryListReply, error)
// 添加分类
Create(ctx context.Context, in *CategoryItem, opts ...grpc.CallOption) (*StatusReply, error)
// 修改分类
Modify(ctx context.Context, in *ModifyCategoryRequest, opts ...grpc.CallOption) (*StatusReply, error)
// 删除分类
Delete(ctx context.Context, in *DeleteCategoryRequest, opts ...grpc.CallOption) (*StatusReply, error)
}
type categoryClient struct {
cc grpc.ClientConnInterface
}
func NewCategoryClient(cc grpc.ClientConnInterface) CategoryClient {
return &categoryClient{cc}
}
func (c *categoryClient) Fetch(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*CategoryListReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CategoryListReply)
err := c.cc.Invoke(ctx, Category_Fetch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *categoryClient) Create(ctx context.Context, in *CategoryItem, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Category_Create_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *categoryClient) Modify(ctx context.Context, in *ModifyCategoryRequest, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Category_Modify_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *categoryClient) Delete(ctx context.Context, in *DeleteCategoryRequest, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Category_Delete_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.
//
// CMS - 分类
type CategoryServer interface {
// 分类列表
Fetch(context.Context, *IdentRequest) (*CategoryListReply, error)
// 添加分类
Create(context.Context, *CategoryItem) (*StatusReply, error)
// 修改分类
Modify(context.Context, *ModifyCategoryRequest) (*StatusReply, error)
// 删除分类
Delete(context.Context, *DeleteCategoryRequest) (*StatusReply, 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) Fetch(context.Context, *IdentRequest) (*CategoryListReply, error) {
return nil, status.Error(codes.Unimplemented, "method Fetch not implemented")
}
func (UnimplementedCategoryServer) Create(context.Context, *CategoryItem) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method Create not implemented")
}
func (UnimplementedCategoryServer) Modify(context.Context, *ModifyCategoryRequest) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method Modify not implemented")
}
func (UnimplementedCategoryServer) Delete(context.Context, *DeleteCategoryRequest) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method Delete 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 panics, 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_Fetch_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.(CategoryServer).Fetch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Category_Fetch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CategoryServer).Fetch(ctx, req.(*IdentRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Category_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CategoryItem)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(CategoryServer).Create(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Category_Create_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CategoryServer).Create(ctx, req.(*CategoryItem))
}
return interceptor(ctx, in, info, handler)
}
func _Category_Modify_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).Modify(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Category_Modify_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CategoryServer).Modify(ctx, req.(*ModifyCategoryRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Category_Delete_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).Delete(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Category_Delete_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CategoryServer).Delete(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: "cms.Category",
HandlerType: (*CategoryServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Fetch",
Handler: _Category_Fetch_Handler,
},
{
MethodName: "Create",
Handler: _Category_Create_Handler,
},
{
MethodName: "Modify",
Handler: _Category_Modify_Handler,
},
{
MethodName: "Delete",
Handler: _Category_Delete_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "category.proto",
}

View File

@@ -0,0 +1,529 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc (unknown)
// source: pages.proto
package cms
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)
)
// 根据KEY获取内容请求
type GetPagesByKeyRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` //<必传> 内容页的key
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetPagesByKeyRequest) Reset() {
*x = GetPagesByKeyRequest{}
mi := &file_pages_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetPagesByKeyRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetPagesByKeyRequest) ProtoMessage() {}
func (x *GetPagesByKeyRequest) ProtoReflect() protoreflect.Message {
mi := &file_pages_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 GetPagesByKeyRequest.ProtoReflect.Descriptor instead.
func (*GetPagesByKeyRequest) Descriptor() ([]byte, []int) {
return file_pages_proto_rawDescGZIP(), []int{0}
}
func (x *GetPagesByKeyRequest) GetKey() string {
if x != nil {
return x.Key
}
return ""
}
// 文章
type PagesItem struct {
state protoimpl.MessageState `protogen:"open.v1"`
SiteIdentity string `protobuf:"bytes,1,opt,name=site_identity,proto3" json:"site_identity,omitempty"`
Identity string `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"` // 文章唯一标识
CreatedAt string `protobuf:"bytes,3,opt,name=created_at,proto3" json:"created_at,omitempty"` // 创建时间
UpdatedAt string `protobuf:"bytes,4,opt,name=updated_at,proto3" json:"updated_at,omitempty"` //更新时间
PostType int32 `protobuf:"varint,5,opt,name=post_type,proto3" json:"post_type,omitempty"` // 用户自定义文章类型
Rights string `protobuf:"bytes,6,opt,name=rights,proto3" json:"rights,omitempty"` //权限
Title string `protobuf:"bytes,7,opt,name=title,proto3" json:"title,omitempty"` // <必传>,标题
Key string `protobuf:"bytes,8,opt,name=key,proto3" json:"key,omitempty"` //<必传> 内容页的key
Description string `protobuf:"bytes,9,opt,name=description,proto3" json:"description,omitempty"` //简介
CoverPath string `protobuf:"bytes,10,opt,name=cover_path,proto3" json:"cover_path,omitempty"` //封面
Content string `protobuf:"bytes,11,opt,name=content,proto3" json:"content,omitempty"` // <必传>,内容
HasAccessory bool `protobuf:"varint,12,opt,name=has_accessory,proto3" json:"has_accessory,omitempty"` //是否有附件,默认没有
AccessoryIdentityArray []string `protobuf:"bytes,13,rep,name=accessory_identity_array,proto3" json:"accessory_identity_array,omitempty"` //附件Identity 列表
AccessoryData []*AccessoryItem `protobuf:"bytes,14,rep,name=accessory_data,proto3" json:"accessory_data,omitempty"` //附件数据
TagsData []*TagsItem `protobuf:"bytes,15,rep,name=tags_data,proto3" json:"tags_data,omitempty"` // 标签数据
TagsIdentityArray []string `protobuf:"bytes,16,rep,name=tags_identity_array,proto3" json:"tags_identity_array,omitempty"` // 标签集Identity 列表
Hits int64 `protobuf:"varint,17,opt,name=hits,proto3" json:"hits,omitempty"` //点击量
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *PagesItem) Reset() {
*x = PagesItem{}
mi := &file_pages_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *PagesItem) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PagesItem) ProtoMessage() {}
func (x *PagesItem) ProtoReflect() protoreflect.Message {
mi := &file_pages_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 PagesItem.ProtoReflect.Descriptor instead.
func (*PagesItem) Descriptor() ([]byte, []int) {
return file_pages_proto_rawDescGZIP(), []int{1}
}
func (x *PagesItem) GetSiteIdentity() string {
if x != nil {
return x.SiteIdentity
}
return ""
}
func (x *PagesItem) GetIdentity() string {
if x != nil {
return x.Identity
}
return ""
}
func (x *PagesItem) GetCreatedAt() string {
if x != nil {
return x.CreatedAt
}
return ""
}
func (x *PagesItem) GetUpdatedAt() string {
if x != nil {
return x.UpdatedAt
}
return ""
}
func (x *PagesItem) GetPostType() int32 {
if x != nil {
return x.PostType
}
return 0
}
func (x *PagesItem) GetRights() string {
if x != nil {
return x.Rights
}
return ""
}
func (x *PagesItem) GetTitle() string {
if x != nil {
return x.Title
}
return ""
}
func (x *PagesItem) GetKey() string {
if x != nil {
return x.Key
}
return ""
}
func (x *PagesItem) GetDescription() string {
if x != nil {
return x.Description
}
return ""
}
func (x *PagesItem) GetCoverPath() string {
if x != nil {
return x.CoverPath
}
return ""
}
func (x *PagesItem) GetContent() string {
if x != nil {
return x.Content
}
return ""
}
func (x *PagesItem) GetHasAccessory() bool {
if x != nil {
return x.HasAccessory
}
return false
}
func (x *PagesItem) GetAccessoryIdentityArray() []string {
if x != nil {
return x.AccessoryIdentityArray
}
return nil
}
func (x *PagesItem) GetAccessoryData() []*AccessoryItem {
if x != nil {
return x.AccessoryData
}
return nil
}
func (x *PagesItem) GetTagsData() []*TagsItem {
if x != nil {
return x.TagsData
}
return nil
}
func (x *PagesItem) GetTagsIdentityArray() []string {
if x != nil {
return x.TagsIdentityArray
}
return nil
}
func (x *PagesItem) GetHits() int64 {
if x != nil {
return x.Hits
}
return 0
}
// 文章列表请求
type PagesListRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` // 页码,默认第一页
Size int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` // 单页显示数量,默认10,最多50
Keyword string `protobuf:"bytes,3,opt,name=keyword,proto3" json:"keyword,omitempty"` // 根据文章名称模糊查找
Type int32 `protobuf:"varint,4,opt,name=type,proto3" json:"type,omitempty"` // 根据用户自定义文章类型过滤,可选,默认0,全部查找
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *PagesListRequest) Reset() {
*x = PagesListRequest{}
mi := &file_pages_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *PagesListRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PagesListRequest) ProtoMessage() {}
func (x *PagesListRequest) ProtoReflect() protoreflect.Message {
mi := &file_pages_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 PagesListRequest.ProtoReflect.Descriptor instead.
func (*PagesListRequest) Descriptor() ([]byte, []int) {
return file_pages_proto_rawDescGZIP(), []int{2}
}
func (x *PagesListRequest) GetPage() int64 {
if x != nil {
return x.Page
}
return 0
}
func (x *PagesListRequest) GetSize() int64 {
if x != nil {
return x.Size
}
return 0
}
func (x *PagesListRequest) GetKeyword() string {
if x != nil {
return x.Keyword
}
return ""
}
func (x *PagesListRequest) GetType() int32 {
if x != nil {
return x.Type
}
return 0
}
// 文章列表回复
type PagesListReply struct {
state protoimpl.MessageState `protogen:"open.v1"`
Data []*PagesItem `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 *PagesListReply) Reset() {
*x = PagesListReply{}
mi := &file_pages_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *PagesListReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PagesListReply) ProtoMessage() {}
func (x *PagesListReply) ProtoReflect() protoreflect.Message {
mi := &file_pages_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 PagesListReply.ProtoReflect.Descriptor instead.
func (*PagesListReply) Descriptor() ([]byte, []int) {
return file_pages_proto_rawDescGZIP(), []int{3}
}
func (x *PagesListReply) GetData() []*PagesItem {
if x != nil {
return x.Data
}
return nil
}
func (x *PagesListReply) GetCount() int64 {
if x != nil {
return x.Count
}
return 0
}
// 获取文章详情请求
type GetPagesRequest 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 *GetPagesRequest) Reset() {
*x = GetPagesRequest{}
mi := &file_pages_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetPagesRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetPagesRequest) ProtoMessage() {}
func (x *GetPagesRequest) ProtoReflect() protoreflect.Message {
mi := &file_pages_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 GetPagesRequest.ProtoReflect.Descriptor instead.
func (*GetPagesRequest) Descriptor() ([]byte, []int) {
return file_pages_proto_rawDescGZIP(), []int{4}
}
func (x *GetPagesRequest) GetIdentity() string {
if x != nil {
return x.Identity
}
return ""
}
var File_pages_proto protoreflect.FileDescriptor
const file_pages_proto_rawDesc = "" +
"\n" +
"\x14base/cms/pages.proto\x12\x03cms\x1a\x10cms/blocks.proto\"(\n" +
"\x14GetPagesByKeyRequest\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\"\xd8\x04\n" +
"\tPagesItem\x12$\n" +
"\rsite_identity\x18\x01 \x01(\tR\rsite_identity\x12\x1a\n" +
"\bidentity\x18\x02 \x01(\tR\bidentity\x12\x1e\n" +
"\n" +
"created_at\x18\x03 \x01(\tR\n" +
"created_at\x12\x1e\n" +
"\n" +
"updated_at\x18\x04 \x01(\tR\n" +
"updated_at\x12\x1c\n" +
"\tpost_type\x18\x05 \x01(\x05R\tpost_type\x12\x16\n" +
"\x06rights\x18\x06 \x01(\tR\x06rights\x12\x14\n" +
"\x05title\x18\a \x01(\tR\x05title\x12\x10\n" +
"\x03key\x18\b \x01(\tR\x03key\x12 \n" +
"\vdescription\x18\t \x01(\tR\vdescription\x12\x1e\n" +
"\n" +
"cover_path\x18\n" +
" \x01(\tR\n" +
"cover_path\x12\x18\n" +
"\acontent\x18\v \x01(\tR\acontent\x12$\n" +
"\rhas_accessory\x18\f \x01(\bR\rhas_accessory\x12:\n" +
"\x18accessory_identity_array\x18\r \x03(\tR\x18accessory_identity_array\x12:\n" +
"\x0eaccessory_data\x18\x0e \x03(\v2\x12.cms.AccessoryItemR\x0eaccessory_data\x12+\n" +
"\ttags_data\x18\x0f \x03(\v2\r.cms.TagsItemR\ttags_data\x120\n" +
"\x13tags_identity_array\x18\x10 \x03(\tR\x13tags_identity_array\x12\x12\n" +
"\x04hits\x18\x11 \x01(\x03R\x04hits\"h\n" +
"\x10PagesListRequest\x12\x12\n" +
"\x04page\x18\x01 \x01(\x03R\x04page\x12\x12\n" +
"\x04size\x18\x02 \x01(\x03R\x04size\x12\x18\n" +
"\akeyword\x18\x03 \x01(\tR\akeyword\x12\x12\n" +
"\x04type\x18\x04 \x01(\x05R\x04type\"J\n" +
"\x0ePagesListReply\x12\"\n" +
"\x04data\x18\x01 \x03(\v2\x0e.cms.PagesItemR\x04data\x12\x14\n" +
"\x05count\x18\x02 \x01(\x03R\x05count\"-\n" +
"\x0fGetPagesRequest\x12\x1a\n" +
"\bidentity\x18\x01 \x01(\tR\bidentity2\xbd\x02\n" +
"\x05Pages\x125\n" +
"\x05Fetch\x12\x15.cms.PagesListRequest\x1a\x13.cms.PagesListReply\"\x00\x127\n" +
"\rGetByIdentity\x12\x14.cms.GetPagesRequest\x1a\x0e.cms.PagesItem\"\x00\x127\n" +
"\bGetByKey\x12\x19.cms.GetPagesByKeyRequest\x1a\x0e.cms.PagesItem\"\x00\x12,\n" +
"\x06Create\x12\x0e.cms.PagesItem\x1a\x10.cms.StatusReply\"\x00\x12,\n" +
"\x06Modify\x12\x0e.cms.PagesItem\x1a\x10.cms.StatusReply\"\x00\x12/\n" +
"\x06Delete\x12\x11.cms.IdentRequest\x1a\x10.cms.StatusReply\"\x00B\aZ\x05.;cmsb\x06proto3"
var (
file_pages_proto_rawDescOnce sync.Once
file_pages_proto_rawDescData []byte
)
func file_pages_proto_rawDescGZIP() []byte {
file_pages_proto_rawDescOnce.Do(func() {
file_pages_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_pages_proto_rawDesc), len(file_pages_proto_rawDesc)))
})
return file_pages_proto_rawDescData
}
var file_pages_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_pages_proto_goTypes = []any{
(*GetPagesByKeyRequest)(nil), // 0: cms.GetPagesByKeyRequest
(*PagesItem)(nil), // 1: cms.PagesItem
(*PagesListRequest)(nil), // 2: cms.PagesListRequest
(*PagesListReply)(nil), // 3: cms.PagesListReply
(*GetPagesRequest)(nil), // 4: cms.GetPagesRequest
(*AccessoryItem)(nil), // 5: cms.AccessoryItem
(*TagsItem)(nil), // 6: cms.TagsItem
(*IdentRequest)(nil), // 7: cms.IdentRequest
(*StatusReply)(nil), // 8: cms.StatusReply
}
var file_pages_proto_depIdxs = []int32{
5, // 0: cms.PagesItem.accessory_data:type_name -> cms.AccessoryItem
6, // 1: cms.PagesItem.tags_data:type_name -> cms.TagsItem
1, // 2: cms.PagesListReply.data:type_name -> cms.PagesItem
2, // 3: cms.Pages.Fetch:input_type -> cms.PagesListRequest
4, // 4: cms.Pages.GetByIdentity:input_type -> cms.GetPagesRequest
0, // 5: cms.Pages.GetByKey:input_type -> cms.GetPagesByKeyRequest
1, // 6: cms.Pages.Create:input_type -> cms.PagesItem
1, // 7: cms.Pages.Modify:input_type -> cms.PagesItem
7, // 8: cms.Pages.Delete:input_type -> cms.IdentRequest
3, // 9: cms.Pages.Fetch:output_type -> cms.PagesListReply
1, // 10: cms.Pages.GetByIdentity:output_type -> cms.PagesItem
1, // 11: cms.Pages.GetByKey:output_type -> cms.PagesItem
8, // 12: cms.Pages.Create:output_type -> cms.StatusReply
8, // 13: cms.Pages.Modify:output_type -> cms.StatusReply
8, // 14: cms.Pages.Delete:output_type -> cms.StatusReply
9, // [9:15] is the sub-list for method output_type
3, // [3:9] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}
func init() { file_pages_proto_init() }
func file_pages_proto_init() {
if File_pages_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_pages_proto_rawDesc), len(file_pages_proto_rawDesc)),
NumEnums: 0,
NumMessages: 5,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_pages_proto_goTypes,
DependencyIndexes: file_pages_proto_depIdxs,
MessageInfos: file_pages_proto_msgTypes,
}.Build()
File_pages_proto = out.File
file_pages_proto_goTypes = nil
file_pages_proto_depIdxs = nil
}

View File

@@ -0,0 +1,487 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: pages.proto
/*
Package cms is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package cms
import (
"context"
"errors"
"io"
"net/http"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
)
// Suppress "imported and not used" errors
var (
_ codes.Code
_ io.Reader
_ status.Status
_ = errors.New
_ = runtime.String
_ = utilities.NewDoubleArray
_ = metadata.Join
)
func request_Pages_Fetch_0(ctx context.Context, marshaler runtime.Marshaler, client PagesClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq PagesListRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Fetch(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Pages_Fetch_0(ctx context.Context, marshaler runtime.Marshaler, server PagesServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq PagesListRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Fetch(ctx, &protoReq)
return msg, metadata, err
}
func request_Pages_GetByIdentity_0(ctx context.Context, marshaler runtime.Marshaler, client PagesClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq GetPagesRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.GetByIdentity(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Pages_GetByIdentity_0(ctx context.Context, marshaler runtime.Marshaler, server PagesServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq GetPagesRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.GetByIdentity(ctx, &protoReq)
return msg, metadata, err
}
func request_Pages_GetByKey_0(ctx context.Context, marshaler runtime.Marshaler, client PagesClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq GetPagesByKeyRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.GetByKey(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Pages_GetByKey_0(ctx context.Context, marshaler runtime.Marshaler, server PagesServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq GetPagesByKeyRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.GetByKey(ctx, &protoReq)
return msg, metadata, err
}
func request_Pages_Create_0(ctx context.Context, marshaler runtime.Marshaler, client PagesClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq PagesItem
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Create(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Pages_Create_0(ctx context.Context, marshaler runtime.Marshaler, server PagesServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq PagesItem
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Create(ctx, &protoReq)
return msg, metadata, err
}
func request_Pages_Modify_0(ctx context.Context, marshaler runtime.Marshaler, client PagesClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq PagesItem
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Modify(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Pages_Modify_0(ctx context.Context, marshaler runtime.Marshaler, server PagesServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq PagesItem
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Modify(ctx, &protoReq)
return msg, metadata, err
}
func request_Pages_Delete_0(ctx context.Context, marshaler runtime.Marshaler, client PagesClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq IdentRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Delete(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Pages_Delete_0(ctx context.Context, marshaler runtime.Marshaler, server PagesServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq IdentRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Delete(ctx, &protoReq)
return msg, metadata, err
}
// RegisterPagesHandlerServer registers the http handlers for service Pages to "mux".
// UnaryRPC :call PagesServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterPagesHandlerFromEndpoint instead.
// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
func RegisterPagesHandlerServer(ctx context.Context, mux *runtime.ServeMux, server PagesServer) error {
mux.Handle(http.MethodPost, pattern_Pages_Fetch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/cms.Pages/Fetch", runtime.WithHTTPPathPattern("/cms.Pages/Fetch"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Pages_Fetch_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Pages_Fetch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Pages_GetByIdentity_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/cms.Pages/GetByIdentity", runtime.WithHTTPPathPattern("/cms.Pages/GetByIdentity"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Pages_GetByIdentity_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Pages_GetByIdentity_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Pages_GetByKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/cms.Pages/GetByKey", runtime.WithHTTPPathPattern("/cms.Pages/GetByKey"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Pages_GetByKey_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Pages_GetByKey_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Pages_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/cms.Pages/Create", runtime.WithHTTPPathPattern("/cms.Pages/Create"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Pages_Create_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Pages_Create_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Pages_Modify_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/cms.Pages/Modify", runtime.WithHTTPPathPattern("/cms.Pages/Modify"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Pages_Modify_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Pages_Modify_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Pages_Delete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/cms.Pages/Delete", runtime.WithHTTPPathPattern("/cms.Pages/Delete"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Pages_Delete_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Pages_Delete_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterPagesHandlerFromEndpoint is same as RegisterPagesHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterPagesHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.NewClient(endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterPagesHandler(ctx, mux, conn)
}
// RegisterPagesHandler registers the http handlers for service Pages to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterPagesHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterPagesHandlerClient(ctx, mux, NewPagesClient(conn))
}
// RegisterPagesHandlerClient registers the http handlers for service Pages
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "PagesClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "PagesClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "PagesClient" to call the correct interceptors. This client ignores the HTTP middlewares.
func RegisterPagesHandlerClient(ctx context.Context, mux *runtime.ServeMux, client PagesClient) error {
mux.Handle(http.MethodPost, pattern_Pages_Fetch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/cms.Pages/Fetch", runtime.WithHTTPPathPattern("/cms.Pages/Fetch"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Pages_Fetch_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Pages_Fetch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Pages_GetByIdentity_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/cms.Pages/GetByIdentity", runtime.WithHTTPPathPattern("/cms.Pages/GetByIdentity"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Pages_GetByIdentity_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Pages_GetByIdentity_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Pages_GetByKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/cms.Pages/GetByKey", runtime.WithHTTPPathPattern("/cms.Pages/GetByKey"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Pages_GetByKey_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Pages_GetByKey_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Pages_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/cms.Pages/Create", runtime.WithHTTPPathPattern("/cms.Pages/Create"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Pages_Create_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Pages_Create_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Pages_Modify_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/cms.Pages/Modify", runtime.WithHTTPPathPattern("/cms.Pages/Modify"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Pages_Modify_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Pages_Modify_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Pages_Delete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/cms.Pages/Delete", runtime.WithHTTPPathPattern("/cms.Pages/Delete"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Pages_Delete_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Pages_Delete_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_Pages_Fetch_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"cms.Pages", "Fetch"}, ""))
pattern_Pages_GetByIdentity_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"cms.Pages", "GetByIdentity"}, ""))
pattern_Pages_GetByKey_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"cms.Pages", "GetByKey"}, ""))
pattern_Pages_Create_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"cms.Pages", "Create"}, ""))
pattern_Pages_Modify_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"cms.Pages", "Modify"}, ""))
pattern_Pages_Delete_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"cms.Pages", "Delete"}, ""))
)
var (
forward_Pages_Fetch_0 = runtime.ForwardResponseMessage
forward_Pages_GetByIdentity_0 = runtime.ForwardResponseMessage
forward_Pages_GetByKey_0 = runtime.ForwardResponseMessage
forward_Pages_Create_0 = runtime.ForwardResponseMessage
forward_Pages_Modify_0 = runtime.ForwardResponseMessage
forward_Pages_Delete_0 = runtime.ForwardResponseMessage
)

View File

@@ -0,0 +1,327 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc (unknown)
// source: pages.proto
package cms
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 (
Pages_Fetch_FullMethodName = "/cms.Pages/Fetch"
Pages_GetByIdentity_FullMethodName = "/cms.Pages/GetByIdentity"
Pages_GetByKey_FullMethodName = "/cms.Pages/GetByKey"
Pages_Create_FullMethodName = "/cms.Pages/Create"
Pages_Modify_FullMethodName = "/cms.Pages/Modify"
Pages_Delete_FullMethodName = "/cms.Pages/Delete"
)
// PagesClient is the client API for Pages 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 PagesClient interface {
// 单页列表
Fetch(ctx context.Context, in *PagesListRequest, opts ...grpc.CallOption) (*PagesListReply, error)
// 获取单页详情 By Identity
GetByIdentity(ctx context.Context, in *GetPagesRequest, opts ...grpc.CallOption) (*PagesItem, error)
// 获取单页详情 By Key
GetByKey(ctx context.Context, in *GetPagesByKeyRequest, opts ...grpc.CallOption) (*PagesItem, error)
// 发布单页
Create(ctx context.Context, in *PagesItem, opts ...grpc.CallOption) (*StatusReply, error)
// 修改单页
Modify(ctx context.Context, in *PagesItem, opts ...grpc.CallOption) (*StatusReply, error)
// 删除单页
Delete(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error)
}
type pagesClient struct {
cc grpc.ClientConnInterface
}
func NewPagesClient(cc grpc.ClientConnInterface) PagesClient {
return &pagesClient{cc}
}
func (c *pagesClient) Fetch(ctx context.Context, in *PagesListRequest, opts ...grpc.CallOption) (*PagesListReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(PagesListReply)
err := c.cc.Invoke(ctx, Pages_Fetch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *pagesClient) GetByIdentity(ctx context.Context, in *GetPagesRequest, opts ...grpc.CallOption) (*PagesItem, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(PagesItem)
err := c.cc.Invoke(ctx, Pages_GetByIdentity_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *pagesClient) GetByKey(ctx context.Context, in *GetPagesByKeyRequest, opts ...grpc.CallOption) (*PagesItem, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(PagesItem)
err := c.cc.Invoke(ctx, Pages_GetByKey_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *pagesClient) Create(ctx context.Context, in *PagesItem, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Pages_Create_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *pagesClient) Modify(ctx context.Context, in *PagesItem, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Pages_Modify_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *pagesClient) Delete(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, Pages_Delete_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// PagesServer is the server API for Pages service.
// All implementations must embed UnimplementedPagesServer
// for forward compatibility.
//
// 单页管理
type PagesServer interface {
// 单页列表
Fetch(context.Context, *PagesListRequest) (*PagesListReply, error)
// 获取单页详情 By Identity
GetByIdentity(context.Context, *GetPagesRequest) (*PagesItem, error)
// 获取单页详情 By Key
GetByKey(context.Context, *GetPagesByKeyRequest) (*PagesItem, error)
// 发布单页
Create(context.Context, *PagesItem) (*StatusReply, error)
// 修改单页
Modify(context.Context, *PagesItem) (*StatusReply, error)
// 删除单页
Delete(context.Context, *IdentRequest) (*StatusReply, error)
mustEmbedUnimplementedPagesServer()
}
// UnimplementedPagesServer 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 UnimplementedPagesServer struct{}
func (UnimplementedPagesServer) Fetch(context.Context, *PagesListRequest) (*PagesListReply, error) {
return nil, status.Error(codes.Unimplemented, "method Fetch not implemented")
}
func (UnimplementedPagesServer) GetByIdentity(context.Context, *GetPagesRequest) (*PagesItem, error) {
return nil, status.Error(codes.Unimplemented, "method GetByIdentity not implemented")
}
func (UnimplementedPagesServer) GetByKey(context.Context, *GetPagesByKeyRequest) (*PagesItem, error) {
return nil, status.Error(codes.Unimplemented, "method GetByKey not implemented")
}
func (UnimplementedPagesServer) Create(context.Context, *PagesItem) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method Create not implemented")
}
func (UnimplementedPagesServer) Modify(context.Context, *PagesItem) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method Modify not implemented")
}
func (UnimplementedPagesServer) Delete(context.Context, *IdentRequest) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method Delete not implemented")
}
func (UnimplementedPagesServer) mustEmbedUnimplementedPagesServer() {}
func (UnimplementedPagesServer) testEmbeddedByValue() {}
// UnsafePagesServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to PagesServer will
// result in compilation errors.
type UnsafePagesServer interface {
mustEmbedUnimplementedPagesServer()
}
func RegisterPagesServer(s grpc.ServiceRegistrar, srv PagesServer) {
// If the following call panics, it indicates UnimplementedPagesServer 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(&Pages_ServiceDesc, srv)
}
func _Pages_Fetch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PagesListRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PagesServer).Fetch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Pages_Fetch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PagesServer).Fetch(ctx, req.(*PagesListRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Pages_GetByIdentity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetPagesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PagesServer).GetByIdentity(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Pages_GetByIdentity_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PagesServer).GetByIdentity(ctx, req.(*GetPagesRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Pages_GetByKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetPagesByKeyRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PagesServer).GetByKey(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Pages_GetByKey_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PagesServer).GetByKey(ctx, req.(*GetPagesByKeyRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Pages_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PagesItem)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PagesServer).Create(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Pages_Create_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PagesServer).Create(ctx, req.(*PagesItem))
}
return interceptor(ctx, in, info, handler)
}
func _Pages_Modify_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PagesItem)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PagesServer).Modify(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Pages_Modify_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PagesServer).Modify(ctx, req.(*PagesItem))
}
return interceptor(ctx, in, info, handler)
}
func _Pages_Delete_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.(PagesServer).Delete(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Pages_Delete_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PagesServer).Delete(ctx, req.(*IdentRequest))
}
return interceptor(ctx, in, info, handler)
}
// Pages_ServiceDesc is the grpc.ServiceDesc for Pages service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Pages_ServiceDesc = grpc.ServiceDesc{
ServiceName: "cms.Pages",
HandlerType: (*PagesServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Fetch",
Handler: _Pages_Fetch_Handler,
},
{
MethodName: "GetByIdentity",
Handler: _Pages_GetByIdentity_Handler,
},
{
MethodName: "GetByKey",
Handler: _Pages_GetByKey_Handler,
},
{
MethodName: "Create",
Handler: _Pages_Create_Handler,
},
{
MethodName: "Modify",
Handler: _Pages_Modify_Handler,
},
{
MethodName: "Delete",
Handler: _Pages_Delete_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "pages.proto",
}

1249
apps/base/cms/pb/post.pb.go Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,847 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc (unknown)
// source: post.proto
package cms
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_Fetch_FullMethodName = "/cms.Post/Fetch"
Post_GetByIdentity_FullMethodName = "/cms.Post/GetByIdentity"
Post_GetByKey_FullMethodName = "/cms.Post/GetByKey"
Post_Search_FullMethodName = "/cms.Post/Search"
Post_Create_FullMethodName = "/cms.Post/Create"
Post_Modify_FullMethodName = "/cms.Post/Modify"
Post_Delete_FullMethodName = "/cms.Post/Delete"
Post_IncrPostLike_FullMethodName = "/cms.Post/IncrPostLike"
Post_DescPostLike_FullMethodName = "/cms.Post/DescPostLike"
Post_IncrPostUnlike_FullMethodName = "/cms.Post/IncrPostUnlike"
Post_DescPostUnlike_FullMethodName = "/cms.Post/DescPostUnlike"
Post_CommentList_FullMethodName = "/cms.Post/CommentList"
Post_AddComment_FullMethodName = "/cms.Post/AddComment"
Post_ModifyComment_FullMethodName = "/cms.Post/ModifyComment"
Post_DeleteComment_FullMethodName = "/cms.Post/DeleteComment"
Post_IncrCommentLike_FullMethodName = "/cms.Post/IncrCommentLike"
Post_DescCommentLike_FullMethodName = "/cms.Post/DescCommentLike"
Post_IncrCommentUnlike_FullMethodName = "/cms.Post/IncrCommentUnlike"
Post_DescCommentUnlike_FullMethodName = "/cms.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 {
// 文章列表
Fetch(ctx context.Context, in *PostListRequest, opts ...grpc.CallOption) (*PostListReply, error)
// 获取文章详情 By Identity
GetByIdentity(ctx context.Context, in *GetPostRequest, opts ...grpc.CallOption) (*PostItem, error)
// 获取文章详情 By Key
GetByKey(ctx context.Context, in *GetPostByKeyRequest, opts ...grpc.CallOption) (*PostItem, error)
// 搜索文章
Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*PostListReply, error)
// 发布文章
Create(ctx context.Context, in *PostItem, opts ...grpc.CallOption) (*StatusReply, error)
// 修改文章
Modify(ctx context.Context, in *PostItem, opts ...grpc.CallOption) (*StatusReply, error)
// 删除文章
Delete(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) Fetch(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_Fetch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *postClient) GetByIdentity(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_GetByIdentity_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *postClient) GetByKey(ctx context.Context, in *GetPostByKeyRequest, opts ...grpc.CallOption) (*PostItem, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(PostItem)
err := c.cc.Invoke(ctx, Post_GetByKey_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *postClient) Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*PostListReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(PostListReply)
err := c.cc.Invoke(ctx, Post_Search_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *postClient) Create(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_Create_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *postClient) Modify(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_Modify_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *postClient) Delete(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_Delete_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 {
// 文章列表
Fetch(context.Context, *PostListRequest) (*PostListReply, error)
// 获取文章详情 By Identity
GetByIdentity(context.Context, *GetPostRequest) (*PostItem, error)
// 获取文章详情 By Key
GetByKey(context.Context, *GetPostByKeyRequest) (*PostItem, error)
// 搜索文章
Search(context.Context, *SearchRequest) (*PostListReply, error)
// 发布文章
Create(context.Context, *PostItem) (*StatusReply, error)
// 修改文章
Modify(context.Context, *PostItem) (*StatusReply, error)
// 删除文章
Delete(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) Fetch(context.Context, *PostListRequest) (*PostListReply, error) {
return nil, status.Error(codes.Unimplemented, "method Fetch not implemented")
}
func (UnimplementedPostServer) GetByIdentity(context.Context, *GetPostRequest) (*PostItem, error) {
return nil, status.Error(codes.Unimplemented, "method GetByIdentity not implemented")
}
func (UnimplementedPostServer) GetByKey(context.Context, *GetPostByKeyRequest) (*PostItem, error) {
return nil, status.Error(codes.Unimplemented, "method GetByKey not implemented")
}
func (UnimplementedPostServer) Search(context.Context, *SearchRequest) (*PostListReply, error) {
return nil, status.Error(codes.Unimplemented, "method Search not implemented")
}
func (UnimplementedPostServer) Create(context.Context, *PostItem) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method Create not implemented")
}
func (UnimplementedPostServer) Modify(context.Context, *PostItem) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method Modify not implemented")
}
func (UnimplementedPostServer) Delete(context.Context, *IdentRequest) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method Delete not implemented")
}
func (UnimplementedPostServer) IncrPostLike(context.Context, *PostOpIdentityRequest) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method IncrPostLike not implemented")
}
func (UnimplementedPostServer) DescPostLike(context.Context, *PostOpIdentityRequest) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method DescPostLike not implemented")
}
func (UnimplementedPostServer) IncrPostUnlike(context.Context, *PostOpIdentityRequest) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method IncrPostUnlike not implemented")
}
func (UnimplementedPostServer) DescPostUnlike(context.Context, *PostOpIdentityRequest) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method DescPostUnlike not implemented")
}
func (UnimplementedPostServer) CommentList(context.Context, *CommentListRequest) (*CommentListResponse, error) {
return nil, status.Error(codes.Unimplemented, "method CommentList not implemented")
}
func (UnimplementedPostServer) AddComment(context.Context, *CommentItem) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method AddComment not implemented")
}
func (UnimplementedPostServer) ModifyComment(context.Context, *CommentItem) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method ModifyComment not implemented")
}
func (UnimplementedPostServer) DeleteComment(context.Context, *DeleteCommentRequest) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method DeleteComment not implemented")
}
func (UnimplementedPostServer) IncrCommentLike(context.Context, *CommentOpIdentityRequest) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method IncrCommentLike not implemented")
}
func (UnimplementedPostServer) DescCommentLike(context.Context, *CommentOpIdentityRequest) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method DescCommentLike not implemented")
}
func (UnimplementedPostServer) IncrCommentUnlike(context.Context, *CommentOpIdentityRequest) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method IncrCommentUnlike not implemented")
}
func (UnimplementedPostServer) DescCommentUnlike(context.Context, *CommentOpIdentityRequest) (*StatusReply, error) {
return nil, status.Error(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 panics, 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_Fetch_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).Fetch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Post_Fetch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServer).Fetch(ctx, req.(*PostListRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Post_GetByIdentity_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).GetByIdentity(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Post_GetByIdentity_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServer).GetByIdentity(ctx, req.(*GetPostRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Post_GetByKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetPostByKeyRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PostServer).GetByKey(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Post_GetByKey_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServer).GetByKey(ctx, req.(*GetPostByKeyRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Post_Search_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SearchRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PostServer).Search(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Post_Search_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServer).Search(ctx, req.(*SearchRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Post_Create_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).Create(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Post_Create_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServer).Create(ctx, req.(*PostItem))
}
return interceptor(ctx, in, info, handler)
}
func _Post_Modify_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).Modify(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Post_Modify_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServer).Modify(ctx, req.(*PostItem))
}
return interceptor(ctx, in, info, handler)
}
func _Post_Delete_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).Delete(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Post_Delete_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServer).Delete(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: "cms.Post",
HandlerType: (*PostServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Fetch",
Handler: _Post_Fetch_Handler,
},
{
MethodName: "GetByIdentity",
Handler: _Post_GetByIdentity_Handler,
},
{
MethodName: "GetByKey",
Handler: _Post_GetByKey_Handler,
},
{
MethodName: "Search",
Handler: _Post_Search_Handler,
},
{
MethodName: "Create",
Handler: _Post_Create_Handler,
},
{
MethodName: "Modify",
Handler: _Post_Modify_Handler,
},
{
MethodName: "Delete",
Handler: _Post_Delete_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",
}

287
apps/base/cms/pb/site.pb.go Normal file
View File

@@ -0,0 +1,287 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc (unknown)
// source: site.proto
package cms
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 SiteListReply struct {
state protoimpl.MessageState `protogen:"open.v1"`
// 数据
Data []*SiteItem `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 *SiteListReply) Reset() {
*x = SiteListReply{}
mi := &file_site_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *SiteListReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SiteListReply) ProtoMessage() {}
func (x *SiteListReply) ProtoReflect() protoreflect.Message {
mi := &file_site_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 SiteListReply.ProtoReflect.Descriptor instead.
func (*SiteListReply) Descriptor() ([]byte, []int) {
return file_site_proto_rawDescGZIP(), []int{0}
}
func (x *SiteListReply) GetData() []*SiteItem {
if x != nil {
return x.Data
}
return nil
}
func (x *SiteListReply) GetCount() int64 {
if x != nil {
return x.Count
}
return 0
}
// 添加站点请求
type SiteItem 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"` // 添加站点请求唯一码
Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"` // 标题
Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` // 站点描述
IconPath string `protobuf:"bytes,5,opt,name=icon_path,proto3" json:"icon_path,omitempty"` // 站点图标
Keywords string `protobuf:"bytes,6,opt,name=keywords,proto3" json:"keywords,omitempty"` // 关键字
Domain string `protobuf:"bytes,7,opt,name=domain,proto3" json:"domain,omitempty"` // 站点域名
Seo string `protobuf:"bytes,8,opt,name=seo,proto3" json:"seo,omitempty"` // SEO
Theme string `protobuf:"bytes,9,opt,name=theme,proto3" json:"theme,omitempty"` // 站点主题
Configs string `protobuf:"bytes,10,opt,name=configs,proto3" json:"configs,omitempty"` // 站点配置
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *SiteItem) Reset() {
*x = SiteItem{}
mi := &file_site_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *SiteItem) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SiteItem) ProtoMessage() {}
func (x *SiteItem) ProtoReflect() protoreflect.Message {
mi := &file_site_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 SiteItem.ProtoReflect.Descriptor instead.
func (*SiteItem) Descriptor() ([]byte, []int) {
return file_site_proto_rawDescGZIP(), []int{1}
}
func (x *SiteItem) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *SiteItem) GetIdentity() string {
if x != nil {
return x.Identity
}
return ""
}
func (x *SiteItem) GetTitle() string {
if x != nil {
return x.Title
}
return ""
}
func (x *SiteItem) GetDescription() string {
if x != nil {
return x.Description
}
return ""
}
func (x *SiteItem) GetIconPath() string {
if x != nil {
return x.IconPath
}
return ""
}
func (x *SiteItem) GetKeywords() string {
if x != nil {
return x.Keywords
}
return ""
}
func (x *SiteItem) GetDomain() string {
if x != nil {
return x.Domain
}
return ""
}
func (x *SiteItem) GetSeo() string {
if x != nil {
return x.Seo
}
return ""
}
func (x *SiteItem) GetTheme() string {
if x != nil {
return x.Theme
}
return ""
}
func (x *SiteItem) GetConfigs() string {
if x != nil {
return x.Configs
}
return ""
}
var File_site_proto protoreflect.FileDescriptor
const file_site_proto_rawDesc = "" +
"\n" +
"\x13" +
"base/cms/site.proto\x12\x03cms\x1a\x10cms/blocks.proto\"H\n" +
"\rSiteListReply\x12!\n" +
"\x04data\x18\x01 \x03(\v2\r.cms.SiteItemR\x04data\x12\x14\n" +
"\x05count\x18\x02 \x01(\x03R\x05count\"\x82\x02\n" +
"\bSiteItem\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x1a\n" +
"\bidentity\x18\x02 \x01(\tR\bidentity\x12\x14\n" +
"\x05title\x18\x03 \x01(\tR\x05title\x12 \n" +
"\vdescription\x18\x04 \x01(\tR\vdescription\x12\x1c\n" +
"\ticon_path\x18\x05 \x01(\tR\ticon_path\x12\x1a\n" +
"\bkeywords\x18\x06 \x01(\tR\bkeywords\x12\x16\n" +
"\x06domain\x18\a \x01(\tR\x06domain\x12\x10\n" +
"\x03seo\x18\b \x01(\tR\x03seo\x12\x14\n" +
"\x05theme\x18\t \x01(\tR\x05theme\x12\x18\n" +
"\aconfigs\x18\n" +
" \x01(\tR\aconfigs2\xe7\x01\n" +
"\x04Site\x12)\n" +
"\x05Fetch\x12\n" +
".cms.Empty\x1a\x12.cms.SiteListReply\"\x00\x12)\n" +
"\x03Get\x12\x11.cms.IdentRequest\x1a\r.cms.SiteItem\"\x00\x12+\n" +
"\x06Create\x12\r.cms.SiteItem\x1a\x10.cms.StatusReply\"\x00\x12+\n" +
"\x06Modify\x12\r.cms.SiteItem\x1a\x10.cms.StatusReply\"\x00\x12/\n" +
"\x06Delete\x12\x11.cms.IdentRequest\x1a\x10.cms.StatusReply\"\x00B\aZ\x05.;cmsb\x06proto3"
var (
file_site_proto_rawDescOnce sync.Once
file_site_proto_rawDescData []byte
)
func file_site_proto_rawDescGZIP() []byte {
file_site_proto_rawDescOnce.Do(func() {
file_site_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_site_proto_rawDesc), len(file_site_proto_rawDesc)))
})
return file_site_proto_rawDescData
}
var file_site_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_site_proto_goTypes = []any{
(*SiteListReply)(nil), // 0: cms.SiteListReply
(*SiteItem)(nil), // 1: cms.SiteItem
(*Empty)(nil), // 2: cms.Empty
(*IdentRequest)(nil), // 3: cms.IdentRequest
(*StatusReply)(nil), // 4: cms.StatusReply
}
var file_site_proto_depIdxs = []int32{
1, // 0: cms.SiteListReply.data:type_name -> cms.SiteItem
2, // 1: cms.Site.Fetch:input_type -> cms.Empty
3, // 2: cms.Site.Get:input_type -> cms.IdentRequest
1, // 3: cms.Site.Create:input_type -> cms.SiteItem
1, // 4: cms.Site.Modify:input_type -> cms.SiteItem
3, // 5: cms.Site.Delete:input_type -> cms.IdentRequest
0, // 6: cms.Site.Fetch:output_type -> cms.SiteListReply
1, // 7: cms.Site.Get:output_type -> cms.SiteItem
4, // 8: cms.Site.Create:output_type -> cms.StatusReply
4, // 9: cms.Site.Modify:output_type -> cms.StatusReply
4, // 10: cms.Site.Delete:output_type -> cms.StatusReply
6, // [6:11] is the sub-list for method output_type
1, // [1:6] 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_site_proto_init() }
func file_site_proto_init() {
if File_site_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_site_proto_rawDesc), len(file_site_proto_rawDesc)),
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_site_proto_goTypes,
DependencyIndexes: file_site_proto_depIdxs,
MessageInfos: file_site_proto_msgTypes,
}.Build()
File_site_proto = out.File
file_site_proto_goTypes = nil
file_site_proto_depIdxs = nil
}

View File

@@ -0,0 +1,421 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: site.proto
/*
Package cms is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package cms
import (
"context"
"errors"
"io"
"net/http"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
)
// Suppress "imported and not used" errors
var (
_ codes.Code
_ io.Reader
_ status.Status
_ = errors.New
_ = runtime.String
_ = utilities.NewDoubleArray
_ = metadata.Join
)
func request_Site_Fetch_0(ctx context.Context, marshaler runtime.Marshaler, client SiteClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq Empty
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Fetch(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Site_Fetch_0(ctx context.Context, marshaler runtime.Marshaler, server SiteServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq Empty
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Fetch(ctx, &protoReq)
return msg, metadata, err
}
func request_Site_Get_0(ctx context.Context, marshaler runtime.Marshaler, client SiteClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq IdentRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Get(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Site_Get_0(ctx context.Context, marshaler runtime.Marshaler, server SiteServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq IdentRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Get(ctx, &protoReq)
return msg, metadata, err
}
func request_Site_Create_0(ctx context.Context, marshaler runtime.Marshaler, client SiteClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq SiteItem
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Create(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Site_Create_0(ctx context.Context, marshaler runtime.Marshaler, server SiteServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq SiteItem
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Create(ctx, &protoReq)
return msg, metadata, err
}
func request_Site_Modify_0(ctx context.Context, marshaler runtime.Marshaler, client SiteClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq SiteItem
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Modify(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Site_Modify_0(ctx context.Context, marshaler runtime.Marshaler, server SiteServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq SiteItem
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Modify(ctx, &protoReq)
return msg, metadata, err
}
func request_Site_Delete_0(ctx context.Context, marshaler runtime.Marshaler, client SiteClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq IdentRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Delete(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Site_Delete_0(ctx context.Context, marshaler runtime.Marshaler, server SiteServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq IdentRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Delete(ctx, &protoReq)
return msg, metadata, err
}
// RegisterSiteHandlerServer registers the http handlers for service Site to "mux".
// UnaryRPC :call SiteServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterSiteHandlerFromEndpoint instead.
// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
func RegisterSiteHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SiteServer) error {
mux.Handle(http.MethodPost, pattern_Site_Fetch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/cms.Site/Fetch", runtime.WithHTTPPathPattern("/cms.Site/Fetch"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Site_Fetch_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Site_Fetch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Site_Get_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/cms.Site/Get", runtime.WithHTTPPathPattern("/cms.Site/Get"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Site_Get_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Site_Get_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Site_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/cms.Site/Create", runtime.WithHTTPPathPattern("/cms.Site/Create"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Site_Create_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Site_Create_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Site_Modify_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/cms.Site/Modify", runtime.WithHTTPPathPattern("/cms.Site/Modify"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Site_Modify_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Site_Modify_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Site_Delete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/cms.Site/Delete", runtime.WithHTTPPathPattern("/cms.Site/Delete"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Site_Delete_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Site_Delete_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterSiteHandlerFromEndpoint is same as RegisterSiteHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterSiteHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.NewClient(endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterSiteHandler(ctx, mux, conn)
}
// RegisterSiteHandler registers the http handlers for service Site to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterSiteHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterSiteHandlerClient(ctx, mux, NewSiteClient(conn))
}
// RegisterSiteHandlerClient registers the http handlers for service Site
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "SiteClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "SiteClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "SiteClient" to call the correct interceptors. This client ignores the HTTP middlewares.
func RegisterSiteHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SiteClient) error {
mux.Handle(http.MethodPost, pattern_Site_Fetch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/cms.Site/Fetch", runtime.WithHTTPPathPattern("/cms.Site/Fetch"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Site_Fetch_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Site_Fetch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Site_Get_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/cms.Site/Get", runtime.WithHTTPPathPattern("/cms.Site/Get"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Site_Get_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Site_Get_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Site_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/cms.Site/Create", runtime.WithHTTPPathPattern("/cms.Site/Create"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Site_Create_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Site_Create_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Site_Modify_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/cms.Site/Modify", runtime.WithHTTPPathPattern("/cms.Site/Modify"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Site_Modify_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Site_Modify_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Site_Delete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/cms.Site/Delete", runtime.WithHTTPPathPattern("/cms.Site/Delete"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Site_Delete_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Site_Delete_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_Site_Fetch_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"cms.Site", "Fetch"}, ""))
pattern_Site_Get_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"cms.Site", "Get"}, ""))
pattern_Site_Create_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"cms.Site", "Create"}, ""))
pattern_Site_Modify_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"cms.Site", "Modify"}, ""))
pattern_Site_Delete_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"cms.Site", "Delete"}, ""))
)
var (
forward_Site_Fetch_0 = runtime.ForwardResponseMessage
forward_Site_Get_0 = runtime.ForwardResponseMessage
forward_Site_Create_0 = runtime.ForwardResponseMessage
forward_Site_Modify_0 = runtime.ForwardResponseMessage
forward_Site_Delete_0 = runtime.ForwardResponseMessage
)

View File

@@ -0,0 +1,287 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc (unknown)
// source: site.proto
package cms
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 (
Site_Fetch_FullMethodName = "/cms.Site/Fetch"
Site_Get_FullMethodName = "/cms.Site/Get"
Site_Create_FullMethodName = "/cms.Site/Create"
Site_Modify_FullMethodName = "/cms.Site/Modify"
Site_Delete_FullMethodName = "/cms.Site/Delete"
)
// SiteClient is the client API for Site 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.
//
// CMS - 站点
type SiteClient interface {
// 站点列表
Fetch(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*SiteListReply, error)
// 站点详情
Get(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*SiteItem, error)
// 添加站点
Create(ctx context.Context, in *SiteItem, opts ...grpc.CallOption) (*StatusReply, error)
// 修改站点
Modify(ctx context.Context, in *SiteItem, opts ...grpc.CallOption) (*StatusReply, error)
// 删除站点
Delete(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error)
}
type siteClient struct {
cc grpc.ClientConnInterface
}
func NewSiteClient(cc grpc.ClientConnInterface) SiteClient {
return &siteClient{cc}
}
func (c *siteClient) Fetch(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*SiteListReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(SiteListReply)
err := c.cc.Invoke(ctx, Site_Fetch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *siteClient) Get(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*SiteItem, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(SiteItem)
err := c.cc.Invoke(ctx, Site_Get_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *siteClient) Create(ctx context.Context, in *SiteItem, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Site_Create_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *siteClient) Modify(ctx context.Context, in *SiteItem, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Site_Modify_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *siteClient) Delete(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, Site_Delete_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// SiteServer is the server API for Site service.
// All implementations must embed UnimplementedSiteServer
// for forward compatibility.
//
// CMS - 站点
type SiteServer interface {
// 站点列表
Fetch(context.Context, *Empty) (*SiteListReply, error)
// 站点详情
Get(context.Context, *IdentRequest) (*SiteItem, error)
// 添加站点
Create(context.Context, *SiteItem) (*StatusReply, error)
// 修改站点
Modify(context.Context, *SiteItem) (*StatusReply, error)
// 删除站点
Delete(context.Context, *IdentRequest) (*StatusReply, error)
mustEmbedUnimplementedSiteServer()
}
// UnimplementedSiteServer 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 UnimplementedSiteServer struct{}
func (UnimplementedSiteServer) Fetch(context.Context, *Empty) (*SiteListReply, error) {
return nil, status.Error(codes.Unimplemented, "method Fetch not implemented")
}
func (UnimplementedSiteServer) Get(context.Context, *IdentRequest) (*SiteItem, error) {
return nil, status.Error(codes.Unimplemented, "method Get not implemented")
}
func (UnimplementedSiteServer) Create(context.Context, *SiteItem) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method Create not implemented")
}
func (UnimplementedSiteServer) Modify(context.Context, *SiteItem) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method Modify not implemented")
}
func (UnimplementedSiteServer) Delete(context.Context, *IdentRequest) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method Delete not implemented")
}
func (UnimplementedSiteServer) mustEmbedUnimplementedSiteServer() {}
func (UnimplementedSiteServer) testEmbeddedByValue() {}
// UnsafeSiteServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to SiteServer will
// result in compilation errors.
type UnsafeSiteServer interface {
mustEmbedUnimplementedSiteServer()
}
func RegisterSiteServer(s grpc.ServiceRegistrar, srv SiteServer) {
// If the following call panics, it indicates UnimplementedSiteServer 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(&Site_ServiceDesc, srv)
}
func _Site_Fetch_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.(SiteServer).Fetch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Site_Fetch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SiteServer).Fetch(ctx, req.(*Empty))
}
return interceptor(ctx, in, info, handler)
}
func _Site_Get_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.(SiteServer).Get(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Site_Get_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SiteServer).Get(ctx, req.(*IdentRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Site_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SiteItem)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SiteServer).Create(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Site_Create_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SiteServer).Create(ctx, req.(*SiteItem))
}
return interceptor(ctx, in, info, handler)
}
func _Site_Modify_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SiteItem)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SiteServer).Modify(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Site_Modify_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SiteServer).Modify(ctx, req.(*SiteItem))
}
return interceptor(ctx, in, info, handler)
}
func _Site_Delete_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.(SiteServer).Delete(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Site_Delete_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SiteServer).Delete(ctx, req.(*IdentRequest))
}
return interceptor(ctx, in, info, handler)
}
// Site_ServiceDesc is the grpc.ServiceDesc for Site service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Site_ServiceDesc = grpc.ServiceDesc{
ServiceName: "cms.Site",
HandlerType: (*SiteServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Fetch",
Handler: _Site_Fetch_Handler,
},
{
MethodName: "Get",
Handler: _Site_Get_Handler,
},
{
MethodName: "Create",
Handler: _Site_Create_Handler,
},
{
MethodName: "Modify",
Handler: _Site_Modify_Handler,
},
{
MethodName: "Delete",
Handler: _Site_Delete_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "site.proto",
}

151
apps/base/cms/pb/tags.pb.go Normal file
View File

@@ -0,0 +1,151 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc (unknown)
// source: tags.proto
package cms
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 TagsListReply struct {
state protoimpl.MessageState `protogen:"open.v1"`
Data []*TagsItem `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 *TagsListReply) Reset() {
*x = TagsListReply{}
mi := &file_tags_proto_msgTypes[0]
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[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 TagsListReply.ProtoReflect.Descriptor instead.
func (*TagsListReply) Descriptor() ([]byte, []int) {
return file_tags_proto_rawDescGZIP(), []int{0}
}
func (x *TagsListReply) GetData() []*TagsItem {
if x != nil {
return x.Data
}
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" +
"\x13" +
"base/cms/tags.proto\x12\x03cms\x1a\x10cms/blocks.proto\"H\n" +
"\rTagsListReply\x12!\n" +
"\x04data\x18\x01 \x03(\v2\r.cms.TagsItemR\x04data\x12\x14\n" +
"\x05count\x18\x02 \x01(\x03R\x05count2\xc3\x01\n" +
"\x04Tags\x120\n" +
"\x05Fetch\x12\x11.cms.IdentRequest\x1a\x12.cms.TagsListReply\"\x00\x12+\n" +
"\x06Create\x12\r.cms.TagsItem\x1a\x10.cms.StatusReply\"\x00\x12+\n" +
"\x06Modify\x12\r.cms.TagsItem\x1a\x10.cms.StatusReply\"\x00\x12/\n" +
"\x06Delete\x12\x11.cms.IdentRequest\x1a\x10.cms.StatusReply\"\x00B\aZ\x05.;cmsb\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, 1)
var file_tags_proto_goTypes = []any{
(*TagsListReply)(nil), // 0: cms.TagsListReply
(*TagsItem)(nil), // 1: cms.TagsItem
(*IdentRequest)(nil), // 2: cms.IdentRequest
(*StatusReply)(nil), // 3: cms.StatusReply
}
var file_tags_proto_depIdxs = []int32{
1, // 0: cms.TagsListReply.data:type_name -> cms.TagsItem
2, // 1: cms.Tags.Fetch:input_type -> cms.IdentRequest
1, // 2: cms.Tags.Create:input_type -> cms.TagsItem
1, // 3: cms.Tags.Modify:input_type -> cms.TagsItem
2, // 4: cms.Tags.Delete:input_type -> cms.IdentRequest
0, // 5: cms.Tags.Fetch:output_type -> cms.TagsListReply
3, // 6: cms.Tags.Create:output_type -> cms.StatusReply
3, // 7: cms.Tags.Modify:output_type -> cms.StatusReply
3, // 8: cms.Tags.Delete:output_type -> cms.StatusReply
5, // [5:9] is the sub-list for method output_type
1, // [1:5] 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_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: 1,
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
}

View File

@@ -0,0 +1,355 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: tags.proto
/*
Package cms is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package cms
import (
"context"
"errors"
"io"
"net/http"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
)
// Suppress "imported and not used" errors
var (
_ codes.Code
_ io.Reader
_ status.Status
_ = errors.New
_ = runtime.String
_ = utilities.NewDoubleArray
_ = metadata.Join
)
func request_Tags_Fetch_0(ctx context.Context, marshaler runtime.Marshaler, client TagsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq IdentRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Fetch(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Tags_Fetch_0(ctx context.Context, marshaler runtime.Marshaler, server TagsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq IdentRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Fetch(ctx, &protoReq)
return msg, metadata, err
}
func request_Tags_Create_0(ctx context.Context, marshaler runtime.Marshaler, client TagsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq TagsItem
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Create(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Tags_Create_0(ctx context.Context, marshaler runtime.Marshaler, server TagsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq TagsItem
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Create(ctx, &protoReq)
return msg, metadata, err
}
func request_Tags_Modify_0(ctx context.Context, marshaler runtime.Marshaler, client TagsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq TagsItem
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Modify(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Tags_Modify_0(ctx context.Context, marshaler runtime.Marshaler, server TagsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq TagsItem
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Modify(ctx, &protoReq)
return msg, metadata, err
}
func request_Tags_Delete_0(ctx context.Context, marshaler runtime.Marshaler, client TagsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq IdentRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.Delete(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Tags_Delete_0(ctx context.Context, marshaler runtime.Marshaler, server TagsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq IdentRequest
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Delete(ctx, &protoReq)
return msg, metadata, err
}
// RegisterTagsHandlerServer registers the http handlers for service Tags to "mux".
// UnaryRPC :call TagsServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterTagsHandlerFromEndpoint instead.
// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
func RegisterTagsHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TagsServer) error {
mux.Handle(http.MethodPost, pattern_Tags_Fetch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/cms.Tags/Fetch", runtime.WithHTTPPathPattern("/cms.Tags/Fetch"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Tags_Fetch_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Tags_Fetch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Tags_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/cms.Tags/Create", runtime.WithHTTPPathPattern("/cms.Tags/Create"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Tags_Create_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Tags_Create_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Tags_Modify_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/cms.Tags/Modify", runtime.WithHTTPPathPattern("/cms.Tags/Modify"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Tags_Modify_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Tags_Modify_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Tags_Delete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/cms.Tags/Delete", runtime.WithHTTPPathPattern("/cms.Tags/Delete"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Tags_Delete_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Tags_Delete_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterTagsHandlerFromEndpoint is same as RegisterTagsHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterTagsHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.NewClient(endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterTagsHandler(ctx, mux, conn)
}
// RegisterTagsHandler registers the http handlers for service Tags to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterTagsHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterTagsHandlerClient(ctx, mux, NewTagsClient(conn))
}
// RegisterTagsHandlerClient registers the http handlers for service Tags
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "TagsClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "TagsClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "TagsClient" to call the correct interceptors. This client ignores the HTTP middlewares.
func RegisterTagsHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TagsClient) error {
mux.Handle(http.MethodPost, pattern_Tags_Fetch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/cms.Tags/Fetch", runtime.WithHTTPPathPattern("/cms.Tags/Fetch"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Tags_Fetch_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Tags_Fetch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Tags_Create_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/cms.Tags/Create", runtime.WithHTTPPathPattern("/cms.Tags/Create"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Tags_Create_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Tags_Create_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Tags_Modify_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/cms.Tags/Modify", runtime.WithHTTPPathPattern("/cms.Tags/Modify"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Tags_Modify_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Tags_Modify_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Tags_Delete_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/cms.Tags/Delete", runtime.WithHTTPPathPattern("/cms.Tags/Delete"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Tags_Delete_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Tags_Delete_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_Tags_Fetch_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"cms.Tags", "Fetch"}, ""))
pattern_Tags_Create_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"cms.Tags", "Create"}, ""))
pattern_Tags_Modify_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"cms.Tags", "Modify"}, ""))
pattern_Tags_Delete_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"cms.Tags", "Delete"}, ""))
)
var (
forward_Tags_Fetch_0 = runtime.ForwardResponseMessage
forward_Tags_Create_0 = runtime.ForwardResponseMessage
forward_Tags_Modify_0 = runtime.ForwardResponseMessage
forward_Tags_Delete_0 = runtime.ForwardResponseMessage
)

View File

@@ -0,0 +1,247 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc (unknown)
// source: tags.proto
package cms
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_Fetch_FullMethodName = "/cms.Tags/Fetch"
Tags_Create_FullMethodName = "/cms.Tags/Create"
Tags_Modify_FullMethodName = "/cms.Tags/Modify"
Tags_Delete_FullMethodName = "/cms.Tags/Delete"
)
// 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 {
// 标签列表
Fetch(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*TagsListReply, error)
// 创建标签
Create(ctx context.Context, in *TagsItem, opts ...grpc.CallOption) (*StatusReply, error)
// 修改标签
Modify(ctx context.Context, in *TagsItem, opts ...grpc.CallOption) (*StatusReply, error)
// 删除标签
Delete(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) Fetch(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_Fetch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *tagsClient) Create(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_Create_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *tagsClient) Modify(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_Modify_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *tagsClient) Delete(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_Delete_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 {
// 标签列表
Fetch(context.Context, *IdentRequest) (*TagsListReply, error)
// 创建标签
Create(context.Context, *TagsItem) (*StatusReply, error)
// 修改标签
Modify(context.Context, *TagsItem) (*StatusReply, error)
// 删除标签
Delete(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) Fetch(context.Context, *IdentRequest) (*TagsListReply, error) {
return nil, status.Error(codes.Unimplemented, "method Fetch not implemented")
}
func (UnimplementedTagsServer) Create(context.Context, *TagsItem) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method Create not implemented")
}
func (UnimplementedTagsServer) Modify(context.Context, *TagsItem) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method Modify not implemented")
}
func (UnimplementedTagsServer) Delete(context.Context, *IdentRequest) (*StatusReply, error) {
return nil, status.Error(codes.Unimplemented, "method Delete 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 panics, 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_Fetch_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).Fetch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Tags_Fetch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TagsServer).Fetch(ctx, req.(*IdentRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Tags_Create_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).Create(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Tags_Create_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TagsServer).Create(ctx, req.(*TagsItem))
}
return interceptor(ctx, in, info, handler)
}
func _Tags_Modify_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).Modify(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Tags_Modify_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TagsServer).Modify(ctx, req.(*TagsItem))
}
return interceptor(ctx, in, info, handler)
}
func _Tags_Delete_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).Delete(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Tags_Delete_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TagsServer).Delete(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: "cms.Tags",
HandlerType: (*TagsServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Fetch",
Handler: _Tags_Fetch_Handler,
},
{
MethodName: "Create",
Handler: _Tags_Create_Handler,
},
{
MethodName: "Modify",
Handler: _Tags_Modify_Handler,
},
{
MethodName: "Delete",
Handler: _Tags_Delete_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "tags.proto",
}