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,604 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.8
// protoc (unknown)
// source: blocks.proto
package relation
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type FetchRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
PageNo int64 `protobuf:"varint,1,opt,name=page_no,json=pageNo,proto3" json:"page_no,omitempty"` // 页数
PageSize int64 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` // 每页记录数
Params map[string]string `protobuf:"bytes,3,rep,name=params,proto3" json:"params,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` // 条件参数,key=val,eg key:category_id=?,vlaue=11
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *FetchRequest) Reset() {
*x = FetchRequest{}
mi := &file_blocks_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *FetchRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*FetchRequest) ProtoMessage() {}
func (x *FetchRequest) ProtoReflect() protoreflect.Message {
mi := &file_blocks_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use FetchRequest.ProtoReflect.Descriptor instead.
func (*FetchRequest) Descriptor() ([]byte, []int) {
return file_blocks_proto_rawDescGZIP(), []int{0}
}
func (x *FetchRequest) GetPageNo() int64 {
if x != nil {
return x.PageNo
}
return 0
}
func (x *FetchRequest) GetPageSize() int64 {
if x != nil {
return x.PageSize
}
return 0
}
func (x *FetchRequest) GetParams() map[string]string {
if x != nil {
return x.Params
}
return nil
}
type IdentRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // 唯一ID
Identity string `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"` // 唯一码
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *IdentRequest) Reset() {
*x = IdentRequest{}
mi := &file_blocks_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *IdentRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*IdentRequest) ProtoMessage() {}
func (x *IdentRequest) ProtoReflect() protoreflect.Message {
mi := &file_blocks_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use IdentRequest.ProtoReflect.Descriptor instead.
func (*IdentRequest) Descriptor() ([]byte, []int) {
return file_blocks_proto_rawDescGZIP(), []int{1}
}
func (x *IdentRequest) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *IdentRequest) GetIdentity() string {
if x != nil {
return x.Identity
}
return ""
}
type VersionRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Version int64 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` // 时序版本号
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *VersionRequest) Reset() {
*x = VersionRequest{}
mi := &file_blocks_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *VersionRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*VersionRequest) ProtoMessage() {}
func (x *VersionRequest) ProtoReflect() protoreflect.Message {
mi := &file_blocks_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use VersionRequest.ProtoReflect.Descriptor instead.
func (*VersionRequest) Descriptor() ([]byte, []int) {
return file_blocks_proto_rawDescGZIP(), []int{2}
}
func (x *VersionRequest) GetVersion() int64 {
if x != nil {
return x.Version
}
return 0
}
type SearchRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Keyword string `protobuf:"bytes,1,opt,name=keyword,proto3" json:"keyword,omitempty"` //关键词
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *SearchRequest) Reset() {
*x = SearchRequest{}
mi := &file_blocks_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *SearchRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SearchRequest) ProtoMessage() {}
func (x *SearchRequest) ProtoReflect() protoreflect.Message {
mi := &file_blocks_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SearchRequest.ProtoReflect.Descriptor instead.
func (*SearchRequest) Descriptor() ([]byte, []int) {
return file_blocks_proto_rawDescGZIP(), []int{3}
}
func (x *SearchRequest) GetKeyword() string {
if x != nil {
return x.Keyword
}
return ""
}
type StatusReply struct {
state protoimpl.MessageState `protogen:"open.v1"`
Data string `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` // 数据
Timeseq int64 `protobuf:"varint,2,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) GetData() string {
if x != nil {
return x.Data
}
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 RelationItem struct {
state protoimpl.MessageState `protogen:"open.v1"`
Identity string `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"`
Nickname string `protobuf:"bytes,2,opt,name=nickname,proto3" json:"nickname,omitempty"` //昵称
RemarkName string `protobuf:"bytes,3,opt,name=remark_name,json=remarkName,proto3" json:"remark_name,omitempty"` // 备注名称
Popular int32 `protobuf:"varint,4,opt,name=popular,proto3" json:"popular,omitempty"` //是否置顶
Avatar string `protobuf:"bytes,5,opt,name=avatar,proto3" json:"avatar,omitempty"`
Birthday string `protobuf:"bytes,6,opt,name=birthday,proto3" json:"birthday,omitempty"` //生日
Sex int32 `protobuf:"varint,7,opt,name=sex,proto3" json:"sex,omitempty"` //性别1为男性2为女性
Province int32 `protobuf:"varint,8,opt,name=province,proto3" json:"province,omitempty"` //省
City int32 `protobuf:"varint,9,opt,name=city,proto3" json:"city,omitempty"` //市
Area int32 `protobuf:"varint,10,opt,name=area,proto3" json:"area,omitempty"` //区
Sign string `protobuf:"bytes,11,opt,name=sign,proto3" json:"sign,omitempty"` //签名
Tags []string `protobuf:"bytes,12,rep,name=tags,proto3" json:"tags,omitempty"` //所属标签组
ForeignStatus int32 `protobuf:"varint,13,opt,name=foreign_status,json=foreignStatus,proto3" json:"foreign_status,omitempty"` //外表的状态值,根据表不同,值的作用不同
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *RelationItem) Reset() {
*x = RelationItem{}
mi := &file_blocks_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *RelationItem) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RelationItem) ProtoMessage() {}
func (x *RelationItem) 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 RelationItem.ProtoReflect.Descriptor instead.
func (*RelationItem) Descriptor() ([]byte, []int) {
return file_blocks_proto_rawDescGZIP(), []int{6}
}
func (x *RelationItem) GetIdentity() string {
if x != nil {
return x.Identity
}
return ""
}
func (x *RelationItem) GetNickname() string {
if x != nil {
return x.Nickname
}
return ""
}
func (x *RelationItem) GetRemarkName() string {
if x != nil {
return x.RemarkName
}
return ""
}
func (x *RelationItem) GetPopular() int32 {
if x != nil {
return x.Popular
}
return 0
}
func (x *RelationItem) GetAvatar() string {
if x != nil {
return x.Avatar
}
return ""
}
func (x *RelationItem) GetBirthday() string {
if x != nil {
return x.Birthday
}
return ""
}
func (x *RelationItem) GetSex() int32 {
if x != nil {
return x.Sex
}
return 0
}
func (x *RelationItem) GetProvince() int32 {
if x != nil {
return x.Province
}
return 0
}
func (x *RelationItem) GetCity() int32 {
if x != nil {
return x.City
}
return 0
}
func (x *RelationItem) GetArea() int32 {
if x != nil {
return x.Area
}
return 0
}
func (x *RelationItem) GetSign() string {
if x != nil {
return x.Sign
}
return ""
}
func (x *RelationItem) GetTags() []string {
if x != nil {
return x.Tags
}
return nil
}
func (x *RelationItem) GetForeignStatus() int32 {
if x != nil {
return x.ForeignStatus
}
return 0
}
type FetchRelationItemReply struct {
state protoimpl.MessageState `protogen:"open.v1"`
Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` // 总记录数
Data []*RelationItem `protobuf:"bytes,2,rep,name=data,proto3" json:"data,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *FetchRelationItemReply) Reset() {
*x = FetchRelationItemReply{}
mi := &file_blocks_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *FetchRelationItemReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*FetchRelationItemReply) ProtoMessage() {}
func (x *FetchRelationItemReply) 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 FetchRelationItemReply.ProtoReflect.Descriptor instead.
func (*FetchRelationItemReply) Descriptor() ([]byte, []int) {
return file_blocks_proto_rawDescGZIP(), []int{7}
}
func (x *FetchRelationItemReply) GetTotal() int64 {
if x != nil {
return x.Total
}
return 0
}
func (x *FetchRelationItemReply) GetData() []*RelationItem {
if x != nil {
return x.Data
}
return nil
}
var File_blocks_proto protoreflect.FileDescriptor
const file_blocks_proto_rawDesc = "" +
"\n" +
"\x15relation/blocks.proto\x12\brelation\"\xbb\x01\n" +
"\fFetchRequest\x12\x17\n" +
"\apage_no\x18\x01 \x01(\x03R\x06pageNo\x12\x1b\n" +
"\tpage_size\x18\x02 \x01(\x03R\bpageSize\x12:\n" +
"\x06params\x18\x03 \x03(\v2\".relation.FetchRequest.ParamsEntryR\x06params\x1a9\n" +
"\vParamsEntry\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\":\n" +
"\fIdentRequest\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x1a\n" +
"\bidentity\x18\x02 \x01(\tR\bidentity\"*\n" +
"\x0eVersionRequest\x12\x18\n" +
"\aversion\x18\x01 \x01(\x03R\aversion\")\n" +
"\rSearchRequest\x12\x18\n" +
"\akeyword\x18\x01 \x01(\tR\akeyword\";\n" +
"\vStatusReply\x12\x12\n" +
"\x04data\x18\x01 \x01(\tR\x04data\x12\x18\n" +
"\atimeseq\x18\x02 \x01(\x03R\atimeseq\"\a\n" +
"\x05Empty\"\xda\x02\n" +
"\fRelationItem\x12\x1a\n" +
"\bidentity\x18\x01 \x01(\tR\bidentity\x12\x1a\n" +
"\bnickname\x18\x02 \x01(\tR\bnickname\x12\x1f\n" +
"\vremark_name\x18\x03 \x01(\tR\n" +
"remarkName\x12\x18\n" +
"\apopular\x18\x04 \x01(\x05R\apopular\x12\x16\n" +
"\x06avatar\x18\x05 \x01(\tR\x06avatar\x12\x1a\n" +
"\bbirthday\x18\x06 \x01(\tR\bbirthday\x12\x10\n" +
"\x03sex\x18\a \x01(\x05R\x03sex\x12\x1a\n" +
"\bprovince\x18\b \x01(\x05R\bprovince\x12\x12\n" +
"\x04city\x18\t \x01(\x05R\x04city\x12\x12\n" +
"\x04area\x18\n" +
" \x01(\x05R\x04area\x12\x12\n" +
"\x04sign\x18\v \x01(\tR\x04sign\x12\x12\n" +
"\x04tags\x18\f \x03(\tR\x04tags\x12%\n" +
"\x0eforeign_status\x18\r \x01(\x05R\rforeignStatus\"Z\n" +
"\x16FetchRelationItemReply\x12\x14\n" +
"\x05total\x18\x01 \x01(\x03R\x05total\x12*\n" +
"\x04data\x18\x02 \x03(\v2\x16.relation.RelationItemR\x04dataB\fZ\n" +
".;relationb\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, 9)
var file_blocks_proto_goTypes = []any{
(*FetchRequest)(nil), // 0: relation.FetchRequest
(*IdentRequest)(nil), // 1: relation.IdentRequest
(*VersionRequest)(nil), // 2: relation.VersionRequest
(*SearchRequest)(nil), // 3: relation.SearchRequest
(*StatusReply)(nil), // 4: relation.StatusReply
(*Empty)(nil), // 5: relation.Empty
(*RelationItem)(nil), // 6: relation.RelationItem
(*FetchRelationItemReply)(nil), // 7: relation.FetchRelationItemReply
nil, // 8: relation.FetchRequest.ParamsEntry
}
var file_blocks_proto_depIdxs = []int32{
8, // 0: relation.FetchRequest.params:type_name -> relation.FetchRequest.ParamsEntry
6, // 1: relation.FetchRelationItemReply.data:type_name -> relation.RelationItem
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: 9,
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,79 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.8
// protoc (unknown)
// source: follow.proto
package relation
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
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)
)
var File_follow_proto protoreflect.FileDescriptor
const file_follow_proto_rawDesc = "" +
"\n" +
"\x1csocial/relation/follow.proto\x12\brelation\x1a\x15relation/blocks.proto2\xfa\x01\n" +
"\x06Follow\x128\n" +
"\x05Doing\x12\x16.relation.IdentRequest\x1a\x15.relation.StatusReply\"\x00\x127\n" +
"\x04Undo\x12\x16.relation.IdentRequest\x1a\x15.relation.StatusReply\"\x00\x128\n" +
"\x05State\x12\x16.relation.IdentRequest\x1a\x15.relation.StatusReply\"\x00\x12C\n" +
"\x05Fetch\x12\x16.relation.FetchRequest\x1a .relation.FetchRelationItemReply\"\x00B\fZ\n" +
".;relationb\x06proto3"
var file_follow_proto_goTypes = []any{
(*IdentRequest)(nil), // 0: relation.IdentRequest
(*FetchRequest)(nil), // 1: relation.FetchRequest
(*StatusReply)(nil), // 2: relation.StatusReply
(*FetchRelationItemReply)(nil), // 3: relation.FetchRelationItemReply
}
var file_follow_proto_depIdxs = []int32{
0, // 0: relation.Follow.Doing:input_type -> relation.IdentRequest
0, // 1: relation.Follow.Undo:input_type -> relation.IdentRequest
0, // 2: relation.Follow.State:input_type -> relation.IdentRequest
1, // 3: relation.Follow.Fetch:input_type -> relation.FetchRequest
2, // 4: relation.Follow.Doing:output_type -> relation.StatusReply
2, // 5: relation.Follow.Undo:output_type -> relation.StatusReply
2, // 6: relation.Follow.State:output_type -> relation.StatusReply
3, // 7: relation.Follow.Fetch:output_type -> relation.FetchRelationItemReply
4, // [4:8] is the sub-list for method output_type
0, // [0:4] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_follow_proto_init() }
func file_follow_proto_init() {
if File_follow_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_follow_proto_rawDesc), len(file_follow_proto_rawDesc)),
NumEnums: 0,
NumMessages: 0,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_follow_proto_goTypes,
DependencyIndexes: file_follow_proto_depIdxs,
}.Build()
File_follow_proto = out.File
file_follow_proto_goTypes = nil
file_follow_proto_depIdxs = nil
}

View File

@@ -0,0 +1,355 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: follow.proto
/*
Package relation is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package relation
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_Follow_Doing_0(ctx context.Context, marshaler runtime.Marshaler, client FollowClient, 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.Doing(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Follow_Doing_0(ctx context.Context, marshaler runtime.Marshaler, server FollowServer, 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.Doing(ctx, &protoReq)
return msg, metadata, err
}
func request_Follow_Undo_0(ctx context.Context, marshaler runtime.Marshaler, client FollowClient, 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.Undo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Follow_Undo_0(ctx context.Context, marshaler runtime.Marshaler, server FollowServer, 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.Undo(ctx, &protoReq)
return msg, metadata, err
}
func request_Follow_State_0(ctx context.Context, marshaler runtime.Marshaler, client FollowClient, 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.State(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Follow_State_0(ctx context.Context, marshaler runtime.Marshaler, server FollowServer, 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.State(ctx, &protoReq)
return msg, metadata, err
}
func request_Follow_Fetch_0(ctx context.Context, marshaler runtime.Marshaler, client FollowClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq FetchRequest
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_Follow_Fetch_0(ctx context.Context, marshaler runtime.Marshaler, server FollowServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq FetchRequest
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
}
// RegisterFollowHandlerServer registers the http handlers for service Follow to "mux".
// UnaryRPC :call FollowServer 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 RegisterFollowHandlerFromEndpoint 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 RegisterFollowHandlerServer(ctx context.Context, mux *runtime.ServeMux, server FollowServer) error {
mux.Handle(http.MethodPost, pattern_Follow_Doing_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, "/relation.Follow/Doing", runtime.WithHTTPPathPattern("/relation.Follow/Doing"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Follow_Doing_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_Follow_Doing_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Follow_Undo_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, "/relation.Follow/Undo", runtime.WithHTTPPathPattern("/relation.Follow/Undo"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Follow_Undo_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_Follow_Undo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Follow_State_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, "/relation.Follow/State", runtime.WithHTTPPathPattern("/relation.Follow/State"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Follow_State_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_Follow_State_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Follow_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, "/relation.Follow/Fetch", runtime.WithHTTPPathPattern("/relation.Follow/Fetch"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Follow_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_Follow_Fetch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterFollowHandlerFromEndpoint is same as RegisterFollowHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterFollowHandlerFromEndpoint(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 RegisterFollowHandler(ctx, mux, conn)
}
// RegisterFollowHandler registers the http handlers for service Follow to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterFollowHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterFollowHandlerClient(ctx, mux, NewFollowClient(conn))
}
// RegisterFollowHandlerClient registers the http handlers for service Follow
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "FollowClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "FollowClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "FollowClient" to call the correct interceptors. This client ignores the HTTP middlewares.
func RegisterFollowHandlerClient(ctx context.Context, mux *runtime.ServeMux, client FollowClient) error {
mux.Handle(http.MethodPost, pattern_Follow_Doing_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, "/relation.Follow/Doing", runtime.WithHTTPPathPattern("/relation.Follow/Doing"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Follow_Doing_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Follow_Doing_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Follow_Undo_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, "/relation.Follow/Undo", runtime.WithHTTPPathPattern("/relation.Follow/Undo"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Follow_Undo_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Follow_Undo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Follow_State_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, "/relation.Follow/State", runtime.WithHTTPPathPattern("/relation.Follow/State"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Follow_State_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Follow_State_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Follow_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, "/relation.Follow/Fetch", runtime.WithHTTPPathPattern("/relation.Follow/Fetch"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Follow_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_Follow_Fetch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_Follow_Doing_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"relation.Follow", "Doing"}, ""))
pattern_Follow_Undo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"relation.Follow", "Undo"}, ""))
pattern_Follow_State_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"relation.Follow", "State"}, ""))
pattern_Follow_Fetch_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"relation.Follow", "Fetch"}, ""))
)
var (
forward_Follow_Doing_0 = runtime.ForwardResponseMessage
forward_Follow_Undo_0 = runtime.ForwardResponseMessage
forward_Follow_State_0 = runtime.ForwardResponseMessage
forward_Follow_Fetch_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.5.1
// - protoc (unknown)
// source: follow.proto
package relation
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 (
Follow_Doing_FullMethodName = "/relation.Follow/Doing"
Follow_Undo_FullMethodName = "/relation.Follow/Undo"
Follow_State_FullMethodName = "/relation.Follow/State"
Follow_Fetch_FullMethodName = "/relation.Follow/Fetch"
)
// FollowClient is the client API for Follow 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.
//
// relation-关系管理:关注
type FollowClient interface {
// 执行关注
Doing(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error)
// 撤销关注
Undo(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error)
// 关注状态
State(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error)
// 获取关注列表
Fetch(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*FetchRelationItemReply, error)
}
type followClient struct {
cc grpc.ClientConnInterface
}
func NewFollowClient(cc grpc.ClientConnInterface) FollowClient {
return &followClient{cc}
}
func (c *followClient) Doing(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, Follow_Doing_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *followClient) Undo(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, Follow_Undo_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *followClient) State(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, Follow_State_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *followClient) Fetch(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*FetchRelationItemReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(FetchRelationItemReply)
err := c.cc.Invoke(ctx, Follow_Fetch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// FollowServer is the server API for Follow service.
// All implementations must embed UnimplementedFollowServer
// for forward compatibility.
//
// relation-关系管理:关注
type FollowServer interface {
// 执行关注
Doing(context.Context, *IdentRequest) (*StatusReply, error)
// 撤销关注
Undo(context.Context, *IdentRequest) (*StatusReply, error)
// 关注状态
State(context.Context, *IdentRequest) (*StatusReply, error)
// 获取关注列表
Fetch(context.Context, *FetchRequest) (*FetchRelationItemReply, error)
mustEmbedUnimplementedFollowServer()
}
// UnimplementedFollowServer 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 UnimplementedFollowServer struct{}
func (UnimplementedFollowServer) Doing(context.Context, *IdentRequest) (*StatusReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method Doing not implemented")
}
func (UnimplementedFollowServer) Undo(context.Context, *IdentRequest) (*StatusReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method Undo not implemented")
}
func (UnimplementedFollowServer) State(context.Context, *IdentRequest) (*StatusReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method State not implemented")
}
func (UnimplementedFollowServer) Fetch(context.Context, *FetchRequest) (*FetchRelationItemReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method Fetch not implemented")
}
func (UnimplementedFollowServer) mustEmbedUnimplementedFollowServer() {}
func (UnimplementedFollowServer) testEmbeddedByValue() {}
// UnsafeFollowServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to FollowServer will
// result in compilation errors.
type UnsafeFollowServer interface {
mustEmbedUnimplementedFollowServer()
}
func RegisterFollowServer(s grpc.ServiceRegistrar, srv FollowServer) {
// If the following call pancis, it indicates UnimplementedFollowServer 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(&Follow_ServiceDesc, srv)
}
func _Follow_Doing_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.(FollowServer).Doing(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Follow_Doing_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FollowServer).Doing(ctx, req.(*IdentRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Follow_Undo_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.(FollowServer).Undo(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Follow_Undo_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FollowServer).Undo(ctx, req.(*IdentRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Follow_State_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.(FollowServer).State(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Follow_State_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FollowServer).State(ctx, req.(*IdentRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Follow_Fetch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(FetchRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FollowServer).Fetch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Follow_Fetch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FollowServer).Fetch(ctx, req.(*FetchRequest))
}
return interceptor(ctx, in, info, handler)
}
// Follow_ServiceDesc is the grpc.ServiceDesc for Follow service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Follow_ServiceDesc = grpc.ServiceDesc{
ServiceName: "relation.Follow",
HandlerType: (*FollowServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Doing",
Handler: _Follow_Doing_Handler,
},
{
MethodName: "Undo",
Handler: _Follow_Undo_Handler,
},
{
MethodName: "State",
Handler: _Follow_State_Handler,
},
{
MethodName: "Fetch",
Handler: _Follow_Fetch_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "follow.proto",
}

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,767 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc (unknown)
// source: friend.proto
package relation
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 (
Friend_Search_FullMethodName = "/relation.Friend/Search"
Friend_Fetch_FullMethodName = "/relation.Friend/Fetch"
Friend_Get_FullMethodName = "/relation.Friend/Get"
Friend_ModifyNickname_FullMethodName = "/relation.Friend/ModifyNickname"
Friend_DoPopular_FullMethodName = "/relation.Friend/DoPopular"
Friend_UndoPopular_FullMethodName = "/relation.Friend/UndoPopular"
Friend_Delete_FullMethodName = "/relation.Friend/Delete"
Friend_ApplyFetch_FullMethodName = "/relation.Friend/ApplyFetch"
Friend_ApplyGet_FullMethodName = "/relation.Friend/ApplyGet"
Friend_ApplyDo_FullMethodName = "/relation.Friend/ApplyDo"
Friend_ApplyDoMessage_FullMethodName = "/relation.Friend/ApplyDoMessage"
Friend_ApplyDoPass_FullMethodName = "/relation.Friend/ApplyDoPass"
Friend_ApplyDoReject_FullMethodName = "/relation.Friend/ApplyDoReject"
Friend_TagFetch_FullMethodName = "/relation.Friend/TagFetch"
Friend_TagMemberFetch_FullMethodName = "/relation.Friend/TagMemberFetch"
Friend_TagDoCreate_FullMethodName = "/relation.Friend/TagDoCreate"
Friend_TagDoUpdate_FullMethodName = "/relation.Friend/TagDoUpdate"
)
// FriendClient is the client API for Friend 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.
//
// relation-关系管理:好友
type FriendClient interface {
//搜索
Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*PartFriendReply, error)
//获取好友列表
Fetch(ctx context.Context, in *VersionRequest, opts ...grpc.CallOption) (*FriendsReply, error)
//获取用户信息卡片
Get(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*RelationItem, error)
//修改好友备注名称,如果要清除备注,直接nickname传空值
ModifyNickname(ctx context.Context, in *ModifyNicknameRequest, opts ...grpc.CallOption) (*StatusReply, error)
//受你欢迎的,置顶
DoPopular(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error)
//取消受欢迎的,取消置顶
UndoPopular(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error)
//删除好友
Delete(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error)
//好友申请列表
ApplyFetch(ctx context.Context, in *VersionRequest, opts ...grpc.CallOption) (*ApplyFetchReply, error)
//好友申请详情
ApplyGet(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*FriendApplyGetReply, error)
//好友申请
ApplyDo(ctx context.Context, in *ApplyDoRequest, opts ...grpc.CallOption) (*StatusReply, error)
//好友申请Do:留言
ApplyDoMessage(ctx context.Context, in *ApplyMessageRequest, opts ...grpc.CallOption) (*StatusReply, error)
//好友申请Do:确认
ApplyDoPass(ctx context.Context, in *ApplyDoPassRequest, opts ...grpc.CallOption) (*StatusReply, error)
//好友申请Do:拒绝
ApplyDoReject(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error)
//获取标签列表
TagFetch(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*FriendTagsReply, error)
//获取标签成员
TagMemberFetch(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*PartFriendReply, error)
//创建标签
TagDoCreate(ctx context.Context, in *TagDoCreateRequest, opts ...grpc.CallOption) (*StatusReply, error)
//更新标签成员
TagDoUpdate(ctx context.Context, in *TagDoUpdateRequest, opts ...grpc.CallOption) (*StatusReply, error)
}
type friendClient struct {
cc grpc.ClientConnInterface
}
func NewFriendClient(cc grpc.ClientConnInterface) FriendClient {
return &friendClient{cc}
}
func (c *friendClient) Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*PartFriendReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(PartFriendReply)
err := c.cc.Invoke(ctx, Friend_Search_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *friendClient) Fetch(ctx context.Context, in *VersionRequest, opts ...grpc.CallOption) (*FriendsReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(FriendsReply)
err := c.cc.Invoke(ctx, Friend_Fetch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *friendClient) Get(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*RelationItem, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(RelationItem)
err := c.cc.Invoke(ctx, Friend_Get_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *friendClient) ModifyNickname(ctx context.Context, in *ModifyNicknameRequest, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Friend_ModifyNickname_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *friendClient) DoPopular(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, Friend_DoPopular_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *friendClient) UndoPopular(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, Friend_UndoPopular_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *friendClient) 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, Friend_Delete_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *friendClient) ApplyFetch(ctx context.Context, in *VersionRequest, opts ...grpc.CallOption) (*ApplyFetchReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ApplyFetchReply)
err := c.cc.Invoke(ctx, Friend_ApplyFetch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *friendClient) ApplyGet(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*FriendApplyGetReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(FriendApplyGetReply)
err := c.cc.Invoke(ctx, Friend_ApplyGet_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *friendClient) ApplyDo(ctx context.Context, in *ApplyDoRequest, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Friend_ApplyDo_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *friendClient) ApplyDoMessage(ctx context.Context, in *ApplyMessageRequest, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Friend_ApplyDoMessage_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *friendClient) ApplyDoPass(ctx context.Context, in *ApplyDoPassRequest, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Friend_ApplyDoPass_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *friendClient) ApplyDoReject(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, Friend_ApplyDoReject_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *friendClient) TagFetch(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*FriendTagsReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(FriendTagsReply)
err := c.cc.Invoke(ctx, Friend_TagFetch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *friendClient) TagMemberFetch(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*PartFriendReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(PartFriendReply)
err := c.cc.Invoke(ctx, Friend_TagMemberFetch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *friendClient) TagDoCreate(ctx context.Context, in *TagDoCreateRequest, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Friend_TagDoCreate_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *friendClient) TagDoUpdate(ctx context.Context, in *TagDoUpdateRequest, opts ...grpc.CallOption) (*StatusReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(StatusReply)
err := c.cc.Invoke(ctx, Friend_TagDoUpdate_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// FriendServer is the server API for Friend service.
// All implementations must embed UnimplementedFriendServer
// for forward compatibility.
//
// relation-关系管理:好友
type FriendServer interface {
//搜索
Search(context.Context, *SearchRequest) (*PartFriendReply, error)
//获取好友列表
Fetch(context.Context, *VersionRequest) (*FriendsReply, error)
//获取用户信息卡片
Get(context.Context, *IdentRequest) (*RelationItem, error)
//修改好友备注名称,如果要清除备注,直接nickname传空值
ModifyNickname(context.Context, *ModifyNicknameRequest) (*StatusReply, error)
//受你欢迎的,置顶
DoPopular(context.Context, *IdentRequest) (*StatusReply, error)
//取消受欢迎的,取消置顶
UndoPopular(context.Context, *IdentRequest) (*StatusReply, error)
//删除好友
Delete(context.Context, *IdentRequest) (*StatusReply, error)
//好友申请列表
ApplyFetch(context.Context, *VersionRequest) (*ApplyFetchReply, error)
//好友申请详情
ApplyGet(context.Context, *IdentRequest) (*FriendApplyGetReply, error)
//好友申请
ApplyDo(context.Context, *ApplyDoRequest) (*StatusReply, error)
//好友申请Do:留言
ApplyDoMessage(context.Context, *ApplyMessageRequest) (*StatusReply, error)
//好友申请Do:确认
ApplyDoPass(context.Context, *ApplyDoPassRequest) (*StatusReply, error)
//好友申请Do:拒绝
ApplyDoReject(context.Context, *IdentRequest) (*StatusReply, error)
//获取标签列表
TagFetch(context.Context, *Empty) (*FriendTagsReply, error)
//获取标签成员
TagMemberFetch(context.Context, *IdentRequest) (*PartFriendReply, error)
//创建标签
TagDoCreate(context.Context, *TagDoCreateRequest) (*StatusReply, error)
//更新标签成员
TagDoUpdate(context.Context, *TagDoUpdateRequest) (*StatusReply, error)
mustEmbedUnimplementedFriendServer()
}
// UnimplementedFriendServer 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 UnimplementedFriendServer struct{}
func (UnimplementedFriendServer) Search(context.Context, *SearchRequest) (*PartFriendReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method Search not implemented")
}
func (UnimplementedFriendServer) Fetch(context.Context, *VersionRequest) (*FriendsReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method Fetch not implemented")
}
func (UnimplementedFriendServer) Get(context.Context, *IdentRequest) (*RelationItem, error) {
return nil, status.Errorf(codes.Unimplemented, "method Get not implemented")
}
func (UnimplementedFriendServer) ModifyNickname(context.Context, *ModifyNicknameRequest) (*StatusReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method ModifyNickname not implemented")
}
func (UnimplementedFriendServer) DoPopular(context.Context, *IdentRequest) (*StatusReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method DoPopular not implemented")
}
func (UnimplementedFriendServer) UndoPopular(context.Context, *IdentRequest) (*StatusReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method UndoPopular not implemented")
}
func (UnimplementedFriendServer) Delete(context.Context, *IdentRequest) (*StatusReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented")
}
func (UnimplementedFriendServer) ApplyFetch(context.Context, *VersionRequest) (*ApplyFetchReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method ApplyFetch not implemented")
}
func (UnimplementedFriendServer) ApplyGet(context.Context, *IdentRequest) (*FriendApplyGetReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method ApplyGet not implemented")
}
func (UnimplementedFriendServer) ApplyDo(context.Context, *ApplyDoRequest) (*StatusReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method ApplyDo not implemented")
}
func (UnimplementedFriendServer) ApplyDoMessage(context.Context, *ApplyMessageRequest) (*StatusReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method ApplyDoMessage not implemented")
}
func (UnimplementedFriendServer) ApplyDoPass(context.Context, *ApplyDoPassRequest) (*StatusReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method ApplyDoPass not implemented")
}
func (UnimplementedFriendServer) ApplyDoReject(context.Context, *IdentRequest) (*StatusReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method ApplyDoReject not implemented")
}
func (UnimplementedFriendServer) TagFetch(context.Context, *Empty) (*FriendTagsReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method TagFetch not implemented")
}
func (UnimplementedFriendServer) TagMemberFetch(context.Context, *IdentRequest) (*PartFriendReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method TagMemberFetch not implemented")
}
func (UnimplementedFriendServer) TagDoCreate(context.Context, *TagDoCreateRequest) (*StatusReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method TagDoCreate not implemented")
}
func (UnimplementedFriendServer) TagDoUpdate(context.Context, *TagDoUpdateRequest) (*StatusReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method TagDoUpdate not implemented")
}
func (UnimplementedFriendServer) mustEmbedUnimplementedFriendServer() {}
func (UnimplementedFriendServer) testEmbeddedByValue() {}
// UnsafeFriendServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to FriendServer will
// result in compilation errors.
type UnsafeFriendServer interface {
mustEmbedUnimplementedFriendServer()
}
func RegisterFriendServer(s grpc.ServiceRegistrar, srv FriendServer) {
// If the following call pancis, it indicates UnimplementedFriendServer 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(&Friend_ServiceDesc, srv)
}
func _Friend_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.(FriendServer).Search(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Friend_Search_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FriendServer).Search(ctx, req.(*SearchRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Friend_Fetch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(VersionRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FriendServer).Fetch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Friend_Fetch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FriendServer).Fetch(ctx, req.(*VersionRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Friend_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.(FriendServer).Get(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Friend_Get_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FriendServer).Get(ctx, req.(*IdentRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Friend_ModifyNickname_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ModifyNicknameRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FriendServer).ModifyNickname(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Friend_ModifyNickname_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FriendServer).ModifyNickname(ctx, req.(*ModifyNicknameRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Friend_DoPopular_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.(FriendServer).DoPopular(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Friend_DoPopular_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FriendServer).DoPopular(ctx, req.(*IdentRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Friend_UndoPopular_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.(FriendServer).UndoPopular(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Friend_UndoPopular_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FriendServer).UndoPopular(ctx, req.(*IdentRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Friend_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.(FriendServer).Delete(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Friend_Delete_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FriendServer).Delete(ctx, req.(*IdentRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Friend_ApplyFetch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(VersionRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FriendServer).ApplyFetch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Friend_ApplyFetch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FriendServer).ApplyFetch(ctx, req.(*VersionRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Friend_ApplyGet_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.(FriendServer).ApplyGet(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Friend_ApplyGet_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FriendServer).ApplyGet(ctx, req.(*IdentRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Friend_ApplyDo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ApplyDoRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FriendServer).ApplyDo(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Friend_ApplyDo_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FriendServer).ApplyDo(ctx, req.(*ApplyDoRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Friend_ApplyDoMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ApplyMessageRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FriendServer).ApplyDoMessage(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Friend_ApplyDoMessage_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FriendServer).ApplyDoMessage(ctx, req.(*ApplyMessageRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Friend_ApplyDoPass_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ApplyDoPassRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FriendServer).ApplyDoPass(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Friend_ApplyDoPass_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FriendServer).ApplyDoPass(ctx, req.(*ApplyDoPassRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Friend_ApplyDoReject_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.(FriendServer).ApplyDoReject(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Friend_ApplyDoReject_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FriendServer).ApplyDoReject(ctx, req.(*IdentRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Friend_TagFetch_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.(FriendServer).TagFetch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Friend_TagFetch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FriendServer).TagFetch(ctx, req.(*Empty))
}
return interceptor(ctx, in, info, handler)
}
func _Friend_TagMemberFetch_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.(FriendServer).TagMemberFetch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Friend_TagMemberFetch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FriendServer).TagMemberFetch(ctx, req.(*IdentRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Friend_TagDoCreate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(TagDoCreateRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FriendServer).TagDoCreate(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Friend_TagDoCreate_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FriendServer).TagDoCreate(ctx, req.(*TagDoCreateRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Friend_TagDoUpdate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(TagDoUpdateRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FriendServer).TagDoUpdate(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Friend_TagDoUpdate_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FriendServer).TagDoUpdate(ctx, req.(*TagDoUpdateRequest))
}
return interceptor(ctx, in, info, handler)
}
// Friend_ServiceDesc is the grpc.ServiceDesc for Friend service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Friend_ServiceDesc = grpc.ServiceDesc{
ServiceName: "relation.Friend",
HandlerType: (*FriendServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Search",
Handler: _Friend_Search_Handler,
},
{
MethodName: "Fetch",
Handler: _Friend_Fetch_Handler,
},
{
MethodName: "Get",
Handler: _Friend_Get_Handler,
},
{
MethodName: "ModifyNickname",
Handler: _Friend_ModifyNickname_Handler,
},
{
MethodName: "DoPopular",
Handler: _Friend_DoPopular_Handler,
},
{
MethodName: "UndoPopular",
Handler: _Friend_UndoPopular_Handler,
},
{
MethodName: "Delete",
Handler: _Friend_Delete_Handler,
},
{
MethodName: "ApplyFetch",
Handler: _Friend_ApplyFetch_Handler,
},
{
MethodName: "ApplyGet",
Handler: _Friend_ApplyGet_Handler,
},
{
MethodName: "ApplyDo",
Handler: _Friend_ApplyDo_Handler,
},
{
MethodName: "ApplyDoMessage",
Handler: _Friend_ApplyDoMessage_Handler,
},
{
MethodName: "ApplyDoPass",
Handler: _Friend_ApplyDoPass_Handler,
},
{
MethodName: "ApplyDoReject",
Handler: _Friend_ApplyDoReject_Handler,
},
{
MethodName: "TagFetch",
Handler: _Friend_TagFetch_Handler,
},
{
MethodName: "TagMemberFetch",
Handler: _Friend_TagMemberFetch_Handler,
},
{
MethodName: "TagDoCreate",
Handler: _Friend_TagDoCreate_Handler,
},
{
MethodName: "TagDoUpdate",
Handler: _Friend_TagDoUpdate_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "friend.proto",
}

View File

@@ -0,0 +1,80 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.8
// protoc (unknown)
// source: match.proto
package relation
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
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)
)
var File_match_proto protoreflect.FileDescriptor
const file_match_proto_rawDesc = "" +
"\n" +
"\x1bsocial/relation/match.proto\x12\brelation\x1a\x15relation/blocks.proto2\xfd\x01\n" +
"\x05Match\x12C\n" +
"\x05Fetch\x12\x16.relation.FetchRequest\x1a .relation.FetchRelationItemReply\"\x00\x127\n" +
"\x03Get\x12\x16.relation.IdentRequest\x1a\x16.relation.RelationItem\"\x00\x129\n" +
"\x06DoJoin\x12\x16.relation.IdentRequest\x1a\x15.relation.StatusReply\"\x00\x12;\n" +
"\bDoIgnore\x12\x16.relation.IdentRequest\x1a\x15.relation.StatusReply\"\x00B\fZ\n" +
".;relationb\x06proto3"
var file_match_proto_goTypes = []any{
(*FetchRequest)(nil), // 0: relation.FetchRequest
(*IdentRequest)(nil), // 1: relation.IdentRequest
(*FetchRelationItemReply)(nil), // 2: relation.FetchRelationItemReply
(*RelationItem)(nil), // 3: relation.RelationItem
(*StatusReply)(nil), // 4: relation.StatusReply
}
var file_match_proto_depIdxs = []int32{
0, // 0: relation.Match.Fetch:input_type -> relation.FetchRequest
1, // 1: relation.Match.Get:input_type -> relation.IdentRequest
1, // 2: relation.Match.DoJoin:input_type -> relation.IdentRequest
1, // 3: relation.Match.DoIgnore:input_type -> relation.IdentRequest
2, // 4: relation.Match.Fetch:output_type -> relation.FetchRelationItemReply
3, // 5: relation.Match.Get:output_type -> relation.RelationItem
4, // 6: relation.Match.DoJoin:output_type -> relation.StatusReply
4, // 7: relation.Match.DoIgnore:output_type -> relation.StatusReply
4, // [4:8] is the sub-list for method output_type
0, // [0:4] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_match_proto_init() }
func file_match_proto_init() {
if File_match_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_match_proto_rawDesc), len(file_match_proto_rawDesc)),
NumEnums: 0,
NumMessages: 0,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_match_proto_goTypes,
DependencyIndexes: file_match_proto_depIdxs,
}.Build()
File_match_proto = out.File
file_match_proto_goTypes = nil
file_match_proto_depIdxs = nil
}

View File

@@ -0,0 +1,355 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: match.proto
/*
Package relation is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package relation
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_Match_Fetch_0(ctx context.Context, marshaler runtime.Marshaler, client MatchClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq FetchRequest
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_Match_Fetch_0(ctx context.Context, marshaler runtime.Marshaler, server MatchServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq FetchRequest
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_Match_Get_0(ctx context.Context, marshaler runtime.Marshaler, client MatchClient, 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_Match_Get_0(ctx context.Context, marshaler runtime.Marshaler, server MatchServer, 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_Match_DoJoin_0(ctx context.Context, marshaler runtime.Marshaler, client MatchClient, 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.DoJoin(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Match_DoJoin_0(ctx context.Context, marshaler runtime.Marshaler, server MatchServer, 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.DoJoin(ctx, &protoReq)
return msg, metadata, err
}
func request_Match_DoIgnore_0(ctx context.Context, marshaler runtime.Marshaler, client MatchClient, 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.DoIgnore(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Match_DoIgnore_0(ctx context.Context, marshaler runtime.Marshaler, server MatchServer, 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.DoIgnore(ctx, &protoReq)
return msg, metadata, err
}
// RegisterMatchHandlerServer registers the http handlers for service Match to "mux".
// UnaryRPC :call MatchServer 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 RegisterMatchHandlerFromEndpoint 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 RegisterMatchHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MatchServer) error {
mux.Handle(http.MethodPost, pattern_Match_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, "/relation.Match/Fetch", runtime.WithHTTPPathPattern("/relation.Match/Fetch"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Match_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_Match_Fetch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Match_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, "/relation.Match/Get", runtime.WithHTTPPathPattern("/relation.Match/Get"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Match_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_Match_Get_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Match_DoJoin_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, "/relation.Match/DoJoin", runtime.WithHTTPPathPattern("/relation.Match/DoJoin"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Match_DoJoin_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_Match_DoJoin_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Match_DoIgnore_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, "/relation.Match/DoIgnore", runtime.WithHTTPPathPattern("/relation.Match/DoIgnore"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Match_DoIgnore_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_Match_DoIgnore_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterMatchHandlerFromEndpoint is same as RegisterMatchHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterMatchHandlerFromEndpoint(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 RegisterMatchHandler(ctx, mux, conn)
}
// RegisterMatchHandler registers the http handlers for service Match to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterMatchHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterMatchHandlerClient(ctx, mux, NewMatchClient(conn))
}
// RegisterMatchHandlerClient registers the http handlers for service Match
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "MatchClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "MatchClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "MatchClient" to call the correct interceptors. This client ignores the HTTP middlewares.
func RegisterMatchHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MatchClient) error {
mux.Handle(http.MethodPost, pattern_Match_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, "/relation.Match/Fetch", runtime.WithHTTPPathPattern("/relation.Match/Fetch"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Match_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_Match_Fetch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Match_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, "/relation.Match/Get", runtime.WithHTTPPathPattern("/relation.Match/Get"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Match_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_Match_Get_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Match_DoJoin_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, "/relation.Match/DoJoin", runtime.WithHTTPPathPattern("/relation.Match/DoJoin"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Match_DoJoin_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Match_DoJoin_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_Match_DoIgnore_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, "/relation.Match/DoIgnore", runtime.WithHTTPPathPattern("/relation.Match/DoIgnore"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Match_DoIgnore_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Match_DoIgnore_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_Match_Fetch_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"relation.Match", "Fetch"}, ""))
pattern_Match_Get_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"relation.Match", "Get"}, ""))
pattern_Match_DoJoin_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"relation.Match", "DoJoin"}, ""))
pattern_Match_DoIgnore_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"relation.Match", "DoIgnore"}, ""))
)
var (
forward_Match_Fetch_0 = runtime.ForwardResponseMessage
forward_Match_Get_0 = runtime.ForwardResponseMessage
forward_Match_DoJoin_0 = runtime.ForwardResponseMessage
forward_Match_DoIgnore_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.5.1
// - protoc (unknown)
// source: match.proto
package relation
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 (
Match_Fetch_FullMethodName = "/relation.Match/Fetch"
Match_Get_FullMethodName = "/relation.Match/Get"
Match_DoJoin_FullMethodName = "/relation.Match/DoJoin"
Match_DoIgnore_FullMethodName = "/relation.Match/DoIgnore"
)
// MatchClient is the client API for Match 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.
//
// relation-关系管理:匹配
type MatchClient interface {
// 获取匹配列表
Fetch(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*FetchRelationItemReply, error)
// 获取匹配详情
Get(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*RelationItem, error)
// 执行通过,加为好友
DoJoin(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error)
// 执行忽略
DoIgnore(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error)
}
type matchClient struct {
cc grpc.ClientConnInterface
}
func NewMatchClient(cc grpc.ClientConnInterface) MatchClient {
return &matchClient{cc}
}
func (c *matchClient) Fetch(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*FetchRelationItemReply, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(FetchRelationItemReply)
err := c.cc.Invoke(ctx, Match_Fetch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *matchClient) Get(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*RelationItem, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(RelationItem)
err := c.cc.Invoke(ctx, Match_Get_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *matchClient) DoJoin(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, Match_DoJoin_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *matchClient) DoIgnore(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, Match_DoIgnore_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// MatchServer is the server API for Match service.
// All implementations must embed UnimplementedMatchServer
// for forward compatibility.
//
// relation-关系管理:匹配
type MatchServer interface {
// 获取匹配列表
Fetch(context.Context, *FetchRequest) (*FetchRelationItemReply, error)
// 获取匹配详情
Get(context.Context, *IdentRequest) (*RelationItem, error)
// 执行通过,加为好友
DoJoin(context.Context, *IdentRequest) (*StatusReply, error)
// 执行忽略
DoIgnore(context.Context, *IdentRequest) (*StatusReply, error)
mustEmbedUnimplementedMatchServer()
}
// UnimplementedMatchServer 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 UnimplementedMatchServer struct{}
func (UnimplementedMatchServer) Fetch(context.Context, *FetchRequest) (*FetchRelationItemReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method Fetch not implemented")
}
func (UnimplementedMatchServer) Get(context.Context, *IdentRequest) (*RelationItem, error) {
return nil, status.Errorf(codes.Unimplemented, "method Get not implemented")
}
func (UnimplementedMatchServer) DoJoin(context.Context, *IdentRequest) (*StatusReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method DoJoin not implemented")
}
func (UnimplementedMatchServer) DoIgnore(context.Context, *IdentRequest) (*StatusReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method DoIgnore not implemented")
}
func (UnimplementedMatchServer) mustEmbedUnimplementedMatchServer() {}
func (UnimplementedMatchServer) testEmbeddedByValue() {}
// UnsafeMatchServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to MatchServer will
// result in compilation errors.
type UnsafeMatchServer interface {
mustEmbedUnimplementedMatchServer()
}
func RegisterMatchServer(s grpc.ServiceRegistrar, srv MatchServer) {
// If the following call pancis, it indicates UnimplementedMatchServer 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(&Match_ServiceDesc, srv)
}
func _Match_Fetch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(FetchRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MatchServer).Fetch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Match_Fetch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MatchServer).Fetch(ctx, req.(*FetchRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Match_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.(MatchServer).Get(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Match_Get_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MatchServer).Get(ctx, req.(*IdentRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Match_DoJoin_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.(MatchServer).DoJoin(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Match_DoJoin_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MatchServer).DoJoin(ctx, req.(*IdentRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Match_DoIgnore_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.(MatchServer).DoIgnore(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Match_DoIgnore_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MatchServer).DoIgnore(ctx, req.(*IdentRequest))
}
return interceptor(ctx, in, info, handler)
}
// Match_ServiceDesc is the grpc.ServiceDesc for Match service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Match_ServiceDesc = grpc.ServiceDesc{
ServiceName: "relation.Match",
HandlerType: (*MatchServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Fetch",
Handler: _Match_Fetch_Handler,
},
{
MethodName: "Get",
Handler: _Match_Get_Handler,
},
{
MethodName: "DoJoin",
Handler: _Match_DoJoin_Handler,
},
{
MethodName: "DoIgnore",
Handler: _Match_DoIgnore_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "match.proto",
}