Documentation ¶
Overview ¶
Package item is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterItemServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterItemServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ItemServiceClient) error
- func RegisterItemServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterItemServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ItemServiceServer) error
- func RegisterItemServiceServer(s grpc.ServiceRegistrar, srv ItemServiceServer)
- type CreateRequest
- func (*CreateRequest) Descriptor() ([]byte, []int)deprecated
- func (x *CreateRequest) GetDescription() string
- func (x *CreateRequest) GetImage() *v11.File
- func (x *CreateRequest) GetName() string
- func (*CreateRequest) ProtoMessage()
- func (x *CreateRequest) ProtoReflect() protoreflect.Message
- func (x *CreateRequest) Reset()
- func (x *CreateRequest) String() string
- type DeleteRequest
- type FetchRequest
- func (*FetchRequest) Descriptor() ([]byte, []int)deprecated
- func (x *FetchRequest) GetDescription() string
- func (x *FetchRequest) GetIds() []string
- func (x *FetchRequest) GetName() string
- func (x *FetchRequest) GetPage() *v1.Page
- func (*FetchRequest) ProtoMessage()
- func (x *FetchRequest) ProtoReflect() protoreflect.Message
- func (x *FetchRequest) Reset()
- func (x *FetchRequest) String() string
- type FetchResponse
- func (*FetchResponse) Descriptor() ([]byte, []int)deprecated
- func (x *FetchResponse) GetContent() []*Item
- func (x *FetchResponse) GetTotalRecords() int32
- func (*FetchResponse) ProtoMessage()
- func (x *FetchResponse) ProtoReflect() protoreflect.Message
- func (x *FetchResponse) Reset()
- func (x *FetchResponse) String() string
- type GetRequest
- type Item
- func (*Item) Descriptor() ([]byte, []int)deprecated
- func (x *Item) GetDescription() string
- func (x *Item) GetId() string
- func (x *Item) GetImageUrl() string
- func (x *Item) GetName() string
- func (*Item) ProtoMessage()
- func (x *Item) ProtoReflect() protoreflect.Message
- func (x *Item) Reset()
- func (x *Item) String() string
- type ItemServiceClient
- type ItemServiceServer
- type ItemStatus
- type UnimplementedItemServiceServer
- func (UnimplementedItemServiceServer) Create(context.Context, *CreateRequest) (*Item, error)
- func (UnimplementedItemServiceServer) Delete(context.Context, *DeleteRequest) (*emptypb.Empty, error)
- func (UnimplementedItemServiceServer) Fetch(context.Context, *FetchRequest) (*FetchResponse, error)
- func (UnimplementedItemServiceServer) Get(context.Context, *GetRequest) (*Item, error)
- func (UnimplementedItemServiceServer) Update(context.Context, *UpdateRequest) (*emptypb.Empty, error)
- type UnsafeItemServiceServer
- type UpdateRequest
- func (*UpdateRequest) Descriptor() ([]byte, []int)deprecated
- func (x *UpdateRequest) GetDescription() string
- func (x *UpdateRequest) GetId() string
- func (x *UpdateRequest) GetImage() *v11.File
- func (x *UpdateRequest) GetName() string
- func (*UpdateRequest) ProtoMessage()
- func (x *UpdateRequest) ProtoReflect() protoreflect.Message
- func (x *UpdateRequest) Reset()
- func (x *UpdateRequest) String() string
Constants ¶
This section is empty.
Variables ¶
var ( ItemStatus_name = map[int32]string{ 0: "ITEM_STATUS_UNSPECIFIED", 1: "ACTIVE", 2: "DELETED", } ItemStatus_value = map[string]int32{ "ITEM_STATUS_UNSPECIFIED": 0, "ACTIVE": 1, "DELETED": 2, } )
Enum value maps for ItemStatus.
var File_api_item_v1_message_proto protoreflect.FileDescriptor
var File_api_item_v1_service_proto protoreflect.FileDescriptor
var ItemService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "api.item.v1.ItemService", HandlerType: (*ItemServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Get", Handler: _ItemService_Get_Handler, }, { MethodName: "Fetch", Handler: _ItemService_Fetch_Handler, }, { MethodName: "Create", Handler: _ItemService_Create_Handler, }, { MethodName: "Update", Handler: _ItemService_Update_Handler, }, { MethodName: "Delete", Handler: _ItemService_Delete_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "api/item/v1/service.proto", }
ItemService_ServiceDesc is the grpc.ServiceDesc for ItemService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterItemServiceHandler ¶
func RegisterItemServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterItemServiceHandler registers the http handlers for service ItemService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterItemServiceHandlerClient ¶
func RegisterItemServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ItemServiceClient) error
RegisterItemServiceHandlerClient registers the http handlers for service ItemService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ItemServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ItemServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ItemServiceClient" to call the correct interceptors.
func RegisterItemServiceHandlerFromEndpoint ¶
func RegisterItemServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterItemServiceHandlerFromEndpoint is same as RegisterItemServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterItemServiceHandlerServer ¶
func RegisterItemServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ItemServiceServer) error
RegisterItemServiceHandlerServer registers the http handlers for service ItemService to "mux". UnaryRPC :call ItemServiceServer 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 RegisterItemServiceHandlerFromEndpoint instead.
func RegisterItemServiceServer ¶
func RegisterItemServiceServer(s grpc.ServiceRegistrar, srv ItemServiceServer)
Types ¶
type CreateRequest ¶
type CreateRequest struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` Image *v11.File `protobuf:"bytes,3,opt,name=image,proto3" json:"image,omitempty"` // contains filtered or unexported fields }
func (*CreateRequest) Descriptor
deprecated
func (*CreateRequest) Descriptor() ([]byte, []int)
Deprecated: Use CreateRequest.ProtoReflect.Descriptor instead.
func (*CreateRequest) GetDescription ¶
func (x *CreateRequest) GetDescription() string
func (*CreateRequest) GetImage ¶
func (x *CreateRequest) GetImage() *v11.File
func (*CreateRequest) GetName ¶
func (x *CreateRequest) GetName() string
func (*CreateRequest) ProtoMessage ¶
func (*CreateRequest) ProtoMessage()
func (*CreateRequest) ProtoReflect ¶
func (x *CreateRequest) ProtoReflect() protoreflect.Message
func (*CreateRequest) Reset ¶
func (x *CreateRequest) Reset()
func (*CreateRequest) String ¶
func (x *CreateRequest) String() string
type DeleteRequest ¶
type DeleteRequest struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // contains filtered or unexported fields }
func (*DeleteRequest) Descriptor
deprecated
func (*DeleteRequest) Descriptor() ([]byte, []int)
Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead.
func (*DeleteRequest) GetId ¶
func (x *DeleteRequest) GetId() string
func (*DeleteRequest) ProtoMessage ¶
func (*DeleteRequest) ProtoMessage()
func (*DeleteRequest) ProtoReflect ¶
func (x *DeleteRequest) ProtoReflect() protoreflect.Message
func (*DeleteRequest) Reset ¶
func (x *DeleteRequest) Reset()
func (*DeleteRequest) String ¶
func (x *DeleteRequest) String() string
type FetchRequest ¶
type FetchRequest struct { Ids []string `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` Page *v1.Page `protobuf:"bytes,4,opt,name=page,proto3" json:"page,omitempty"` // contains filtered or unexported fields }
func (*FetchRequest) Descriptor
deprecated
func (*FetchRequest) Descriptor() ([]byte, []int)
Deprecated: Use FetchRequest.ProtoReflect.Descriptor instead.
func (*FetchRequest) GetDescription ¶
func (x *FetchRequest) GetDescription() string
func (*FetchRequest) GetIds ¶
func (x *FetchRequest) GetIds() []string
func (*FetchRequest) GetName ¶
func (x *FetchRequest) GetName() string
func (*FetchRequest) GetPage ¶
func (x *FetchRequest) GetPage() *v1.Page
func (*FetchRequest) ProtoMessage ¶
func (*FetchRequest) ProtoMessage()
func (*FetchRequest) ProtoReflect ¶
func (x *FetchRequest) ProtoReflect() protoreflect.Message
func (*FetchRequest) Reset ¶
func (x *FetchRequest) Reset()
func (*FetchRequest) String ¶
func (x *FetchRequest) String() string
type FetchResponse ¶
type FetchResponse struct { Content []*Item `protobuf:"bytes,1,rep,name=content,proto3" json:"content,omitempty"` TotalRecords int32 `protobuf:"varint,2,opt,name=total_records,json=totalRecords,proto3" json:"total_records,omitempty"` // contains filtered or unexported fields }
func (*FetchResponse) Descriptor
deprecated
func (*FetchResponse) Descriptor() ([]byte, []int)
Deprecated: Use FetchResponse.ProtoReflect.Descriptor instead.
func (*FetchResponse) GetContent ¶
func (x *FetchResponse) GetContent() []*Item
func (*FetchResponse) GetTotalRecords ¶
func (x *FetchResponse) GetTotalRecords() int32
func (*FetchResponse) ProtoMessage ¶
func (*FetchResponse) ProtoMessage()
func (*FetchResponse) ProtoReflect ¶
func (x *FetchResponse) ProtoReflect() protoreflect.Message
func (*FetchResponse) Reset ¶
func (x *FetchResponse) Reset()
func (*FetchResponse) String ¶
func (x *FetchResponse) String() string
type GetRequest ¶
type GetRequest struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // contains filtered or unexported fields }
func (*GetRequest) Descriptor
deprecated
func (*GetRequest) Descriptor() ([]byte, []int)
Deprecated: Use GetRequest.ProtoReflect.Descriptor instead.
func (*GetRequest) GetId ¶
func (x *GetRequest) GetId() string
func (*GetRequest) ProtoMessage ¶
func (*GetRequest) ProtoMessage()
func (*GetRequest) ProtoReflect ¶
func (x *GetRequest) ProtoReflect() protoreflect.Message
func (*GetRequest) Reset ¶
func (x *GetRequest) Reset()
func (*GetRequest) String ¶
func (x *GetRequest) String() string
type Item ¶
type Item struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` ImageUrl string `protobuf:"bytes,4,opt,name=image_url,json=imageUrl,proto3" json:"image_url,omitempty"` // contains filtered or unexported fields }
func (*Item) Descriptor
deprecated
func (*Item) GetDescription ¶
func (*Item) GetImageUrl ¶ added in v0.1.1
func (*Item) ProtoMessage ¶
func (*Item) ProtoMessage()
func (*Item) ProtoReflect ¶
func (x *Item) ProtoReflect() protoreflect.Message
type ItemServiceClient ¶
type ItemServiceClient interface { Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*Item, error) Fetch(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*FetchResponse, error) Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*Item, error) Update(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) }
ItemServiceClient is the client API for ItemService 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 NewItemServiceClient ¶
func NewItemServiceClient(cc grpc.ClientConnInterface) ItemServiceClient
type ItemServiceServer ¶
type ItemServiceServer interface { Get(context.Context, *GetRequest) (*Item, error) Fetch(context.Context, *FetchRequest) (*FetchResponse, error) Create(context.Context, *CreateRequest) (*Item, error) Update(context.Context, *UpdateRequest) (*emptypb.Empty, error) Delete(context.Context, *DeleteRequest) (*emptypb.Empty, error) // contains filtered or unexported methods }
ItemServiceServer is the server API for ItemService service. All implementations must embed UnimplementedItemServiceServer for forward compatibility
type ItemStatus ¶
type ItemStatus int32
const ( ItemStatus_ITEM_STATUS_UNSPECIFIED ItemStatus = 0 ItemStatus_ACTIVE ItemStatus = 1 ItemStatus_DELETED ItemStatus = 2 )
func (ItemStatus) Descriptor ¶
func (ItemStatus) Descriptor() protoreflect.EnumDescriptor
func (ItemStatus) Enum ¶
func (x ItemStatus) Enum() *ItemStatus
func (ItemStatus) EnumDescriptor
deprecated
func (ItemStatus) EnumDescriptor() ([]byte, []int)
Deprecated: Use ItemStatus.Descriptor instead.
func (ItemStatus) Number ¶
func (x ItemStatus) Number() protoreflect.EnumNumber
func (ItemStatus) String ¶
func (x ItemStatus) String() string
func (ItemStatus) Type ¶
func (ItemStatus) Type() protoreflect.EnumType
type UnimplementedItemServiceServer ¶
type UnimplementedItemServiceServer struct { }
UnimplementedItemServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedItemServiceServer) Create ¶
func (UnimplementedItemServiceServer) Create(context.Context, *CreateRequest) (*Item, error)
func (UnimplementedItemServiceServer) Delete ¶
func (UnimplementedItemServiceServer) Delete(context.Context, *DeleteRequest) (*emptypb.Empty, error)
func (UnimplementedItemServiceServer) Fetch ¶
func (UnimplementedItemServiceServer) Fetch(context.Context, *FetchRequest) (*FetchResponse, error)
func (UnimplementedItemServiceServer) Get ¶
func (UnimplementedItemServiceServer) Get(context.Context, *GetRequest) (*Item, error)
func (UnimplementedItemServiceServer) Update ¶
func (UnimplementedItemServiceServer) Update(context.Context, *UpdateRequest) (*emptypb.Empty, error)
type UnsafeItemServiceServer ¶
type UnsafeItemServiceServer interface {
// contains filtered or unexported methods
}
UnsafeItemServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ItemServiceServer will result in compilation errors.
type UpdateRequest ¶
type UpdateRequest struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` Image *v11.File `protobuf:"bytes,4,opt,name=image,proto3" json:"image,omitempty"` // contains filtered or unexported fields }
func (*UpdateRequest) Descriptor
deprecated
func (*UpdateRequest) Descriptor() ([]byte, []int)
Deprecated: Use UpdateRequest.ProtoReflect.Descriptor instead.
func (*UpdateRequest) GetDescription ¶
func (x *UpdateRequest) GetDescription() string
func (*UpdateRequest) GetId ¶
func (x *UpdateRequest) GetId() string
func (*UpdateRequest) GetImage ¶
func (x *UpdateRequest) GetImage() *v11.File
func (*UpdateRequest) GetName ¶
func (x *UpdateRequest) GetName() string
func (*UpdateRequest) ProtoMessage ¶
func (*UpdateRequest) ProtoMessage()
func (*UpdateRequest) ProtoReflect ¶
func (x *UpdateRequest) ProtoReflect() protoreflect.Message
func (*UpdateRequest) Reset ¶
func (x *UpdateRequest) Reset()
func (*UpdateRequest) String ¶
func (x *UpdateRequest) String() string