userv1

package
v0.0.0-...-edc78fc Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2022 License: MIT Imports: 30 Imported by: 0

Documentation

Overview

Package userv1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_user_v1_user_proto protoreflect.FileDescriptor
View Source
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

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

Cause function returns cause value.

func (CreateUserRequestValidationError) Error

Error satisfies the builtin error interface

func (CreateUserRequestValidationError) ErrorName

ErrorName returns error name.

func (CreateUserRequestValidationError) Field

Field function returns field value.

func (CreateUserRequestValidationError) Key

Key function returns key value.

func (CreateUserRequestValidationError) Reason

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

Cause function returns cause value.

func (OneUserReplyValidationError) Error

Error satisfies the builtin error interface

func (OneUserReplyValidationError) ErrorName

func (e OneUserReplyValidationError) ErrorName() string

ErrorName returns error name.

func (OneUserReplyValidationError) Field

Field function returns field value.

func (OneUserReplyValidationError) Key

Key function returns key value.

func (OneUserReplyValidationError) Reason

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

Cause function returns cause value.

func (OneUserRequestValidationError) Error

Error satisfies the builtin error interface

func (OneUserRequestValidationError) ErrorName

func (e OneUserRequestValidationError) ErrorName() string

ErrorName returns error name.

func (OneUserRequestValidationError) Field

Field function returns field value.

func (OneUserRequestValidationError) Key

Key function returns key value.

func (OneUserRequestValidationError) Reason

Reason function returns reason value.

type UnimplementedUserServiceServer

type UnimplementedUserServiceServer struct {
}

UnimplementedUserServiceServer should be embedded to have forward compatible implementations.

func (UnimplementedUserServiceServer) Create

func (UnimplementedUserServiceServer) GetOne

func (UnimplementedUserServiceServer) Update

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

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

Cause function returns cause value.

func (UpdateUserRequestValidationError) Error

Error satisfies the builtin error interface

func (UpdateUserRequestValidationError) ErrorName

ErrorName returns error name.

func (UpdateUserRequestValidationError) Field

Field function returns field value.

func (UpdateUserRequestValidationError) Key

Key function returns key value.

func (UpdateUserRequestValidationError) Reason

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.

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

Jump to

Keyboard shortcuts

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