393 lines
11 KiB
Go
393 lines
11 KiB
Go
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||
// versions:
|
||
// protoc-gen-go v1.36.11
|
||
// protoc v7.34.0
|
||
// source: common.proto
|
||
|
||
package common
|
||
|
||
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 StatusCode int32
|
||
|
||
const (
|
||
StatusCode_STATUS_UNSPECIFIED StatusCode = 0
|
||
StatusCode_STATUS_OK StatusCode = 200
|
||
StatusCode_STATUS_BAD_REQUEST StatusCode = 400
|
||
StatusCode_STATUS_UNAUTHORIZED StatusCode = 401
|
||
StatusCode_STATUS_FORBIDDEN StatusCode = 403
|
||
StatusCode_STATUS_NOT_FOUND StatusCode = 404
|
||
StatusCode_STATUS_TOO_MANY_REQUESTS StatusCode = 429
|
||
StatusCode_STATUS_INTERNAL_ERROR StatusCode = 500
|
||
)
|
||
|
||
// Enum value maps for StatusCode.
|
||
var (
|
||
StatusCode_name = map[int32]string{
|
||
0: "STATUS_UNSPECIFIED",
|
||
200: "STATUS_OK",
|
||
400: "STATUS_BAD_REQUEST",
|
||
401: "STATUS_UNAUTHORIZED",
|
||
403: "STATUS_FORBIDDEN",
|
||
404: "STATUS_NOT_FOUND",
|
||
429: "STATUS_TOO_MANY_REQUESTS",
|
||
500: "STATUS_INTERNAL_ERROR",
|
||
}
|
||
StatusCode_value = map[string]int32{
|
||
"STATUS_UNSPECIFIED": 0,
|
||
"STATUS_OK": 200,
|
||
"STATUS_BAD_REQUEST": 400,
|
||
"STATUS_UNAUTHORIZED": 401,
|
||
"STATUS_FORBIDDEN": 403,
|
||
"STATUS_NOT_FOUND": 404,
|
||
"STATUS_TOO_MANY_REQUESTS": 429,
|
||
"STATUS_INTERNAL_ERROR": 500,
|
||
}
|
||
)
|
||
|
||
func (x StatusCode) Enum() *StatusCode {
|
||
p := new(StatusCode)
|
||
*p = x
|
||
return p
|
||
}
|
||
|
||
func (x StatusCode) String() string {
|
||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||
}
|
||
|
||
func (StatusCode) Descriptor() protoreflect.EnumDescriptor {
|
||
return file_common_proto_enumTypes[0].Descriptor()
|
||
}
|
||
|
||
func (StatusCode) Type() protoreflect.EnumType {
|
||
return &file_common_proto_enumTypes[0]
|
||
}
|
||
|
||
func (x StatusCode) Number() protoreflect.EnumNumber {
|
||
return protoreflect.EnumNumber(x)
|
||
}
|
||
|
||
// Deprecated: Use StatusCode.Descriptor instead.
|
||
func (StatusCode) EnumDescriptor() ([]byte, []int) {
|
||
return file_common_proto_rawDescGZIP(), []int{0}
|
||
}
|
||
|
||
// 通用响应结构
|
||
type BaseResponse struct {
|
||
state protoimpl.MessageState `protogen:"open.v1"`
|
||
Code StatusCode `protobuf:"varint,1,opt,name=code,proto3,enum=topfans.common.StatusCode" json:"code,omitempty"` // 状态码
|
||
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` // 错误信息(成功时为空)
|
||
Timestamp int64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // 响应时间戳(Unix时间戳毫秒)
|
||
unknownFields protoimpl.UnknownFields
|
||
sizeCache protoimpl.SizeCache
|
||
}
|
||
|
||
func (x *BaseResponse) Reset() {
|
||
*x = BaseResponse{}
|
||
mi := &file_common_proto_msgTypes[0]
|
||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||
ms.StoreMessageInfo(mi)
|
||
}
|
||
|
||
func (x *BaseResponse) String() string {
|
||
return protoimpl.X.MessageStringOf(x)
|
||
}
|
||
|
||
func (*BaseResponse) ProtoMessage() {}
|
||
|
||
func (x *BaseResponse) ProtoReflect() protoreflect.Message {
|
||
mi := &file_common_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 BaseResponse.ProtoReflect.Descriptor instead.
|
||
func (*BaseResponse) Descriptor() ([]byte, []int) {
|
||
return file_common_proto_rawDescGZIP(), []int{0}
|
||
}
|
||
|
||
func (x *BaseResponse) GetCode() StatusCode {
|
||
if x != nil {
|
||
return x.Code
|
||
}
|
||
return StatusCode_STATUS_UNSPECIFIED
|
||
}
|
||
|
||
func (x *BaseResponse) GetMessage() string {
|
||
if x != nil {
|
||
return x.Message
|
||
}
|
||
return ""
|
||
}
|
||
|
||
func (x *BaseResponse) GetTimestamp() int64 {
|
||
if x != nil {
|
||
return x.Timestamp
|
||
}
|
||
return 0
|
||
}
|
||
|
||
// 分页请求--如好友功能
|
||
type PageRequest struct {
|
||
state protoimpl.MessageState `protogen:"open.v1"`
|
||
Page int32 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` // 页码,从1开始
|
||
PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` // 每页数量
|
||
unknownFields protoimpl.UnknownFields
|
||
sizeCache protoimpl.SizeCache
|
||
}
|
||
|
||
func (x *PageRequest) Reset() {
|
||
*x = PageRequest{}
|
||
mi := &file_common_proto_msgTypes[1]
|
||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||
ms.StoreMessageInfo(mi)
|
||
}
|
||
|
||
func (x *PageRequest) String() string {
|
||
return protoimpl.X.MessageStringOf(x)
|
||
}
|
||
|
||
func (*PageRequest) ProtoMessage() {}
|
||
|
||
func (x *PageRequest) ProtoReflect() protoreflect.Message {
|
||
mi := &file_common_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 PageRequest.ProtoReflect.Descriptor instead.
|
||
func (*PageRequest) Descriptor() ([]byte, []int) {
|
||
return file_common_proto_rawDescGZIP(), []int{1}
|
||
}
|
||
|
||
func (x *PageRequest) GetPage() int32 {
|
||
if x != nil {
|
||
return x.Page
|
||
}
|
||
return 0
|
||
}
|
||
|
||
func (x *PageRequest) GetPageSize() int32 {
|
||
if x != nil {
|
||
return x.PageSize
|
||
}
|
||
return 0
|
||
}
|
||
|
||
// 分页响应
|
||
type PageResponse struct {
|
||
state protoimpl.MessageState `protogen:"open.v1"`
|
||
Page int32 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"`
|
||
PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
|
||
Total int64 `protobuf:"varint,3,opt,name=total,proto3" json:"total,omitempty"` // 总记录数
|
||
TotalPages int32 `protobuf:"varint,4,opt,name=total_pages,json=totalPages,proto3" json:"total_pages,omitempty"` // 总页数
|
||
unknownFields protoimpl.UnknownFields
|
||
sizeCache protoimpl.SizeCache
|
||
}
|
||
|
||
func (x *PageResponse) Reset() {
|
||
*x = PageResponse{}
|
||
mi := &file_common_proto_msgTypes[2]
|
||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||
ms.StoreMessageInfo(mi)
|
||
}
|
||
|
||
func (x *PageResponse) String() string {
|
||
return protoimpl.X.MessageStringOf(x)
|
||
}
|
||
|
||
func (*PageResponse) ProtoMessage() {}
|
||
|
||
func (x *PageResponse) ProtoReflect() protoreflect.Message {
|
||
mi := &file_common_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 PageResponse.ProtoReflect.Descriptor instead.
|
||
func (*PageResponse) Descriptor() ([]byte, []int) {
|
||
return file_common_proto_rawDescGZIP(), []int{2}
|
||
}
|
||
|
||
func (x *PageResponse) GetPage() int32 {
|
||
if x != nil {
|
||
return x.Page
|
||
}
|
||
return 0
|
||
}
|
||
|
||
func (x *PageResponse) GetPageSize() int32 {
|
||
if x != nil {
|
||
return x.PageSize
|
||
}
|
||
return 0
|
||
}
|
||
|
||
func (x *PageResponse) GetTotal() int64 {
|
||
if x != nil {
|
||
return x.Total
|
||
}
|
||
return 0
|
||
}
|
||
|
||
func (x *PageResponse) GetTotalPages() int32 {
|
||
if x != nil {
|
||
return x.TotalPages
|
||
}
|
||
return 0
|
||
}
|
||
|
||
// 空消息(用于无参数的RPC方法)
|
||
type Empty struct {
|
||
state protoimpl.MessageState `protogen:"open.v1"`
|
||
unknownFields protoimpl.UnknownFields
|
||
sizeCache protoimpl.SizeCache
|
||
}
|
||
|
||
func (x *Empty) Reset() {
|
||
*x = Empty{}
|
||
mi := &file_common_proto_msgTypes[3]
|
||
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_common_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 Empty.ProtoReflect.Descriptor instead.
|
||
func (*Empty) Descriptor() ([]byte, []int) {
|
||
return file_common_proto_rawDescGZIP(), []int{3}
|
||
}
|
||
|
||
var File_common_proto protoreflect.FileDescriptor
|
||
|
||
const file_common_proto_rawDesc = "" +
|
||
"\n" +
|
||
"\fcommon.proto\x12\x0etopfans.common\"v\n" +
|
||
"\fBaseResponse\x12.\n" +
|
||
"\x04code\x18\x01 \x01(\x0e2\x1a.topfans.common.StatusCodeR\x04code\x12\x18\n" +
|
||
"\amessage\x18\x02 \x01(\tR\amessage\x12\x1c\n" +
|
||
"\ttimestamp\x18\x03 \x01(\x03R\ttimestamp\">\n" +
|
||
"\vPageRequest\x12\x12\n" +
|
||
"\x04page\x18\x01 \x01(\x05R\x04page\x12\x1b\n" +
|
||
"\tpage_size\x18\x02 \x01(\x05R\bpageSize\"v\n" +
|
||
"\fPageResponse\x12\x12\n" +
|
||
"\x04page\x18\x01 \x01(\x05R\x04page\x12\x1b\n" +
|
||
"\tpage_size\x18\x02 \x01(\x05R\bpageSize\x12\x14\n" +
|
||
"\x05total\x18\x03 \x01(\x03R\x05total\x12\x1f\n" +
|
||
"\vtotal_pages\x18\x04 \x01(\x05R\n" +
|
||
"totalPages\"\a\n" +
|
||
"\x05Empty*\xd0\x01\n" +
|
||
"\n" +
|
||
"StatusCode\x12\x16\n" +
|
||
"\x12STATUS_UNSPECIFIED\x10\x00\x12\x0e\n" +
|
||
"\tSTATUS_OK\x10\xc8\x01\x12\x17\n" +
|
||
"\x12STATUS_BAD_REQUEST\x10\x90\x03\x12\x18\n" +
|
||
"\x13STATUS_UNAUTHORIZED\x10\x91\x03\x12\x15\n" +
|
||
"\x10STATUS_FORBIDDEN\x10\x93\x03\x12\x15\n" +
|
||
"\x10STATUS_NOT_FOUND\x10\x94\x03\x12\x1d\n" +
|
||
"\x18STATUS_TOO_MANY_REQUESTS\x10\xad\x03\x12\x1a\n" +
|
||
"\x15STATUS_INTERNAL_ERROR\x10\xf4\x03B4Z2github.com/topfans/backend/pkg/proto/common;commonb\x06proto3"
|
||
|
||
var (
|
||
file_common_proto_rawDescOnce sync.Once
|
||
file_common_proto_rawDescData []byte
|
||
)
|
||
|
||
func file_common_proto_rawDescGZIP() []byte {
|
||
file_common_proto_rawDescOnce.Do(func() {
|
||
file_common_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_common_proto_rawDesc), len(file_common_proto_rawDesc)))
|
||
})
|
||
return file_common_proto_rawDescData
|
||
}
|
||
|
||
var file_common_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||
var file_common_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||
var file_common_proto_goTypes = []any{
|
||
(StatusCode)(0), // 0: topfans.common.StatusCode
|
||
(*BaseResponse)(nil), // 1: topfans.common.BaseResponse
|
||
(*PageRequest)(nil), // 2: topfans.common.PageRequest
|
||
(*PageResponse)(nil), // 3: topfans.common.PageResponse
|
||
(*Empty)(nil), // 4: topfans.common.Empty
|
||
}
|
||
var file_common_proto_depIdxs = []int32{
|
||
0, // 0: topfans.common.BaseResponse.code:type_name -> topfans.common.StatusCode
|
||
1, // [1:1] is the sub-list for method output_type
|
||
1, // [1:1] is the sub-list for method input_type
|
||
1, // [1:1] is the sub-list for extension type_name
|
||
1, // [1:1] is the sub-list for extension extendee
|
||
0, // [0:1] is the sub-list for field type_name
|
||
}
|
||
|
||
func init() { file_common_proto_init() }
|
||
func file_common_proto_init() {
|
||
if File_common_proto != nil {
|
||
return
|
||
}
|
||
type x struct{}
|
||
out := protoimpl.TypeBuilder{
|
||
File: protoimpl.DescBuilder{
|
||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_common_proto_rawDesc), len(file_common_proto_rawDesc)),
|
||
NumEnums: 1,
|
||
NumMessages: 4,
|
||
NumExtensions: 0,
|
||
NumServices: 0,
|
||
},
|
||
GoTypes: file_common_proto_goTypes,
|
||
DependencyIndexes: file_common_proto_depIdxs,
|
||
EnumInfos: file_common_proto_enumTypes,
|
||
MessageInfos: file_common_proto_msgTypes,
|
||
}.Build()
|
||
File_common_proto = out.File
|
||
file_common_proto_goTypes = nil
|
||
file_common_proto_depIdxs = nil
|
||
}
|