Documentation
¶
Overview ¶
Package _go is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterUserActionHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterUserActionHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserActionClient) error
- func RegisterUserActionHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterUserActionHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserActionServer) error
- func RegisterUserActionServer(s grpc.ServiceRegistrar, srv UserActionServer)
- type Action
- func (*Action) Descriptor() ([]byte, []int)deprecated
- func (x *Action) GetAction() ActionEnum
- func (x *Action) GetError() string
- func (x *Action) GetSuccess() bool
- func (x *Action) GetTimestamp() *timestamppb.Timestamp
- func (x *Action) GetUserId() int32
- func (*Action) ProtoMessage()
- func (x *Action) ProtoReflect() protoreflect.Message
- func (x *Action) Reset()
- func (x *Action) String() string
- type ActionEnum
- type UnimplementedUserActionServer
- func (UnimplementedUserActionServer) DeleteUser(context.Context, *UserIdentifier) (*emptypb.Empty, error)
- func (UnimplementedUserActionServer) GetUserInfo(context.Context, *UserIdentifier) (*User, error)
- func (UnimplementedUserActionServer) SendUserAction(context.Context, *Action) (*emptypb.Empty, error)
- func (UnimplementedUserActionServer) UpdateUser(context.Context, *User) (*emptypb.Empty, error)
- type UnsafeUserActionServer
- type User
- func (*User) Descriptor() ([]byte, []int)deprecated
- func (x *User) GetEmail() string
- func (x *User) GetId() int32
- func (x *User) GetName() string
- func (x *User) GetPassword() string
- func (*User) ProtoMessage()
- func (x *User) ProtoReflect() protoreflect.Message
- func (x *User) Reset()
- func (x *User) String() string
- type UserActionClient
- type UserActionServer
- type UserIdentifier
Constants ¶
This section is empty.
Variables ¶
var ( ActionEnum_name = map[int32]string{ 0: "DEFAULT", 1: "LOGIN", 2: "LOGOUT", 3: "PURCHASE", 4: "RETURN", 5: "ADD_TO_CART", 6: "REMOVE_FROM_CART", 7: "VIEW_ITEM", 8: "VIEW_CART", 9: "VIEW_PURCHASE_HISTORY", } ActionEnum_value = map[string]int32{ "DEFAULT": 0, "LOGIN": 1, "LOGOUT": 2, "PURCHASE": 3, "RETURN": 4, "ADD_TO_CART": 5, "REMOVE_FROM_CART": 6, "VIEW_ITEM": 7, "VIEW_CART": 8, "VIEW_PURCHASE_HISTORY": 9, } )
Enum value maps for ActionEnum.
var File_proto_user_proto protoreflect.FileDescriptor
var UserAction_ServiceDesc = grpc.ServiceDesc{ ServiceName: "user.UserAction", HandlerType: (*UserActionServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "UpdateUser", Handler: _UserAction_UpdateUser_Handler, }, { MethodName: "GetUserInfo", Handler: _UserAction_GetUserInfo_Handler, }, { MethodName: "DeleteUser", Handler: _UserAction_DeleteUser_Handler, }, { MethodName: "SendUserAction", Handler: _UserAction_SendUserAction_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "proto/user.proto", }
UserAction_ServiceDesc is the grpc.ServiceDesc for UserAction service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterUserActionHandler ¶
func RegisterUserActionHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterUserActionHandler registers the http handlers for service UserAction to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterUserActionHandlerClient ¶
func RegisterUserActionHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserActionClient) error
RegisterUserActionHandlerClient registers the http handlers for service UserAction to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "UserActionClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "UserActionClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "UserActionClient" to call the correct interceptors.
func RegisterUserActionHandlerFromEndpoint ¶
func RegisterUserActionHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterUserActionHandlerFromEndpoint is same as RegisterUserActionHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterUserActionHandlerServer ¶
func RegisterUserActionHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserActionServer) error
RegisterUserActionHandlerServer registers the http handlers for service UserAction to "mux". UnaryRPC :call UserActionServer 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 RegisterUserActionHandlerFromEndpoint instead.
func RegisterUserActionServer ¶
func RegisterUserActionServer(s grpc.ServiceRegistrar, srv UserActionServer)
Types ¶
type Action ¶
type Action struct { UserId int32 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` Action ActionEnum `protobuf:"varint,2,opt,name=action,proto3,enum=user.ActionEnum" json:"action,omitempty"` Success bool `protobuf:"varint,3,opt,name=success,proto3" json:"success,omitempty"` Error string `protobuf:"bytes,4,opt,name=error,proto3" json:"error,omitempty"` Timestamp *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // contains filtered or unexported fields }
func (*Action) Descriptor
deprecated
func (*Action) GetAction ¶
func (x *Action) GetAction() ActionEnum
func (*Action) GetSuccess ¶
func (*Action) GetTimestamp ¶
func (x *Action) GetTimestamp() *timestamppb.Timestamp
func (*Action) ProtoMessage ¶
func (*Action) ProtoMessage()
func (*Action) ProtoReflect ¶
func (x *Action) ProtoReflect() protoreflect.Message
type ActionEnum ¶
type ActionEnum int32
const ( ActionEnum_DEFAULT ActionEnum = 0 ActionEnum_LOGIN ActionEnum = 1 ActionEnum_LOGOUT ActionEnum = 2 ActionEnum_PURCHASE ActionEnum = 3 ActionEnum_RETURN ActionEnum = 4 ActionEnum_ADD_TO_CART ActionEnum = 5 ActionEnum_REMOVE_FROM_CART ActionEnum = 6 ActionEnum_VIEW_ITEM ActionEnum = 7 ActionEnum_VIEW_CART ActionEnum = 8 ActionEnum_VIEW_PURCHASE_HISTORY ActionEnum = 9 )
func (ActionEnum) Descriptor ¶
func (ActionEnum) Descriptor() protoreflect.EnumDescriptor
func (ActionEnum) Enum ¶
func (x ActionEnum) Enum() *ActionEnum
func (ActionEnum) EnumDescriptor
deprecated
func (ActionEnum) EnumDescriptor() ([]byte, []int)
Deprecated: Use ActionEnum.Descriptor instead.
func (ActionEnum) Number ¶
func (x ActionEnum) Number() protoreflect.EnumNumber
func (ActionEnum) String ¶
func (x ActionEnum) String() string
func (ActionEnum) Type ¶
func (ActionEnum) Type() protoreflect.EnumType
type UnimplementedUserActionServer ¶
type UnimplementedUserActionServer struct { }
UnimplementedUserActionServer should be embedded to have forward compatible implementations.
func (UnimplementedUserActionServer) DeleteUser ¶
func (UnimplementedUserActionServer) DeleteUser(context.Context, *UserIdentifier) (*emptypb.Empty, error)
func (UnimplementedUserActionServer) GetUserInfo ¶
func (UnimplementedUserActionServer) GetUserInfo(context.Context, *UserIdentifier) (*User, error)
func (UnimplementedUserActionServer) SendUserAction ¶
func (UnimplementedUserActionServer) UpdateUser ¶
type UnsafeUserActionServer ¶
type UnsafeUserActionServer interface {
// contains filtered or unexported methods
}
UnsafeUserActionServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to UserActionServer will result in compilation errors.
type User ¶
type User struct { Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"` Password string `protobuf:"bytes,4,opt,name=password,proto3" json:"password,omitempty"` // contains filtered or unexported fields }
func (*User) Descriptor
deprecated
func (*User) GetPassword ¶
func (*User) ProtoMessage ¶
func (*User) ProtoMessage()
func (*User) ProtoReflect ¶
func (x *User) ProtoReflect() protoreflect.Message
type UserActionClient ¶
type UserActionClient interface { UpdateUser(ctx context.Context, in *User, opts ...grpc.CallOption) (*emptypb.Empty, error) GetUserInfo(ctx context.Context, in *UserIdentifier, opts ...grpc.CallOption) (*User, error) DeleteUser(ctx context.Context, in *UserIdentifier, opts ...grpc.CallOption) (*emptypb.Empty, error) SendUserAction(ctx context.Context, in *Action, opts ...grpc.CallOption) (*emptypb.Empty, error) }
UserActionClient is the client API for UserAction 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 NewUserActionClient ¶
func NewUserActionClient(cc grpc.ClientConnInterface) UserActionClient
type UserActionServer ¶
type UserActionServer interface { UpdateUser(context.Context, *User) (*emptypb.Empty, error) GetUserInfo(context.Context, *UserIdentifier) (*User, error) DeleteUser(context.Context, *UserIdentifier) (*emptypb.Empty, error) SendUserAction(context.Context, *Action) (*emptypb.Empty, error) }
UserActionServer is the server API for UserAction service. All implementations should embed UnimplementedUserActionServer for forward compatibility
type UserIdentifier ¶
type UserIdentifier struct { UserId int32 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // contains filtered or unexported fields }
func (*UserIdentifier) Descriptor
deprecated
func (*UserIdentifier) Descriptor() ([]byte, []int)
Deprecated: Use UserIdentifier.ProtoReflect.Descriptor instead.
func (*UserIdentifier) GetUserId ¶
func (x *UserIdentifier) GetUserId() int32
func (*UserIdentifier) ProtoMessage ¶
func (*UserIdentifier) ProtoMessage()
func (*UserIdentifier) ProtoReflect ¶
func (x *UserIdentifier) ProtoReflect() protoreflect.Message
func (*UserIdentifier) Reset ¶
func (x *UserIdentifier) Reset()
func (*UserIdentifier) String ¶
func (x *UserIdentifier) String() string