Documentation ¶
Overview ¶
Package userv1 is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterUserServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserServiceClient) error
- func RegisterUserServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserServiceServer) error
- func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer)
- type CreateUserRequest
- func (*CreateUserRequest) Descriptor() ([]byte, []int)deprecated
- func (x *CreateUserRequest) GetAge() uint32
- func (x *CreateUserRequest) GetName() string
- func (*CreateUserRequest) ProtoMessage()
- func (x *CreateUserRequest) ProtoReflect() protoreflect.Message
- func (x *CreateUserRequest) Reset()
- func (x *CreateUserRequest) String() string
- func (m *CreateUserRequest) Validate() error
- func (m *CreateUserRequest) ValidateAll() error
- type CreateUserRequestMultiError
- type CreateUserRequestValidationError
- func (e CreateUserRequestValidationError) Cause() error
- func (e CreateUserRequestValidationError) Error() string
- func (e CreateUserRequestValidationError) ErrorName() string
- func (e CreateUserRequestValidationError) Field() string
- func (e CreateUserRequestValidationError) Key() bool
- func (e CreateUserRequestValidationError) Reason() string
- type OneUserReply
- func (*OneUserReply) Descriptor() ([]byte, []int)deprecated
- func (x *OneUserReply) GetAge() uint32
- func (x *OneUserReply) GetCreatedAt() *timestamppb.Timestamp
- func (x *OneUserReply) GetId() uint32
- func (x *OneUserReply) GetName() string
- func (*OneUserReply) ProtoMessage()
- func (x *OneUserReply) ProtoReflect() protoreflect.Message
- func (x *OneUserReply) Reset()
- func (x *OneUserReply) String() string
- func (m *OneUserReply) Validate() error
- func (m *OneUserReply) ValidateAll() error
- type OneUserReplyMultiError
- type OneUserReplyValidationError
- func (e OneUserReplyValidationError) Cause() error
- func (e OneUserReplyValidationError) Error() string
- func (e OneUserReplyValidationError) ErrorName() string
- func (e OneUserReplyValidationError) Field() string
- func (e OneUserReplyValidationError) Key() bool
- func (e OneUserReplyValidationError) Reason() string
- type OneUserRequest
- func (*OneUserRequest) Descriptor() ([]byte, []int)deprecated
- func (x *OneUserRequest) GetId() uint32
- func (*OneUserRequest) ProtoMessage()
- func (x *OneUserRequest) ProtoReflect() protoreflect.Message
- func (x *OneUserRequest) Reset()
- func (x *OneUserRequest) String() string
- func (m *OneUserRequest) Validate() error
- func (m *OneUserRequest) ValidateAll() error
- type OneUserRequestMultiError
- type OneUserRequestValidationError
- func (e OneUserRequestValidationError) Cause() error
- func (e OneUserRequestValidationError) Error() string
- func (e OneUserRequestValidationError) ErrorName() string
- func (e OneUserRequestValidationError) Field() string
- func (e OneUserRequestValidationError) Key() bool
- func (e OneUserRequestValidationError) Reason() string
- type UnimplementedUserServiceServer
- func (UnimplementedUserServiceServer) Create(context.Context, *CreateUserRequest) (*OneUserReply, error)
- func (UnimplementedUserServiceServer) GetOne(context.Context, *OneUserRequest) (*OneUserReply, error)
- func (UnimplementedUserServiceServer) Update(context.Context, *UpdateUserRequest) (*OneUserReply, error)
- type UnsafeUserServiceServer
- type UpdateUserRequest
- func (*UpdateUserRequest) Descriptor() ([]byte, []int)deprecated
- func (x *UpdateUserRequest) GetAge() uint32
- func (x *UpdateUserRequest) GetId() uint32
- func (x *UpdateUserRequest) GetName() string
- func (*UpdateUserRequest) ProtoMessage()
- func (x *UpdateUserRequest) ProtoReflect() protoreflect.Message
- func (x *UpdateUserRequest) Reset()
- func (x *UpdateUserRequest) String() string
- func (m *UpdateUserRequest) Validate() error
- func (m *UpdateUserRequest) ValidateAll() error
- type UpdateUserRequestMultiError
- type UpdateUserRequestValidationError
- func (e UpdateUserRequestValidationError) Cause() error
- func (e UpdateUserRequestValidationError) Error() string
- func (e UpdateUserRequestValidationError) ErrorName() string
- func (e UpdateUserRequestValidationError) Field() string
- func (e UpdateUserRequestValidationError) Key() bool
- func (e UpdateUserRequestValidationError) Reason() string
- type UserServiceClient
- type UserServiceServer
Constants ¶
This section is empty.
Variables ¶
var File_user_v1_user_proto protoreflect.FileDescriptor
var UserService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "user.v1.UserService", HandlerType: (*UserServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "GetOne", Handler: _UserService_GetOne_Handler, }, { MethodName: "Create", Handler: _UserService_Create_Handler, }, { MethodName: "Update", Handler: _UserService_Update_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "user/v1/user.proto", }
UserService_ServiceDesc is the grpc.ServiceDesc for UserService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterUserServiceHandler ¶
func RegisterUserServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterUserServiceHandler registers the http handlers for service UserService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterUserServiceHandlerClient ¶
func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserServiceClient) error
RegisterUserServiceHandlerClient registers the http handlers for service UserService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "UserServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "UserServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "UserServiceClient" to call the correct interceptors.
func RegisterUserServiceHandlerFromEndpoint ¶
func RegisterUserServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterUserServiceHandlerFromEndpoint is same as RegisterUserServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterUserServiceHandlerServer ¶
func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserServiceServer) error
RegisterUserServiceHandlerServer registers the http handlers for service UserService to "mux". UnaryRPC :call UserServiceServer 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 RegisterUserServiceHandlerFromEndpoint instead.
func RegisterUserServiceServer ¶
func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer)
Types ¶
type CreateUserRequest ¶
type CreateUserRequest struct { Age uint32 `protobuf:"varint,1,opt,name=age,proto3" json:"age,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // contains filtered or unexported fields }
func (*CreateUserRequest) Descriptor
deprecated
func (*CreateUserRequest) Descriptor() ([]byte, []int)
Deprecated: Use CreateUserRequest.ProtoReflect.Descriptor instead.
func (*CreateUserRequest) GetAge ¶
func (x *CreateUserRequest) GetAge() uint32
func (*CreateUserRequest) GetName ¶
func (x *CreateUserRequest) GetName() string
func (*CreateUserRequest) ProtoMessage ¶
func (*CreateUserRequest) ProtoMessage()
func (*CreateUserRequest) ProtoReflect ¶
func (x *CreateUserRequest) ProtoReflect() protoreflect.Message
func (*CreateUserRequest) Reset ¶
func (x *CreateUserRequest) Reset()
func (*CreateUserRequest) String ¶
func (x *CreateUserRequest) String() string
func (*CreateUserRequest) Validate ¶
func (m *CreateUserRequest) Validate() error
Validate checks the field values on CreateUserRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*CreateUserRequest) ValidateAll ¶
func (m *CreateUserRequest) ValidateAll() error
ValidateAll checks the field values on CreateUserRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in CreateUserRequestMultiError, or nil if none found.
type CreateUserRequestMultiError ¶
type CreateUserRequestMultiError []error
CreateUserRequestMultiError is an error wrapping multiple validation errors returned by CreateUserRequest.ValidateAll() if the designated constraints aren't met.
func (CreateUserRequestMultiError) AllErrors ¶
func (m CreateUserRequestMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (CreateUserRequestMultiError) Error ¶
func (m CreateUserRequestMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type CreateUserRequestValidationError ¶
type CreateUserRequestValidationError struct {
// contains filtered or unexported fields
}
CreateUserRequestValidationError is the validation error returned by CreateUserRequest.Validate if the designated constraints aren't met.
func (CreateUserRequestValidationError) Cause ¶
func (e CreateUserRequestValidationError) Cause() error
Cause function returns cause value.
func (CreateUserRequestValidationError) Error ¶
func (e CreateUserRequestValidationError) Error() string
Error satisfies the builtin error interface
func (CreateUserRequestValidationError) ErrorName ¶
func (e CreateUserRequestValidationError) ErrorName() string
ErrorName returns error name.
func (CreateUserRequestValidationError) Field ¶
func (e CreateUserRequestValidationError) Field() string
Field function returns field value.
func (CreateUserRequestValidationError) Key ¶
func (e CreateUserRequestValidationError) Key() bool
Key function returns key value.
func (CreateUserRequestValidationError) Reason ¶
func (e CreateUserRequestValidationError) Reason() string
Reason function returns reason value.
type OneUserReply ¶
type OneUserReply struct { Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Age uint32 `protobuf:"varint,2,opt,name=age,proto3" json:"age,omitempty"` Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` CreatedAt *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // contains filtered or unexported fields }
func (*OneUserReply) Descriptor
deprecated
func (*OneUserReply) Descriptor() ([]byte, []int)
Deprecated: Use OneUserReply.ProtoReflect.Descriptor instead.
func (*OneUserReply) GetAge ¶
func (x *OneUserReply) GetAge() uint32
func (*OneUserReply) GetCreatedAt ¶
func (x *OneUserReply) GetCreatedAt() *timestamppb.Timestamp
func (*OneUserReply) GetId ¶
func (x *OneUserReply) GetId() uint32
func (*OneUserReply) GetName ¶
func (x *OneUserReply) GetName() string
func (*OneUserReply) ProtoMessage ¶
func (*OneUserReply) ProtoMessage()
func (*OneUserReply) ProtoReflect ¶
func (x *OneUserReply) ProtoReflect() protoreflect.Message
func (*OneUserReply) Reset ¶
func (x *OneUserReply) Reset()
func (*OneUserReply) String ¶
func (x *OneUserReply) String() string
func (*OneUserReply) Validate ¶
func (m *OneUserReply) Validate() error
Validate checks the field values on OneUserReply with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*OneUserReply) ValidateAll ¶
func (m *OneUserReply) ValidateAll() error
ValidateAll checks the field values on OneUserReply with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in OneUserReplyMultiError, or nil if none found.
type OneUserReplyMultiError ¶
type OneUserReplyMultiError []error
OneUserReplyMultiError is an error wrapping multiple validation errors returned by OneUserReply.ValidateAll() if the designated constraints aren't met.
func (OneUserReplyMultiError) AllErrors ¶
func (m OneUserReplyMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (OneUserReplyMultiError) Error ¶
func (m OneUserReplyMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type OneUserReplyValidationError ¶
type OneUserReplyValidationError struct {
// contains filtered or unexported fields
}
OneUserReplyValidationError is the validation error returned by OneUserReply.Validate if the designated constraints aren't met.
func (OneUserReplyValidationError) Cause ¶
func (e OneUserReplyValidationError) Cause() error
Cause function returns cause value.
func (OneUserReplyValidationError) Error ¶
func (e OneUserReplyValidationError) Error() string
Error satisfies the builtin error interface
func (OneUserReplyValidationError) ErrorName ¶
func (e OneUserReplyValidationError) ErrorName() string
ErrorName returns error name.
func (OneUserReplyValidationError) Field ¶
func (e OneUserReplyValidationError) Field() string
Field function returns field value.
func (OneUserReplyValidationError) Key ¶
func (e OneUserReplyValidationError) Key() bool
Key function returns key value.
func (OneUserReplyValidationError) Reason ¶
func (e OneUserReplyValidationError) Reason() string
Reason function returns reason value.
type OneUserRequest ¶
type OneUserRequest struct { Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // contains filtered or unexported fields }
func (*OneUserRequest) Descriptor
deprecated
func (*OneUserRequest) Descriptor() ([]byte, []int)
Deprecated: Use OneUserRequest.ProtoReflect.Descriptor instead.
func (*OneUserRequest) GetId ¶
func (x *OneUserRequest) GetId() uint32
func (*OneUserRequest) ProtoMessage ¶
func (*OneUserRequest) ProtoMessage()
func (*OneUserRequest) ProtoReflect ¶
func (x *OneUserRequest) ProtoReflect() protoreflect.Message
func (*OneUserRequest) Reset ¶
func (x *OneUserRequest) Reset()
func (*OneUserRequest) String ¶
func (x *OneUserRequest) String() string
func (*OneUserRequest) Validate ¶
func (m *OneUserRequest) Validate() error
Validate checks the field values on OneUserRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*OneUserRequest) ValidateAll ¶
func (m *OneUserRequest) ValidateAll() error
ValidateAll checks the field values on OneUserRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in OneUserRequestMultiError, or nil if none found.
type OneUserRequestMultiError ¶
type OneUserRequestMultiError []error
OneUserRequestMultiError is an error wrapping multiple validation errors returned by OneUserRequest.ValidateAll() if the designated constraints aren't met.
func (OneUserRequestMultiError) AllErrors ¶
func (m OneUserRequestMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (OneUserRequestMultiError) Error ¶
func (m OneUserRequestMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type OneUserRequestValidationError ¶
type OneUserRequestValidationError struct {
// contains filtered or unexported fields
}
OneUserRequestValidationError is the validation error returned by OneUserRequest.Validate if the designated constraints aren't met.
func (OneUserRequestValidationError) Cause ¶
func (e OneUserRequestValidationError) Cause() error
Cause function returns cause value.
func (OneUserRequestValidationError) Error ¶
func (e OneUserRequestValidationError) Error() string
Error satisfies the builtin error interface
func (OneUserRequestValidationError) ErrorName ¶
func (e OneUserRequestValidationError) ErrorName() string
ErrorName returns error name.
func (OneUserRequestValidationError) Field ¶
func (e OneUserRequestValidationError) Field() string
Field function returns field value.
func (OneUserRequestValidationError) Key ¶
func (e OneUserRequestValidationError) Key() bool
Key function returns key value.
func (OneUserRequestValidationError) Reason ¶
func (e OneUserRequestValidationError) Reason() string
Reason function returns reason value.
type UnimplementedUserServiceServer ¶
type UnimplementedUserServiceServer struct { }
UnimplementedUserServiceServer should be embedded to have forward compatible implementations.
func (UnimplementedUserServiceServer) Create ¶
func (UnimplementedUserServiceServer) Create(context.Context, *CreateUserRequest) (*OneUserReply, error)
func (UnimplementedUserServiceServer) GetOne ¶
func (UnimplementedUserServiceServer) GetOne(context.Context, *OneUserRequest) (*OneUserReply, error)
func (UnimplementedUserServiceServer) Update ¶
func (UnimplementedUserServiceServer) Update(context.Context, *UpdateUserRequest) (*OneUserReply, error)
type UnsafeUserServiceServer ¶
type UnsafeUserServiceServer interface {
// contains filtered or unexported methods
}
UnsafeUserServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to UserServiceServer will result in compilation errors.
type UpdateUserRequest ¶
type UpdateUserRequest struct { Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Age uint32 `protobuf:"varint,2,opt,name=age,proto3" json:"age,omitempty"` Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` // contains filtered or unexported fields }
func (*UpdateUserRequest) Descriptor
deprecated
func (*UpdateUserRequest) Descriptor() ([]byte, []int)
Deprecated: Use UpdateUserRequest.ProtoReflect.Descriptor instead.
func (*UpdateUserRequest) GetAge ¶
func (x *UpdateUserRequest) GetAge() uint32
func (*UpdateUserRequest) GetId ¶
func (x *UpdateUserRequest) GetId() uint32
func (*UpdateUserRequest) GetName ¶
func (x *UpdateUserRequest) GetName() string
func (*UpdateUserRequest) ProtoMessage ¶
func (*UpdateUserRequest) ProtoMessage()
func (*UpdateUserRequest) ProtoReflect ¶
func (x *UpdateUserRequest) ProtoReflect() protoreflect.Message
func (*UpdateUserRequest) Reset ¶
func (x *UpdateUserRequest) Reset()
func (*UpdateUserRequest) String ¶
func (x *UpdateUserRequest) String() string
func (*UpdateUserRequest) Validate ¶
func (m *UpdateUserRequest) Validate() error
Validate checks the field values on UpdateUserRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*UpdateUserRequest) ValidateAll ¶
func (m *UpdateUserRequest) ValidateAll() error
ValidateAll checks the field values on UpdateUserRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in UpdateUserRequestMultiError, or nil if none found.
type UpdateUserRequestMultiError ¶
type UpdateUserRequestMultiError []error
UpdateUserRequestMultiError is an error wrapping multiple validation errors returned by UpdateUserRequest.ValidateAll() if the designated constraints aren't met.
func (UpdateUserRequestMultiError) AllErrors ¶
func (m UpdateUserRequestMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (UpdateUserRequestMultiError) Error ¶
func (m UpdateUserRequestMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type UpdateUserRequestValidationError ¶
type UpdateUserRequestValidationError struct {
// contains filtered or unexported fields
}
UpdateUserRequestValidationError is the validation error returned by UpdateUserRequest.Validate if the designated constraints aren't met.
func (UpdateUserRequestValidationError) Cause ¶
func (e UpdateUserRequestValidationError) Cause() error
Cause function returns cause value.
func (UpdateUserRequestValidationError) Error ¶
func (e UpdateUserRequestValidationError) Error() string
Error satisfies the builtin error interface
func (UpdateUserRequestValidationError) ErrorName ¶
func (e UpdateUserRequestValidationError) ErrorName() string
ErrorName returns error name.
func (UpdateUserRequestValidationError) Field ¶
func (e UpdateUserRequestValidationError) Field() string
Field function returns field value.
func (UpdateUserRequestValidationError) Key ¶
func (e UpdateUserRequestValidationError) Key() bool
Key function returns key value.
func (UpdateUserRequestValidationError) Reason ¶
func (e UpdateUserRequestValidationError) Reason() string
Reason function returns reason value.
type UserServiceClient ¶
type UserServiceClient interface { GetOne(ctx context.Context, in *OneUserRequest, opts ...grpc.CallOption) (*OneUserReply, error) Create(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*OneUserReply, error) Update(ctx context.Context, in *UpdateUserRequest, opts ...grpc.CallOption) (*OneUserReply, error) }
UserServiceClient is the client API for UserService 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 NewUserServiceClient ¶
func NewUserServiceClient(cc grpc.ClientConnInterface) UserServiceClient
type UserServiceServer ¶
type UserServiceServer interface { GetOne(context.Context, *OneUserRequest) (*OneUserReply, error) Create(context.Context, *CreateUserRequest) (*OneUserReply, error) Update(context.Context, *UpdateUserRequest) (*OneUserReply, error) }
UserServiceServer is the server API for UserService service. All implementations should embed UnimplementedUserServiceServer for forward compatibility