v1

package
v1.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package v1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
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.

View Source
var File_search_proto protoreflect.FileDescriptor
View Source
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) Descriptor() ([]byte, []int)

Deprecated: Use Category.ProtoReflect.Descriptor instead.

func (*Category) GetTitle

func (x *Category) GetTitle() string

func (*Category) GetUrl

func (x *Category) GetUrl() string

func (*Category) ProtoMessage

func (*Category) ProtoMessage()

func (*Category) ProtoReflect

func (x *Category) ProtoReflect() protoreflect.Message

func (*Category) Reset

func (x *Category) Reset()

func (*Category) String

func (x *Category) String() string

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) Descriptor() ([]byte, []int)

Deprecated: Use Position.ProtoReflect.Descriptor instead.

func (*Position) GetX

func (x *Position) GetX() int32

func (*Position) GetY

func (x *Position) GetY() int32

func (*Position) ProtoMessage

func (*Position) ProtoMessage()

func (*Position) ProtoReflect

func (x *Position) ProtoReflect() protoreflect.Message

func (*Position) Reset

func (x *Position) Reset()

func (*Position) String

func (x *Position) String() string

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) Descriptor() ([]byte, []int)

Deprecated: Use Product.ProtoReflect.Descriptor instead.

func (*Product) GetCategories

func (x *Product) GetCategories() []*Category

func (*Product) GetId

func (x *Product) GetId() int32

func (*Product) GetImageUrl

func (x *Product) GetImageUrl() string

func (*Product) GetPrice

func (x *Product) GetPrice() int64

func (*Product) GetRate

func (x *Product) GetRate() *Rating

func (*Product) GetScore

func (x *Product) GetScore() float32

func (*Product) GetStatus

func (x *Product) GetStatus() string

func (*Product) GetTitle

func (x *Product) GetTitle() string

func (*Product) GetUrl

func (x *Product) GetUrl() string

func (*Product) ProtoMessage

func (*Product) ProtoMessage()

func (*Product) ProtoReflect

func (x *Product) ProtoReflect() protoreflect.Message

func (*Product) Reset

func (x *Product) Reset()

func (*Product) String

func (x *Product) String() string

type Ranker added in v1.0.0

type Ranker int32
const (
	Ranker_FIRST_IMAGE Ranker = 0
	Ranker_DIST_COUNT  Ranker = 1
)

func (Ranker) Descriptor added in v1.0.0

func (Ranker) Descriptor() protoreflect.EnumDescriptor

func (Ranker) Enum added in v1.0.0

func (x Ranker) Enum() *Ranker

func (Ranker) EnumDescriptor deprecated added in v1.0.0

func (Ranker) EnumDescriptor() ([]byte, []int)

Deprecated: Use Ranker.Descriptor instead.

func (Ranker) Number added in v1.0.0

func (x Ranker) Number() protoreflect.EnumNumber

func (Ranker) String added in v1.0.0

func (x Ranker) String() string

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) Descriptor() ([]byte, []int)

Deprecated: Use Rating.ProtoReflect.Descriptor instead.

func (*Rating) GetCount

func (x *Rating) GetCount() int32

func (*Rating) GetRate

func (x *Rating) GetRate() int32

func (*Rating) ProtoMessage

func (*Rating) ProtoMessage()

func (*Rating) ProtoReflect

func (x *Rating) ProtoReflect() protoreflect.Message

func (*Rating) Reset

func (x *Rating) Reset()

func (*Rating) String

func (x *Rating) String() string

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.

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) Crop

func (UnimplementedSearchServiceServer) Search

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL