protos

package
v0.0.0-...-0328ab9 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2020 License: MIT Imports: 31 Imported by: 0

Documentation

Overview

Package protos is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_users_proto protoreflect.FileDescriptor

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.Server, srv UserServiceServer)

Types

type UnimplementedUserServiceServer

type UnimplementedUserServiceServer struct {
}

UnimplementedUserServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedUserServiceServer) Login

func (*UnimplementedUserServiceServer) Register

type User

type User struct {
	Id          int64                `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Username    string               `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"`
	Email       string               `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
	CreatedDate *timestamp.Timestamp `protobuf:"bytes,4,opt,name=Created_date,json=CreatedDate,proto3" json:"Created_date,omitempty"`
	UpdatedDate *timestamp.Timestamp `protobuf:"bytes,5,opt,name=updated_date,json=updatedDate,proto3" json:"updated_date,omitempty"`
	// contains filtered or unexported fields
}

func (*User) Descriptor deprecated

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

Deprecated: Use User.ProtoReflect.Descriptor instead.

func (*User) GetCreatedDate

func (x *User) GetCreatedDate() *timestamp.Timestamp

func (*User) GetEmail

func (x *User) GetEmail() string

func (*User) GetId

func (x *User) GetId() int64

func (*User) GetUpdatedDate

func (x *User) GetUpdatedDate() *timestamp.Timestamp

func (*User) GetUsername

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

func (*User) Validate

func (m *User) Validate() error

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

type UserLoginRequest

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

func (*UserLoginRequest) Descriptor deprecated

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

Deprecated: Use UserLoginRequest.ProtoReflect.Descriptor instead.

func (*UserLoginRequest) GetPassword

func (x *UserLoginRequest) GetPassword() string

func (*UserLoginRequest) GetUsername

func (x *UserLoginRequest) GetUsername() string

func (*UserLoginRequest) ProtoMessage

func (*UserLoginRequest) ProtoMessage()

func (*UserLoginRequest) ProtoReflect

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

func (*UserLoginRequest) Reset

func (x *UserLoginRequest) Reset()

func (*UserLoginRequest) String

func (x *UserLoginRequest) String() string

func (*UserLoginRequest) Validate

func (m *UserLoginRequest) Validate() error

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

type UserLoginRequestValidationError

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

UserLoginRequestValidationError is the validation error returned by UserLoginRequest.Validate if the designated constraints aren't met.

func (UserLoginRequestValidationError) Cause

Cause function returns cause value.

func (UserLoginRequestValidationError) Error

Error satisfies the builtin error interface

func (UserLoginRequestValidationError) ErrorName

ErrorName returns error name.

func (UserLoginRequestValidationError) Field

Field function returns field value.

func (UserLoginRequestValidationError) Key

Key function returns key value.

func (UserLoginRequestValidationError) Reason

Reason function returns reason value.

type UserRegisterRequest

type UserRegisterRequest struct {
	Username       string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
	Email          string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"`
	Password       string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"`
	PasswordRepeat string `protobuf:"bytes,4,opt,name=passwordRepeat,proto3" json:"passwordRepeat,omitempty"`
	// contains filtered or unexported fields
}

func (*UserRegisterRequest) Descriptor deprecated

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

Deprecated: Use UserRegisterRequest.ProtoReflect.Descriptor instead.

func (*UserRegisterRequest) GetEmail

func (x *UserRegisterRequest) GetEmail() string

func (*UserRegisterRequest) GetPassword

func (x *UserRegisterRequest) GetPassword() string

func (*UserRegisterRequest) GetPasswordRepeat

func (x *UserRegisterRequest) GetPasswordRepeat() string

func (*UserRegisterRequest) GetUsername

func (x *UserRegisterRequest) GetUsername() string

func (*UserRegisterRequest) ProtoMessage

func (*UserRegisterRequest) ProtoMessage()

func (*UserRegisterRequest) ProtoReflect

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

func (*UserRegisterRequest) Reset

func (x *UserRegisterRequest) Reset()

func (*UserRegisterRequest) String

func (x *UserRegisterRequest) String() string

func (*UserRegisterRequest) Validate

func (m *UserRegisterRequest) Validate() error

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

type UserRegisterRequestValidationError

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

UserRegisterRequestValidationError is the validation error returned by UserRegisterRequest.Validate if the designated constraints aren't met.

func (UserRegisterRequestValidationError) Cause

Cause function returns cause value.

func (UserRegisterRequestValidationError) Error

Error satisfies the builtin error interface

func (UserRegisterRequestValidationError) ErrorName

ErrorName returns error name.

func (UserRegisterRequestValidationError) Field

Field function returns field value.

func (UserRegisterRequestValidationError) Key

Key function returns key value.

func (UserRegisterRequestValidationError) Reason

Reason function returns reason value.

type UserResponse

type UserResponse struct {
	Code    int32  `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	Details *User  `protobuf:"bytes,3,opt,name=details,proto3" json:"details,omitempty"`
	// contains filtered or unexported fields
}

func (*UserResponse) Descriptor deprecated

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

Deprecated: Use UserResponse.ProtoReflect.Descriptor instead.

func (*UserResponse) GetCode

func (x *UserResponse) GetCode() int32

func (*UserResponse) GetDetails

func (x *UserResponse) GetDetails() *User

func (*UserResponse) GetMessage

func (x *UserResponse) GetMessage() 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 *UserRegisterRequest, opts ...grpc.CallOption) (*UserResponse, error)
	Login(ctx context.Context, in *UserLoginRequest, 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://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

type UserServiceServer

type UserServiceServer interface {
	Register(context.Context, *UserRegisterRequest) (*UserResponse, error)
	Login(context.Context, *UserLoginRequest) (*UserResponse, error)
}

UserServiceServer is the server API for UserService service.

type UserValidationError

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

UserValidationError is the validation error returned by User.Validate if the designated constraints aren't met.

func (UserValidationError) Cause

func (e UserValidationError) Cause() error

Cause function returns cause value.

func (UserValidationError) Error

func (e UserValidationError) Error() string

Error satisfies the builtin error interface

func (UserValidationError) ErrorName

func (e UserValidationError) ErrorName() string

ErrorName returns error name.

func (UserValidationError) Field

func (e UserValidationError) Field() string

Field function returns field value.

func (UserValidationError) Key

func (e UserValidationError) Key() bool

Key function returns key value.

func (UserValidationError) Reason

func (e UserValidationError) Reason() string

Reason function returns reason value.

Jump to

Keyboard shortcuts

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