user

package
v0.0.0-...-e3dbeff Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2022 License: Apache-2.0 Imports: 17 Imported by: 2

Documentation

Overview

Package user is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_idl_user_user_proto protoreflect.FileDescriptor
View Source
var UserService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "user.UserService",
	HandlerType: (*UserServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Create",
			Handler:    _UserService_Create_Handler,
		},
		{
			MethodName: "Read",
			Handler:    _UserService_Read_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "idl/user/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 CreateUserReq

type CreateUserReq struct {
	User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateUserReq) Descriptor deprecated

func (*CreateUserReq) Descriptor() ([]byte, []int)

Deprecated: Use CreateUserReq.ProtoReflect.Descriptor instead.

func (*CreateUserReq) GetUser

func (x *CreateUserReq) GetUser() *User

func (*CreateUserReq) ProtoMessage

func (*CreateUserReq) ProtoMessage()

func (*CreateUserReq) ProtoReflect

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

func (*CreateUserReq) Reset

func (x *CreateUserReq) Reset()

func (*CreateUserReq) String

func (x *CreateUserReq) String() string

type CreateUserResp

type CreateUserResp struct {
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateUserResp) Descriptor deprecated

func (*CreateUserResp) Descriptor() ([]byte, []int)

Deprecated: Use CreateUserResp.ProtoReflect.Descriptor instead.

func (*CreateUserResp) GetId

func (x *CreateUserResp) GetId() int64

func (*CreateUserResp) ProtoMessage

func (*CreateUserResp) ProtoMessage()

func (*CreateUserResp) ProtoReflect

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

func (*CreateUserResp) Reset

func (x *CreateUserResp) Reset()

func (*CreateUserResp) String

func (x *CreateUserResp) String() string

type ReadUserReq

type ReadUserReq struct {
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*ReadUserReq) Descriptor deprecated

func (*ReadUserReq) Descriptor() ([]byte, []int)

Deprecated: Use ReadUserReq.ProtoReflect.Descriptor instead.

func (*ReadUserReq) GetId

func (x *ReadUserReq) GetId() int64

func (*ReadUserReq) ProtoMessage

func (*ReadUserReq) ProtoMessage()

func (*ReadUserReq) ProtoReflect

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

func (*ReadUserReq) Reset

func (x *ReadUserReq) Reset()

func (*ReadUserReq) String

func (x *ReadUserReq) String() string

type ReadUserResp

type ReadUserResp struct {
	User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
	// contains filtered or unexported fields
}

func (*ReadUserResp) Descriptor deprecated

func (*ReadUserResp) Descriptor() ([]byte, []int)

Deprecated: Use ReadUserResp.ProtoReflect.Descriptor instead.

func (*ReadUserResp) GetUser

func (x *ReadUserResp) GetUser() *User

func (*ReadUserResp) ProtoMessage

func (*ReadUserResp) ProtoMessage()

func (*ReadUserResp) ProtoReflect

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

func (*ReadUserResp) Reset

func (x *ReadUserResp) Reset()

func (*ReadUserResp) String

func (x *ReadUserResp) String() string

type UnimplementedUserServiceServer

type UnimplementedUserServiceServer struct {
}

UnimplementedUserServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedUserServiceServer) Create

func (UnimplementedUserServiceServer) Read

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 User

type User struct {
	Id    int64  `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"`
	// 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() int64

func (*User) GetName

func (x *User) GetName() 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 UserServiceClient

type UserServiceClient interface {
	Create(ctx context.Context, in *CreateUserReq, opts ...grpc.CallOption) (*CreateUserResp, error)
	Read(ctx context.Context, in *ReadUserReq, opts ...grpc.CallOption) (*ReadUserResp, 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 {
	Create(context.Context, *CreateUserReq) (*CreateUserResp, error)
	Read(context.Context, *ReadUserReq) (*ReadUserResp, error)
	// contains filtered or unexported methods
}

UserServiceServer is the server API for UserService service. All implementations must embed UnimplementedUserServiceServer for forward compatibility

Jump to

Keyboard shortcuts

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