_go

package
v0.0.0-...-18f9ab3 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

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

Deprecated: Use Action.ProtoReflect.Descriptor instead.

func (*Action) GetAction

func (x *Action) GetAction() ActionEnum

func (*Action) GetError

func (x *Action) GetError() string

func (*Action) GetSuccess

func (x *Action) GetSuccess() bool

func (*Action) GetTimestamp

func (x *Action) GetTimestamp() *timestamppb.Timestamp

func (*Action) GetUserId

func (x *Action) GetUserId() int32

func (*Action) ProtoMessage

func (*Action) ProtoMessage()

func (*Action) ProtoReflect

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

func (*Action) Reset

func (x *Action) Reset()

func (*Action) String

func (x *Action) String() string

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

type UnimplementedUserActionServer

type UnimplementedUserActionServer struct {
}

UnimplementedUserActionServer should be embedded to have forward compatible implementations.

func (UnimplementedUserActionServer) DeleteUser

func (UnimplementedUserActionServer) GetUserInfo

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

Deprecated: Use User.ProtoReflect.Descriptor instead.

func (*User) GetEmail

func (x *User) GetEmail() string

func (*User) GetId

func (x *User) GetId() int32

func (*User) GetName

func (x *User) GetName() string

func (*User) GetPassword

func (x *User) GetPassword() string

func (*User) ProtoMessage

func (*User) ProtoMessage()

func (*User) ProtoReflect

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

func (*User) Reset

func (x *User) Reset()

func (*User) String

func (x *User) String() string

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

Jump to

Keyboard shortcuts

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