pb

package
v0.0.0-...-27850da Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: Unlicense Imports: 29 Imported by: 0

Documentation

Overview

Package pb is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_v1_users_proto protoreflect.FileDescriptor
View Source
var UserService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "users.UserService",
	HandlerType: (*UserServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Register",
			Handler:    _UserService_Register_Handler,
		},
		{
			MethodName: "Login",
			Handler:    _UserService_Login_Handler,
		},
		{
			MethodName: "GetCurrent",
			Handler:    _UserService_GetCurrent_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "v1/users.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 AuthenticationResponse

type AuthenticationResponse struct {
	Token string        `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
	User  *UserResponse `protobuf:"bytes,2,opt,name=user,proto3" json:"user,omitempty"`
	// contains filtered or unexported fields
}

func (*AuthenticationResponse) Descriptor deprecated

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

Deprecated: Use AuthenticationResponse.ProtoReflect.Descriptor instead.

func (*AuthenticationResponse) GetToken

func (x *AuthenticationResponse) GetToken() string

func (*AuthenticationResponse) GetUser

func (x *AuthenticationResponse) GetUser() *UserResponse

func (*AuthenticationResponse) ProtoMessage

func (*AuthenticationResponse) ProtoMessage()

func (*AuthenticationResponse) ProtoReflect

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

func (*AuthenticationResponse) Reset

func (x *AuthenticationResponse) Reset()

func (*AuthenticationResponse) String

func (x *AuthenticationResponse) String() string

func (*AuthenticationResponse) Validate

func (m *AuthenticationResponse) Validate() error

Validate checks the field values on AuthenticationResponse with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

type AuthenticationResponseValidationError

type AuthenticationResponseValidationError struct {
	// contains filtered or unexported fields
}

AuthenticationResponseValidationError is the validation error returned by AuthenticationResponse.Validate if the designated constraints aren't met.

func (AuthenticationResponseValidationError) Cause

Cause function returns cause value.

func (AuthenticationResponseValidationError) Error

Error satisfies the builtin error interface

func (AuthenticationResponseValidationError) ErrorName

ErrorName returns error name.

func (AuthenticationResponseValidationError) Field

Field function returns field value.

func (AuthenticationResponseValidationError) Key

Key function returns key value.

func (AuthenticationResponseValidationError) Reason

Reason function returns reason value.

type Empty

type Empty struct {
	// contains filtered or unexported fields
}

func (*Empty) Descriptor deprecated

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

Deprecated: Use Empty.ProtoReflect.Descriptor instead.

func (*Empty) ProtoMessage

func (*Empty) ProtoMessage()

func (*Empty) ProtoReflect

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

func (*Empty) Reset

func (x *Empty) Reset()

func (*Empty) String

func (x *Empty) String() string

func (*Empty) Validate

func (m *Empty) Validate() error

Validate checks the field values on Empty with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

type EmptyValidationError

type EmptyValidationError struct {
	// contains filtered or unexported fields
}

EmptyValidationError is the validation error returned by Empty.Validate if the designated constraints aren't met.

func (EmptyValidationError) Cause

func (e EmptyValidationError) Cause() error

Cause function returns cause value.

func (EmptyValidationError) Error

func (e EmptyValidationError) Error() string

Error satisfies the builtin error interface

func (EmptyValidationError) ErrorName

func (e EmptyValidationError) ErrorName() string

ErrorName returns error name.

func (EmptyValidationError) Field

func (e EmptyValidationError) Field() string

Field function returns field value.

func (EmptyValidationError) Key

func (e EmptyValidationError) Key() bool

Key function returns key value.

func (EmptyValidationError) Reason

func (e EmptyValidationError) Reason() string

Reason function returns reason value.

type LoginRequest

type LoginRequest struct {
	Email    string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"`
	Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
	// contains filtered or unexported fields
}

func (*LoginRequest) Descriptor deprecated

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

Deprecated: Use LoginRequest.ProtoReflect.Descriptor instead.

func (*LoginRequest) GetEmail

func (x *LoginRequest) GetEmail() string

func (*LoginRequest) GetPassword

func (x *LoginRequest) GetPassword() string

func (*LoginRequest) ProtoMessage

func (*LoginRequest) ProtoMessage()

func (*LoginRequest) ProtoReflect

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

func (*LoginRequest) Reset

func (x *LoginRequest) Reset()

func (*LoginRequest) String

func (x *LoginRequest) String() string

func (*LoginRequest) Validate

func (m *LoginRequest) Validate() error

Validate checks the field values on LoginRequest with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

type LoginRequestValidationError

type LoginRequestValidationError struct {
	// contains filtered or unexported fields
}

LoginRequestValidationError is the validation error returned by LoginRequest.Validate if the designated constraints aren't met.

func (LoginRequestValidationError) Cause

Cause function returns cause value.

func (LoginRequestValidationError) Error

Error satisfies the builtin error interface

func (LoginRequestValidationError) ErrorName

func (e LoginRequestValidationError) ErrorName() string

ErrorName returns error name.

func (LoginRequestValidationError) Field

Field function returns field value.

func (LoginRequestValidationError) Key

Key function returns key value.

func (LoginRequestValidationError) Reason

Reason function returns reason value.

type RegistrationRequest

type RegistrationRequest struct {
	Email    string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"`
	Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
	// contains filtered or unexported fields
}

func (*RegistrationRequest) Descriptor deprecated

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

Deprecated: Use RegistrationRequest.ProtoReflect.Descriptor instead.

func (*RegistrationRequest) GetEmail

func (x *RegistrationRequest) GetEmail() string

func (*RegistrationRequest) GetPassword

func (x *RegistrationRequest) GetPassword() string

func (*RegistrationRequest) ProtoMessage

func (*RegistrationRequest) ProtoMessage()

func (*RegistrationRequest) ProtoReflect

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

func (*RegistrationRequest) Reset

func (x *RegistrationRequest) Reset()

func (*RegistrationRequest) String

func (x *RegistrationRequest) String() string

func (*RegistrationRequest) Validate

func (m *RegistrationRequest) Validate() error

Validate checks the field values on RegistrationRequest with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

type RegistrationRequestValidationError

type RegistrationRequestValidationError struct {
	// contains filtered or unexported fields
}

RegistrationRequestValidationError is the validation error returned by RegistrationRequest.Validate if the designated constraints aren't met.

func (RegistrationRequestValidationError) Cause

Cause function returns cause value.

func (RegistrationRequestValidationError) Error

Error satisfies the builtin error interface

func (RegistrationRequestValidationError) ErrorName

ErrorName returns error name.

func (RegistrationRequestValidationError) Field

Field function returns field value.

func (RegistrationRequestValidationError) Key

Key function returns key value.

func (RegistrationRequestValidationError) Reason

Reason function returns reason value.

type UnimplementedUserServiceServer

type UnimplementedUserServiceServer struct {
}

UnimplementedUserServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedUserServiceServer) GetCurrent

func (UnimplementedUserServiceServer) Login

func (UnimplementedUserServiceServer) Register

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 UserResponse

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

func (*UserResponse) Descriptor deprecated

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

Deprecated: Use UserResponse.ProtoReflect.Descriptor instead.

func (*UserResponse) GetEmail

func (x *UserResponse) GetEmail() string

func (*UserResponse) ProtoMessage

func (*UserResponse) ProtoMessage()

func (*UserResponse) ProtoReflect

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

func (*UserResponse) Reset

func (x *UserResponse) Reset()

func (*UserResponse) String

func (x *UserResponse) String() string

func (*UserResponse) Validate

func (m *UserResponse) Validate() error

Validate checks the field values on UserResponse with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

type UserResponseValidationError

type UserResponseValidationError struct {
	// contains filtered or unexported fields
}

UserResponseValidationError is the validation error returned by UserResponse.Validate if the designated constraints aren't met.

func (UserResponseValidationError) Cause

Cause function returns cause value.

func (UserResponseValidationError) Error

Error satisfies the builtin error interface

func (UserResponseValidationError) ErrorName

func (e UserResponseValidationError) ErrorName() string

ErrorName returns error name.

func (UserResponseValidationError) Field

Field function returns field value.

func (UserResponseValidationError) Key

Key function returns key value.

func (UserResponseValidationError) Reason

Reason function returns reason value.

type UserServiceClient

type UserServiceClient interface {
	Register(ctx context.Context, in *RegistrationRequest, opts ...grpc.CallOption) (*AuthenticationResponse, error)
	Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*AuthenticationResponse, error)
	GetCurrent(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*UserResponse, 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 {
	Register(context.Context, *RegistrationRequest) (*AuthenticationResponse, error)
	Login(context.Context, *LoginRequest) (*AuthenticationResponse, error)
	GetCurrent(context.Context, *Empty) (*UserResponse, 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