feat: 添加搜索收藏微服务

This commit is contained in:
zetaloop
2026-04-24 13:24:58 +08:00
parent 91fdd2a498
commit 53d0e791b4
58 changed files with 6239 additions and 57 deletions
+615
View File
@@ -0,0 +1,615 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc v7.34.1
// source: search.proto
package pb
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)
)
// --------------------------------favorites--------------------------------
type Favorites struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
UserId int64 `protobuf:"varint,2,opt,name=userId,proto3" json:"userId,omitempty"`
TargetType string `protobuf:"bytes,3,opt,name=targetType,proto3" json:"targetType,omitempty"`
TargetId int64 `protobuf:"varint,4,opt,name=targetId,proto3" json:"targetId,omitempty"`
CreatedAt int64 `protobuf:"varint,5,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Favorites) Reset() {
*x = Favorites{}
mi := &file_search_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Favorites) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Favorites) ProtoMessage() {}
func (x *Favorites) ProtoReflect() protoreflect.Message {
mi := &file_search_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 Favorites.ProtoReflect.Descriptor instead.
func (*Favorites) Descriptor() ([]byte, []int) {
return file_search_proto_rawDescGZIP(), []int{0}
}
func (x *Favorites) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *Favorites) GetUserId() int64 {
if x != nil {
return x.UserId
}
return 0
}
func (x *Favorites) GetTargetType() string {
if x != nil {
return x.TargetType
}
return ""
}
func (x *Favorites) GetTargetId() int64 {
if x != nil {
return x.TargetId
}
return 0
}
func (x *Favorites) GetCreatedAt() int64 {
if x != nil {
return x.CreatedAt
}
return 0
}
type AddFavoritesReq struct {
state protoimpl.MessageState `protogen:"open.v1"`
UserId int64 `protobuf:"varint,1,opt,name=userId,proto3" json:"userId,omitempty"`
TargetType string `protobuf:"bytes,2,opt,name=targetType,proto3" json:"targetType,omitempty"`
TargetId int64 `protobuf:"varint,3,opt,name=targetId,proto3" json:"targetId,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *AddFavoritesReq) Reset() {
*x = AddFavoritesReq{}
mi := &file_search_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *AddFavoritesReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AddFavoritesReq) ProtoMessage() {}
func (x *AddFavoritesReq) ProtoReflect() protoreflect.Message {
mi := &file_search_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 AddFavoritesReq.ProtoReflect.Descriptor instead.
func (*AddFavoritesReq) Descriptor() ([]byte, []int) {
return file_search_proto_rawDescGZIP(), []int{1}
}
func (x *AddFavoritesReq) GetUserId() int64 {
if x != nil {
return x.UserId
}
return 0
}
func (x *AddFavoritesReq) GetTargetType() string {
if x != nil {
return x.TargetType
}
return ""
}
func (x *AddFavoritesReq) GetTargetId() int64 {
if x != nil {
return x.TargetId
}
return 0
}
type AddFavoritesResp struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *AddFavoritesResp) Reset() {
*x = AddFavoritesResp{}
mi := &file_search_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *AddFavoritesResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AddFavoritesResp) ProtoMessage() {}
func (x *AddFavoritesResp) ProtoReflect() protoreflect.Message {
mi := &file_search_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 AddFavoritesResp.ProtoReflect.Descriptor instead.
func (*AddFavoritesResp) Descriptor() ([]byte, []int) {
return file_search_proto_rawDescGZIP(), []int{2}
}
func (x *AddFavoritesResp) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
type DelFavoritesReq struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *DelFavoritesReq) Reset() {
*x = DelFavoritesReq{}
mi := &file_search_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *DelFavoritesReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DelFavoritesReq) ProtoMessage() {}
func (x *DelFavoritesReq) ProtoReflect() protoreflect.Message {
mi := &file_search_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 DelFavoritesReq.ProtoReflect.Descriptor instead.
func (*DelFavoritesReq) Descriptor() ([]byte, []int) {
return file_search_proto_rawDescGZIP(), []int{3}
}
func (x *DelFavoritesReq) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
type DelFavoritesResp struct {
state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *DelFavoritesResp) Reset() {
*x = DelFavoritesResp{}
mi := &file_search_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *DelFavoritesResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DelFavoritesResp) ProtoMessage() {}
func (x *DelFavoritesResp) ProtoReflect() protoreflect.Message {
mi := &file_search_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 DelFavoritesResp.ProtoReflect.Descriptor instead.
func (*DelFavoritesResp) Descriptor() ([]byte, []int) {
return file_search_proto_rawDescGZIP(), []int{4}
}
type GetFavoritesByIdReq struct {
state protoimpl.MessageState `protogen:"open.v1"`
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetFavoritesByIdReq) Reset() {
*x = GetFavoritesByIdReq{}
mi := &file_search_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetFavoritesByIdReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetFavoritesByIdReq) ProtoMessage() {}
func (x *GetFavoritesByIdReq) ProtoReflect() protoreflect.Message {
mi := &file_search_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 GetFavoritesByIdReq.ProtoReflect.Descriptor instead.
func (*GetFavoritesByIdReq) Descriptor() ([]byte, []int) {
return file_search_proto_rawDescGZIP(), []int{5}
}
func (x *GetFavoritesByIdReq) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
type GetFavoritesByIdResp struct {
state protoimpl.MessageState `protogen:"open.v1"`
Favorites *Favorites `protobuf:"bytes,1,opt,name=favorites,proto3" json:"favorites,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetFavoritesByIdResp) Reset() {
*x = GetFavoritesByIdResp{}
mi := &file_search_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetFavoritesByIdResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetFavoritesByIdResp) ProtoMessage() {}
func (x *GetFavoritesByIdResp) ProtoReflect() protoreflect.Message {
mi := &file_search_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 GetFavoritesByIdResp.ProtoReflect.Descriptor instead.
func (*GetFavoritesByIdResp) Descriptor() ([]byte, []int) {
return file_search_proto_rawDescGZIP(), []int{6}
}
func (x *GetFavoritesByIdResp) GetFavorites() *Favorites {
if x != nil {
return x.Favorites
}
return nil
}
type SearchFavoritesReq struct {
state protoimpl.MessageState `protogen:"open.v1"`
Offset int64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"`
Limit int64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"`
Id *int64 `protobuf:"varint,3,opt,name=id,proto3,oneof" json:"id,omitempty"`
UserId *int64 `protobuf:"varint,4,opt,name=userId,proto3,oneof" json:"userId,omitempty"`
TargetType *string `protobuf:"bytes,5,opt,name=targetType,proto3,oneof" json:"targetType,omitempty"`
TargetId *int64 `protobuf:"varint,6,opt,name=targetId,proto3,oneof" json:"targetId,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *SearchFavoritesReq) Reset() {
*x = SearchFavoritesReq{}
mi := &file_search_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *SearchFavoritesReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SearchFavoritesReq) ProtoMessage() {}
func (x *SearchFavoritesReq) ProtoReflect() protoreflect.Message {
mi := &file_search_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 SearchFavoritesReq.ProtoReflect.Descriptor instead.
func (*SearchFavoritesReq) Descriptor() ([]byte, []int) {
return file_search_proto_rawDescGZIP(), []int{7}
}
func (x *SearchFavoritesReq) GetOffset() int64 {
if x != nil {
return x.Offset
}
return 0
}
func (x *SearchFavoritesReq) GetLimit() int64 {
if x != nil {
return x.Limit
}
return 0
}
func (x *SearchFavoritesReq) GetId() int64 {
if x != nil && x.Id != nil {
return *x.Id
}
return 0
}
func (x *SearchFavoritesReq) GetUserId() int64 {
if x != nil && x.UserId != nil {
return *x.UserId
}
return 0
}
func (x *SearchFavoritesReq) GetTargetType() string {
if x != nil && x.TargetType != nil {
return *x.TargetType
}
return ""
}
func (x *SearchFavoritesReq) GetTargetId() int64 {
if x != nil && x.TargetId != nil {
return *x.TargetId
}
return 0
}
type SearchFavoritesResp struct {
state protoimpl.MessageState `protogen:"open.v1"`
Favorites []*Favorites `protobuf:"bytes,1,rep,name=favorites,proto3" json:"favorites,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *SearchFavoritesResp) Reset() {
*x = SearchFavoritesResp{}
mi := &file_search_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *SearchFavoritesResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SearchFavoritesResp) ProtoMessage() {}
func (x *SearchFavoritesResp) ProtoReflect() protoreflect.Message {
mi := &file_search_proto_msgTypes[8]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SearchFavoritesResp.ProtoReflect.Descriptor instead.
func (*SearchFavoritesResp) Descriptor() ([]byte, []int) {
return file_search_proto_rawDescGZIP(), []int{8}
}
func (x *SearchFavoritesResp) GetFavorites() []*Favorites {
if x != nil {
return x.Favorites
}
return nil
}
var File_search_proto protoreflect.FileDescriptor
const file_search_proto_rawDesc = "" +
"\n" +
"\fsearch.proto\x12\x02pb\"\x8d\x01\n" +
"\tFavorites\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x16\n" +
"\x06userId\x18\x02 \x01(\x03R\x06userId\x12\x1e\n" +
"\n" +
"targetType\x18\x03 \x01(\tR\n" +
"targetType\x12\x1a\n" +
"\btargetId\x18\x04 \x01(\x03R\btargetId\x12\x1c\n" +
"\tcreatedAt\x18\x05 \x01(\x03R\tcreatedAt\"e\n" +
"\x0fAddFavoritesReq\x12\x16\n" +
"\x06userId\x18\x01 \x01(\x03R\x06userId\x12\x1e\n" +
"\n" +
"targetType\x18\x02 \x01(\tR\n" +
"targetType\x12\x1a\n" +
"\btargetId\x18\x03 \x01(\x03R\btargetId\"\"\n" +
"\x10AddFavoritesResp\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\"!\n" +
"\x0fDelFavoritesReq\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\"\x12\n" +
"\x10DelFavoritesResp\"%\n" +
"\x13GetFavoritesByIdReq\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\"C\n" +
"\x14GetFavoritesByIdResp\x12+\n" +
"\tfavorites\x18\x01 \x01(\v2\r.pb.FavoritesR\tfavorites\"\xe8\x01\n" +
"\x12SearchFavoritesReq\x12\x16\n" +
"\x06offset\x18\x01 \x01(\x03R\x06offset\x12\x14\n" +
"\x05limit\x18\x02 \x01(\x03R\x05limit\x12\x13\n" +
"\x02id\x18\x03 \x01(\x03H\x00R\x02id\x88\x01\x01\x12\x1b\n" +
"\x06userId\x18\x04 \x01(\x03H\x01R\x06userId\x88\x01\x01\x12#\n" +
"\n" +
"targetType\x18\x05 \x01(\tH\x02R\n" +
"targetType\x88\x01\x01\x12\x1f\n" +
"\btargetId\x18\x06 \x01(\x03H\x03R\btargetId\x88\x01\x01B\x05\n" +
"\x03_idB\t\n" +
"\a_userIdB\r\n" +
"\v_targetTypeB\v\n" +
"\t_targetId\"B\n" +
"\x13SearchFavoritesResp\x12+\n" +
"\tfavorites\x18\x01 \x03(\v2\r.pb.FavoritesR\tfavorites2\x90\x02\n" +
"\rsearchService\x129\n" +
"\fAddFavorites\x12\x13.pb.AddFavoritesReq\x1a\x14.pb.AddFavoritesResp\x129\n" +
"\fDelFavorites\x12\x13.pb.DelFavoritesReq\x1a\x14.pb.DelFavoritesResp\x12E\n" +
"\x10GetFavoritesById\x12\x17.pb.GetFavoritesByIdReq\x1a\x18.pb.GetFavoritesByIdResp\x12B\n" +
"\x0fSearchFavorites\x12\x16.pb.SearchFavoritesReq\x1a\x17.pb.SearchFavoritesRespB\x06Z\x04./pbb\x06proto3"
var (
file_search_proto_rawDescOnce sync.Once
file_search_proto_rawDescData []byte
)
func file_search_proto_rawDescGZIP() []byte {
file_search_proto_rawDescOnce.Do(func() {
file_search_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_search_proto_rawDesc), len(file_search_proto_rawDesc)))
})
return file_search_proto_rawDescData
}
var file_search_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
var file_search_proto_goTypes = []any{
(*Favorites)(nil), // 0: pb.Favorites
(*AddFavoritesReq)(nil), // 1: pb.AddFavoritesReq
(*AddFavoritesResp)(nil), // 2: pb.AddFavoritesResp
(*DelFavoritesReq)(nil), // 3: pb.DelFavoritesReq
(*DelFavoritesResp)(nil), // 4: pb.DelFavoritesResp
(*GetFavoritesByIdReq)(nil), // 5: pb.GetFavoritesByIdReq
(*GetFavoritesByIdResp)(nil), // 6: pb.GetFavoritesByIdResp
(*SearchFavoritesReq)(nil), // 7: pb.SearchFavoritesReq
(*SearchFavoritesResp)(nil), // 8: pb.SearchFavoritesResp
}
var file_search_proto_depIdxs = []int32{
0, // 0: pb.GetFavoritesByIdResp.favorites:type_name -> pb.Favorites
0, // 1: pb.SearchFavoritesResp.favorites:type_name -> pb.Favorites
1, // 2: pb.searchService.AddFavorites:input_type -> pb.AddFavoritesReq
3, // 3: pb.searchService.DelFavorites:input_type -> pb.DelFavoritesReq
5, // 4: pb.searchService.GetFavoritesById:input_type -> pb.GetFavoritesByIdReq
7, // 5: pb.searchService.SearchFavorites:input_type -> pb.SearchFavoritesReq
2, // 6: pb.searchService.AddFavorites:output_type -> pb.AddFavoritesResp
4, // 7: pb.searchService.DelFavorites:output_type -> pb.DelFavoritesResp
6, // 8: pb.searchService.GetFavoritesById:output_type -> pb.GetFavoritesByIdResp
8, // 9: pb.searchService.SearchFavorites:output_type -> pb.SearchFavoritesResp
6, // [6:10] is the sub-list for method output_type
2, // [2:6] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_search_proto_init() }
func file_search_proto_init() {
if File_search_proto != nil {
return
}
file_search_proto_msgTypes[7].OneofWrappers = []any{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_search_proto_rawDesc), len(file_search_proto_rawDesc)),
NumEnums: 0,
NumMessages: 9,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_search_proto_goTypes,
DependencyIndexes: file_search_proto_depIdxs,
MessageInfos: file_search_proto_msgTypes,
}.Build()
File_search_proto = out.File
file_search_proto_goTypes = nil
file_search_proto_depIdxs = nil
}
+235
View File
@@ -0,0 +1,235 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc v7.34.1
// source: search.proto
package pb
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 (
SearchService_AddFavorites_FullMethodName = "/pb.searchService/AddFavorites"
SearchService_DelFavorites_FullMethodName = "/pb.searchService/DelFavorites"
SearchService_GetFavoritesById_FullMethodName = "/pb.searchService/GetFavoritesById"
SearchService_SearchFavorites_FullMethodName = "/pb.searchService/SearchFavorites"
)
// SearchServiceClient is the client API for SearchService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type SearchServiceClient interface {
AddFavorites(ctx context.Context, in *AddFavoritesReq, opts ...grpc.CallOption) (*AddFavoritesResp, error)
DelFavorites(ctx context.Context, in *DelFavoritesReq, opts ...grpc.CallOption) (*DelFavoritesResp, error)
GetFavoritesById(ctx context.Context, in *GetFavoritesByIdReq, opts ...grpc.CallOption) (*GetFavoritesByIdResp, error)
SearchFavorites(ctx context.Context, in *SearchFavoritesReq, opts ...grpc.CallOption) (*SearchFavoritesResp, error)
}
type searchServiceClient struct {
cc grpc.ClientConnInterface
}
func NewSearchServiceClient(cc grpc.ClientConnInterface) SearchServiceClient {
return &searchServiceClient{cc}
}
func (c *searchServiceClient) AddFavorites(ctx context.Context, in *AddFavoritesReq, opts ...grpc.CallOption) (*AddFavoritesResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(AddFavoritesResp)
err := c.cc.Invoke(ctx, SearchService_AddFavorites_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *searchServiceClient) DelFavorites(ctx context.Context, in *DelFavoritesReq, opts ...grpc.CallOption) (*DelFavoritesResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(DelFavoritesResp)
err := c.cc.Invoke(ctx, SearchService_DelFavorites_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *searchServiceClient) GetFavoritesById(ctx context.Context, in *GetFavoritesByIdReq, opts ...grpc.CallOption) (*GetFavoritesByIdResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetFavoritesByIdResp)
err := c.cc.Invoke(ctx, SearchService_GetFavoritesById_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *searchServiceClient) SearchFavorites(ctx context.Context, in *SearchFavoritesReq, opts ...grpc.CallOption) (*SearchFavoritesResp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(SearchFavoritesResp)
err := c.cc.Invoke(ctx, SearchService_SearchFavorites_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// SearchServiceServer is the server API for SearchService service.
// All implementations must embed UnimplementedSearchServiceServer
// for forward compatibility.
type SearchServiceServer interface {
AddFavorites(context.Context, *AddFavoritesReq) (*AddFavoritesResp, error)
DelFavorites(context.Context, *DelFavoritesReq) (*DelFavoritesResp, error)
GetFavoritesById(context.Context, *GetFavoritesByIdReq) (*GetFavoritesByIdResp, error)
SearchFavorites(context.Context, *SearchFavoritesReq) (*SearchFavoritesResp, error)
mustEmbedUnimplementedSearchServiceServer()
}
// UnimplementedSearchServiceServer 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 UnimplementedSearchServiceServer struct{}
func (UnimplementedSearchServiceServer) AddFavorites(context.Context, *AddFavoritesReq) (*AddFavoritesResp, error) {
return nil, status.Error(codes.Unimplemented, "method AddFavorites not implemented")
}
func (UnimplementedSearchServiceServer) DelFavorites(context.Context, *DelFavoritesReq) (*DelFavoritesResp, error) {
return nil, status.Error(codes.Unimplemented, "method DelFavorites not implemented")
}
func (UnimplementedSearchServiceServer) GetFavoritesById(context.Context, *GetFavoritesByIdReq) (*GetFavoritesByIdResp, error) {
return nil, status.Error(codes.Unimplemented, "method GetFavoritesById not implemented")
}
func (UnimplementedSearchServiceServer) SearchFavorites(context.Context, *SearchFavoritesReq) (*SearchFavoritesResp, error) {
return nil, status.Error(codes.Unimplemented, "method SearchFavorites not implemented")
}
func (UnimplementedSearchServiceServer) mustEmbedUnimplementedSearchServiceServer() {}
func (UnimplementedSearchServiceServer) testEmbeddedByValue() {}
// UnsafeSearchServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to SearchServiceServer will
// result in compilation errors.
type UnsafeSearchServiceServer interface {
mustEmbedUnimplementedSearchServiceServer()
}
func RegisterSearchServiceServer(s grpc.ServiceRegistrar, srv SearchServiceServer) {
// If the following call panics, it indicates UnimplementedSearchServiceServer 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(&SearchService_ServiceDesc, srv)
}
func _SearchService_AddFavorites_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AddFavoritesReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SearchServiceServer).AddFavorites(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SearchService_AddFavorites_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SearchServiceServer).AddFavorites(ctx, req.(*AddFavoritesReq))
}
return interceptor(ctx, in, info, handler)
}
func _SearchService_DelFavorites_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DelFavoritesReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SearchServiceServer).DelFavorites(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SearchService_DelFavorites_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SearchServiceServer).DelFavorites(ctx, req.(*DelFavoritesReq))
}
return interceptor(ctx, in, info, handler)
}
func _SearchService_GetFavoritesById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetFavoritesByIdReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SearchServiceServer).GetFavoritesById(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SearchService_GetFavoritesById_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SearchServiceServer).GetFavoritesById(ctx, req.(*GetFavoritesByIdReq))
}
return interceptor(ctx, in, info, handler)
}
func _SearchService_SearchFavorites_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SearchFavoritesReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SearchServiceServer).SearchFavorites(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SearchService_SearchFavorites_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SearchServiceServer).SearchFavorites(ctx, req.(*SearchFavoritesReq))
}
return interceptor(ctx, in, info, handler)
}
// SearchService_ServiceDesc is the grpc.ServiceDesc for SearchService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var SearchService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "pb.searchService",
HandlerType: (*SearchServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "AddFavorites",
Handler: _SearchService_AddFavorites_Handler,
},
{
MethodName: "DelFavorites",
Handler: _SearchService_DelFavorites_Handler,
},
{
MethodName: "GetFavoritesById",
Handler: _SearchService_GetFavoritesById_Handler,
},
{
MethodName: "SearchFavorites",
Handler: _SearchService_SearchFavorites_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "search.proto",
}