Documentation ¶
Overview ¶
Package v1 is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterSearchServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterSearchServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SearchServiceClient) error
- func RegisterSearchServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterSearchServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SearchServiceServer) error
- func RegisterSearchServiceServer(s grpc.ServiceRegistrar, srv SearchServiceServer)
- type AsyncSearchResponse
- func (*AsyncSearchResponse) Descriptor() ([]byte, []int)deprecated
- func (x *AsyncSearchResponse) GetProduct() *Product
- func (*AsyncSearchResponse) ProtoMessage()
- func (x *AsyncSearchResponse) ProtoReflect() protoreflect.Message
- func (x *AsyncSearchResponse) Reset()
- func (x *AsyncSearchResponse) String() string
- type Category
- type CropRequest
- type CropResponse
- func (*CropResponse) Descriptor() ([]byte, []int)deprecated
- func (x *CropResponse) GetBottomRight() *Position
- func (x *CropResponse) GetTopLeft() *Position
- func (*CropResponse) ProtoMessage()
- func (x *CropResponse) ProtoReflect() protoreflect.Message
- func (x *CropResponse) Reset()
- func (x *CropResponse) String() string
- type Position
- type Product
- func (*Product) Descriptor() ([]byte, []int)deprecated
- func (x *Product) GetCategories() []*Category
- func (x *Product) GetId() int32
- func (x *Product) GetImageUrl() string
- func (x *Product) GetPrice() int64
- func (x *Product) GetRate() *Rating
- func (x *Product) GetScore() float32
- func (x *Product) GetStatus() string
- func (x *Product) GetTitle() string
- func (x *Product) GetUrl() string
- func (*Product) ProtoMessage()
- func (x *Product) ProtoReflect() protoreflect.Message
- func (x *Product) Reset()
- func (x *Product) String() string
- type Ranker
- type Rating
- type SearchParams
- func (*SearchParams) Descriptor() ([]byte, []int)deprecated
- func (x *SearchParams) GetRanker() Ranker
- func (x *SearchParams) GetTopK() int32
- func (*SearchParams) ProtoMessage()
- func (x *SearchParams) ProtoReflect() protoreflect.Message
- func (x *SearchParams) Reset()
- func (x *SearchParams) String() string
- type SearchRequest
- func (*SearchRequest) Descriptor() ([]byte, []int)deprecated
- func (x *SearchRequest) GetImage() []byte
- func (x *SearchRequest) GetParams() *SearchParams
- func (*SearchRequest) ProtoMessage()
- func (x *SearchRequest) ProtoReflect() protoreflect.Message
- func (x *SearchRequest) Reset()
- func (x *SearchRequest) String() string
- type SearchResponse
- type SearchServiceClient
- type SearchServiceServer
- type SearchService_AsyncSearchClient
- type SearchService_AsyncSearchServer
- type UnimplementedSearchServiceServer
- func (UnimplementedSearchServiceServer) AsyncSearch(*SearchRequest, SearchService_AsyncSearchServer) error
- func (UnimplementedSearchServiceServer) Crop(context.Context, *CropRequest) (*CropResponse, error)
- func (UnimplementedSearchServiceServer) Search(context.Context, *SearchRequest) (*SearchResponse, error)
- type UnsafeSearchServiceServer
Constants ¶
This section is empty.
Variables ¶
var ( Ranker_name = map[int32]string{ 0: "FIRST_IMAGE", 1: "DIST_COUNT", } Ranker_value = map[string]int32{ "FIRST_IMAGE": 0, "DIST_COUNT": 1, } )
Enum value maps for Ranker.
var File_search_proto protoreflect.FileDescriptor
var SearchService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "v1.SearchService", HandlerType: (*SearchServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Search", Handler: _SearchService_Search_Handler, }, { MethodName: "Crop", Handler: _SearchService_Crop_Handler, }, }, Streams: []grpc.StreamDesc{ { StreamName: "AsyncSearch", Handler: _SearchService_AsyncSearch_Handler, ServerStreams: true, }, }, Metadata: "search.proto", }
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)
Functions ¶
func RegisterSearchServiceHandler ¶
func RegisterSearchServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterSearchServiceHandler registers the http handlers for service SearchService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterSearchServiceHandlerClient ¶
func RegisterSearchServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SearchServiceClient) error
RegisterSearchServiceHandlerClient registers the http handlers for service SearchService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "SearchServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "SearchServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "SearchServiceClient" to call the correct interceptors.
func RegisterSearchServiceHandlerFromEndpoint ¶
func RegisterSearchServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterSearchServiceHandlerFromEndpoint is same as RegisterSearchServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterSearchServiceHandlerServer ¶
func RegisterSearchServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SearchServiceServer) error
RegisterSearchServiceHandlerServer registers the http handlers for service SearchService to "mux". UnaryRPC :call SearchServiceServer 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 RegisterSearchServiceHandlerFromEndpoint instead.
func RegisterSearchServiceServer ¶
func RegisterSearchServiceServer(s grpc.ServiceRegistrar, srv SearchServiceServer)
Types ¶
type AsyncSearchResponse ¶ added in v0.2.0
type AsyncSearchResponse struct { Product *Product `protobuf:"bytes,1,opt,name=product,proto3" json:"product,omitempty"` // contains filtered or unexported fields }
func (*AsyncSearchResponse) Descriptor
deprecated
added in
v0.2.0
func (*AsyncSearchResponse) Descriptor() ([]byte, []int)
Deprecated: Use AsyncSearchResponse.ProtoReflect.Descriptor instead.
func (*AsyncSearchResponse) GetProduct ¶ added in v0.2.0
func (x *AsyncSearchResponse) GetProduct() *Product
func (*AsyncSearchResponse) ProtoMessage ¶ added in v0.2.0
func (*AsyncSearchResponse) ProtoMessage()
func (*AsyncSearchResponse) ProtoReflect ¶ added in v0.2.0
func (x *AsyncSearchResponse) ProtoReflect() protoreflect.Message
func (*AsyncSearchResponse) Reset ¶ added in v0.2.0
func (x *AsyncSearchResponse) Reset()
func (*AsyncSearchResponse) String ¶ added in v0.2.0
func (x *AsyncSearchResponse) String() string
type Category ¶
type Category struct { Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` // contains filtered or unexported fields }
func (*Category) Descriptor
deprecated
func (*Category) ProtoMessage ¶
func (*Category) ProtoMessage()
func (*Category) ProtoReflect ¶
func (x *Category) ProtoReflect() protoreflect.Message
type CropRequest ¶
type CropRequest struct { Image []byte `protobuf:"bytes,1,opt,name=image,proto3" json:"image,omitempty"` // contains filtered or unexported fields }
func (*CropRequest) Descriptor
deprecated
func (*CropRequest) Descriptor() ([]byte, []int)
Deprecated: Use CropRequest.ProtoReflect.Descriptor instead.
func (*CropRequest) GetImage ¶
func (x *CropRequest) GetImage() []byte
func (*CropRequest) ProtoMessage ¶
func (*CropRequest) ProtoMessage()
func (*CropRequest) ProtoReflect ¶
func (x *CropRequest) ProtoReflect() protoreflect.Message
func (*CropRequest) Reset ¶
func (x *CropRequest) Reset()
func (*CropRequest) String ¶
func (x *CropRequest) String() string
type CropResponse ¶
type CropResponse struct { TopLeft *Position `protobuf:"bytes,1,opt,name=top_left,json=topLeft,proto3" json:"top_left,omitempty"` BottomRight *Position `protobuf:"bytes,2,opt,name=bottom_right,json=bottomRight,proto3" json:"bottom_right,omitempty"` // contains filtered or unexported fields }
func (*CropResponse) Descriptor
deprecated
func (*CropResponse) Descriptor() ([]byte, []int)
Deprecated: Use CropResponse.ProtoReflect.Descriptor instead.
func (*CropResponse) GetBottomRight ¶
func (x *CropResponse) GetBottomRight() *Position
func (*CropResponse) GetTopLeft ¶
func (x *CropResponse) GetTopLeft() *Position
func (*CropResponse) ProtoMessage ¶
func (*CropResponse) ProtoMessage()
func (*CropResponse) ProtoReflect ¶
func (x *CropResponse) ProtoReflect() protoreflect.Message
func (*CropResponse) Reset ¶
func (x *CropResponse) Reset()
func (*CropResponse) String ¶
func (x *CropResponse) String() string
type Position ¶
type Position struct { X int32 `protobuf:"varint,1,opt,name=x,proto3" json:"x,omitempty"` Y int32 `protobuf:"varint,2,opt,name=y,proto3" json:"y,omitempty"` // contains filtered or unexported fields }
func (*Position) Descriptor
deprecated
func (*Position) ProtoMessage ¶
func (*Position) ProtoMessage()
func (*Position) ProtoReflect ¶
func (x *Position) ProtoReflect() protoreflect.Message
type Product ¶
type Product struct { Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Score float32 `protobuf:"fixed32,2,opt,name=score,proto3" json:"score,omitempty"` Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"` Url string `protobuf:"bytes,4,opt,name=url,proto3" json:"url,omitempty"` Status string `protobuf:"bytes,5,opt,name=status,proto3" json:"status,omitempty"` ImageUrl string `protobuf:"bytes,6,opt,name=image_url,json=imageUrl,proto3" json:"image_url,omitempty"` Rate *Rating `protobuf:"bytes,7,opt,name=rate,proto3" json:"rate,omitempty"` Categories []*Category `protobuf:"bytes,8,rep,name=categories,proto3" json:"categories,omitempty"` Price int64 `protobuf:"varint,9,opt,name=price,proto3" json:"price,omitempty"` // contains filtered or unexported fields }
func (*Product) Descriptor
deprecated
func (*Product) GetCategories ¶
func (*Product) GetImageUrl ¶
func (*Product) ProtoMessage ¶
func (*Product) ProtoMessage()
func (*Product) ProtoReflect ¶
func (x *Product) ProtoReflect() protoreflect.Message
type Ranker ¶ added in v1.0.0
type Ranker int32
func (Ranker) Descriptor ¶ added in v1.0.0
func (Ranker) Descriptor() protoreflect.EnumDescriptor
func (Ranker) EnumDescriptor
deprecated
added in
v1.0.0
func (Ranker) Number ¶ added in v1.0.0
func (x Ranker) Number() protoreflect.EnumNumber
func (Ranker) Type ¶ added in v1.0.0
func (Ranker) Type() protoreflect.EnumType
type Rating ¶
type Rating struct { Rate int32 `protobuf:"varint,1,opt,name=rate,proto3" json:"rate,omitempty"` Count int32 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"` // contains filtered or unexported fields }
func (*Rating) Descriptor
deprecated
func (*Rating) ProtoMessage ¶
func (*Rating) ProtoMessage()
func (*Rating) ProtoReflect ¶
func (x *Rating) ProtoReflect() protoreflect.Message
type SearchParams ¶ added in v1.0.0
type SearchParams struct { TopK int32 `protobuf:"varint,1,opt,name=top_k,json=topK,proto3" json:"top_k,omitempty"` Ranker Ranker `protobuf:"varint,2,opt,name=ranker,proto3,enum=v1.Ranker" json:"ranker,omitempty"` // contains filtered or unexported fields }
func (*SearchParams) Descriptor
deprecated
added in
v1.0.0
func (*SearchParams) Descriptor() ([]byte, []int)
Deprecated: Use SearchParams.ProtoReflect.Descriptor instead.
func (*SearchParams) GetRanker ¶ added in v1.0.0
func (x *SearchParams) GetRanker() Ranker
func (*SearchParams) GetTopK ¶ added in v1.0.0
func (x *SearchParams) GetTopK() int32
func (*SearchParams) ProtoMessage ¶ added in v1.0.0
func (*SearchParams) ProtoMessage()
func (*SearchParams) ProtoReflect ¶ added in v1.0.0
func (x *SearchParams) ProtoReflect() protoreflect.Message
func (*SearchParams) Reset ¶ added in v1.0.0
func (x *SearchParams) Reset()
func (*SearchParams) String ¶ added in v1.0.0
func (x *SearchParams) String() string
type SearchRequest ¶
type SearchRequest struct { Image []byte `protobuf:"bytes,1,opt,name=image,proto3" json:"image,omitempty"` Params *SearchParams `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` // contains filtered or unexported fields }
func (*SearchRequest) Descriptor
deprecated
func (*SearchRequest) Descriptor() ([]byte, []int)
Deprecated: Use SearchRequest.ProtoReflect.Descriptor instead.
func (*SearchRequest) GetImage ¶
func (x *SearchRequest) GetImage() []byte
func (*SearchRequest) GetParams ¶ added in v1.0.0
func (x *SearchRequest) GetParams() *SearchParams
func (*SearchRequest) ProtoMessage ¶
func (*SearchRequest) ProtoMessage()
func (*SearchRequest) ProtoReflect ¶
func (x *SearchRequest) ProtoReflect() protoreflect.Message
func (*SearchRequest) Reset ¶
func (x *SearchRequest) Reset()
func (*SearchRequest) String ¶
func (x *SearchRequest) String() string
type SearchResponse ¶
type SearchResponse struct { Products []*Product `protobuf:"bytes,1,rep,name=products,proto3" json:"products,omitempty"` // contains filtered or unexported fields }
func (*SearchResponse) Descriptor
deprecated
func (*SearchResponse) Descriptor() ([]byte, []int)
Deprecated: Use SearchResponse.ProtoReflect.Descriptor instead.
func (*SearchResponse) GetProducts ¶
func (x *SearchResponse) GetProducts() []*Product
func (*SearchResponse) ProtoMessage ¶
func (*SearchResponse) ProtoMessage()
func (*SearchResponse) ProtoReflect ¶
func (x *SearchResponse) ProtoReflect() protoreflect.Message
func (*SearchResponse) Reset ¶
func (x *SearchResponse) Reset()
func (*SearchResponse) String ¶
func (x *SearchResponse) String() string
type SearchServiceClient ¶
type SearchServiceClient interface { Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*SearchResponse, error) AsyncSearch(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (SearchService_AsyncSearchClient, error) Crop(ctx context.Context, in *CropRequest, opts ...grpc.CallOption) (*CropResponse, error) }
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.
func NewSearchServiceClient ¶
func NewSearchServiceClient(cc grpc.ClientConnInterface) SearchServiceClient
type SearchServiceServer ¶
type SearchServiceServer interface { Search(context.Context, *SearchRequest) (*SearchResponse, error) AsyncSearch(*SearchRequest, SearchService_AsyncSearchServer) error Crop(context.Context, *CropRequest) (*CropResponse, error) // contains filtered or unexported methods }
SearchServiceServer is the server API for SearchService service. All implementations must embed UnimplementedSearchServiceServer for forward compatibility
type SearchService_AsyncSearchClient ¶ added in v0.2.0
type SearchService_AsyncSearchClient interface { Recv() (*AsyncSearchResponse, error) grpc.ClientStream }
type SearchService_AsyncSearchServer ¶ added in v0.2.0
type SearchService_AsyncSearchServer interface { Send(*AsyncSearchResponse) error grpc.ServerStream }
type UnimplementedSearchServiceServer ¶
type UnimplementedSearchServiceServer struct { }
UnimplementedSearchServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedSearchServiceServer) AsyncSearch ¶ added in v0.2.0
func (UnimplementedSearchServiceServer) AsyncSearch(*SearchRequest, SearchService_AsyncSearchServer) error
func (UnimplementedSearchServiceServer) Crop ¶
func (UnimplementedSearchServiceServer) Crop(context.Context, *CropRequest) (*CropResponse, error)
func (UnimplementedSearchServiceServer) Search ¶
func (UnimplementedSearchServiceServer) Search(context.Context, *SearchRequest) (*SearchResponse, error)
type UnsafeSearchServiceServer ¶
type UnsafeSearchServiceServer interface {
// contains filtered or unexported methods
}
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.