user

package
v0.0.0-...-cb82d97 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2023 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package user is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	UserService_CreateUser_FullMethodName = "/grpc.gateway.example.internal.adapter.api.v1.user.UserService/CreateUser"
	UserService_GetUsers_FullMethodName   = "/grpc.gateway.example.internal.adapter.api.v1.user.UserService/GetUsers"
	UserService_GetUser_FullMethodName    = "/grpc.gateway.example.internal.adapter.api.v1.user.UserService/GetUser"
	UserService_DeleteUser_FullMethodName = "/grpc.gateway.example.internal.adapter.api.v1.user.UserService/DeleteUser"
)

Variables

View Source
var File_internal_adapter_api_v1_user_user_proto protoreflect.FileDescriptor
View Source
var UserService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "grpc.gateway.example.internal.adapter.api.v1.user.UserService",
	HandlerType: (*UserServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreateUser",
			Handler:    _UserService_CreateUser_Handler,
		},
		{
			MethodName: "GetUsers",
			Handler:    _UserService_GetUsers_Handler,
		},
		{
			MethodName: "GetUser",
			Handler:    _UserService_GetUser_Handler,
		},
		{
			MethodName: "DeleteUser",
			Handler:    _UserService_DeleteUser_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "internal/adapter/api/v1/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 Aggregation

type Aggregation struct {
	Eq   *string `protobuf:"bytes,1,opt,name=eq,proto3,oneof" json:"eq,omitempty"`
	Like *string `protobuf:"bytes,2,opt,name=like,proto3,oneof" json:"like,omitempty"`
	// contains filtered or unexported fields
}

func (*Aggregation) Descriptor deprecated

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

Deprecated: Use Aggregation.ProtoReflect.Descriptor instead.

func (*Aggregation) GetEq

func (x *Aggregation) GetEq() string

func (*Aggregation) GetLike

func (x *Aggregation) GetLike() string

func (*Aggregation) ProtoMessage

func (*Aggregation) ProtoMessage()

func (*Aggregation) ProtoReflect

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

func (*Aggregation) Reset

func (x *Aggregation) Reset()

func (*Aggregation) String

func (x *Aggregation) String() string

type CreateUserBody

type CreateUserBody struct {
	Name    string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Surname string `protobuf:"bytes,2,opt,name=surname,proto3" json:"surname,omitempty"`
	Email   string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateUserBody) Descriptor deprecated

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

Deprecated: Use CreateUserBody.ProtoReflect.Descriptor instead.

func (*CreateUserBody) GetEmail

func (x *CreateUserBody) GetEmail() string

func (*CreateUserBody) GetName

func (x *CreateUserBody) GetName() string

func (*CreateUserBody) GetSurname

func (x *CreateUserBody) GetSurname() string

func (*CreateUserBody) ProtoMessage

func (*CreateUserBody) ProtoMessage()

func (*CreateUserBody) ProtoReflect

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

func (*CreateUserBody) Reset

func (x *CreateUserBody) Reset()

func (*CreateUserBody) String

func (x *CreateUserBody) String() string

type GetUserResponse

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

func (*GetUserResponse) Descriptor deprecated

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

Deprecated: Use GetUserResponse.ProtoReflect.Descriptor instead.

func (*GetUserResponse) GetUser

func (x *GetUserResponse) GetUser() *User

func (*GetUserResponse) ProtoMessage

func (*GetUserResponse) ProtoMessage()

func (*GetUserResponse) ProtoReflect

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

func (*GetUserResponse) Reset

func (x *GetUserResponse) Reset()

func (*GetUserResponse) String

func (x *GetUserResponse) String() string

type ListUsersResponse

type ListUsersResponse struct {
	Users []*User `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty"`
	// contains filtered or unexported fields
}

func (*ListUsersResponse) Descriptor deprecated

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

Deprecated: Use ListUsersResponse.ProtoReflect.Descriptor instead.

func (*ListUsersResponse) GetUsers

func (x *ListUsersResponse) GetUsers() []*User

func (*ListUsersResponse) ProtoMessage

func (*ListUsersResponse) ProtoMessage()

func (*ListUsersResponse) ProtoReflect

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

func (*ListUsersResponse) Reset

func (x *ListUsersResponse) Reset()

func (*ListUsersResponse) String

func (x *ListUsersResponse) String() string

type Page

type Page struct {
	Size *string `protobuf:"bytes,1,opt,name=size,proto3,oneof" json:"size,omitempty"`
	Eq   *string `protobuf:"bytes,2,opt,name=eq,proto3,oneof" json:"eq,omitempty"`
	// contains filtered or unexported fields
}

func (*Page) Descriptor deprecated

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

Deprecated: Use Page.ProtoReflect.Descriptor instead.

func (*Page) GetEq

func (x *Page) GetEq() string

func (*Page) GetSize

func (x *Page) GetSize() string

func (*Page) ProtoMessage

func (*Page) ProtoMessage()

func (*Page) ProtoReflect

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

func (*Page) Reset

func (x *Page) Reset()

func (*Page) String

func (x *Page) String() string

type UnimplementedUserServiceServer

type UnimplementedUserServiceServer struct {
}

UnimplementedUserServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedUserServiceServer) CreateUser

func (UnimplementedUserServiceServer) DeleteUser

func (UnimplementedUserServiceServer) GetUser

func (UnimplementedUserServiceServer) GetUsers

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      string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Name    string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Surname string `protobuf:"bytes,3,opt,name=surname,proto3" json:"surname,omitempty"`
	Email   string `protobuf:"bytes,4,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() string

func (*User) GetName

func (x *User) GetName() string

func (*User) GetSurname

func (x *User) GetSurname() 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 UserId

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

func (*UserId) Descriptor deprecated

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

Deprecated: Use UserId.ProtoReflect.Descriptor instead.

func (*UserId) GetId

func (x *UserId) GetId() string

func (*UserId) ProtoMessage

func (*UserId) ProtoMessage()

func (*UserId) ProtoReflect

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

func (*UserId) Reset

func (x *UserId) Reset()

func (*UserId) String

func (x *UserId) String() string

type UserParams

type UserParams struct {
	Page *Page        `protobuf:"bytes,1,opt,name=page,proto3,oneof" json:"page,omitempty"`
	Name *Aggregation `protobuf:"bytes,3,opt,name=name,proto3,oneof" json:"name,omitempty"`
	// contains filtered or unexported fields
}

func (*UserParams) Descriptor deprecated

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

Deprecated: Use UserParams.ProtoReflect.Descriptor instead.

func (*UserParams) GetName

func (x *UserParams) GetName() *Aggregation

func (*UserParams) GetPage

func (x *UserParams) GetPage() *Page

func (*UserParams) ProtoMessage

func (*UserParams) ProtoMessage()

func (*UserParams) ProtoReflect

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

func (*UserParams) Reset

func (x *UserParams) Reset()

func (*UserParams) String

func (x *UserParams) String() string

type UserServiceClient

type UserServiceClient interface {
	CreateUser(ctx context.Context, in *CreateUserBody, opts ...grpc.CallOption) (*proto.Message, error)
	GetUsers(ctx context.Context, in *UserParams, opts ...grpc.CallOption) (*ListUsersResponse, error)
	GetUser(ctx context.Context, in *UserId, opts ...grpc.CallOption) (*GetUserResponse, error)
	DeleteUser(ctx context.Context, in *UserId, opts ...grpc.CallOption) (*proto.Message, 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 {
	CreateUser(context.Context, *CreateUserBody) (*proto.Message, error)
	GetUsers(context.Context, *UserParams) (*ListUsersResponse, error)
	GetUser(context.Context, *UserId) (*GetUserResponse, error)
	DeleteUser(context.Context, *UserId) (*proto.Message, error)
	// contains filtered or unexported methods
}

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

func NewServer

func NewServer(userService service.UserService, logger logging.Logger) UserServiceServer

Jump to

Keyboard shortcuts

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