pb

package
v0.0.0-...-8f67b3a Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2024 License: MIT Imports: 18 Imported by: 2

Documentation

Overview

Package pb is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	SimpleBankService_CreateUser_FullMethodName      = "/service_simple_bank.SimpleBankService/CreateUser"
	SimpleBankService_UpdateUser_FullMethodName      = "/service_simple_bank.SimpleBankService/UpdateUser"
	SimpleBankService_LoginUser_FullMethodName       = "/service_simple_bank.SimpleBankService/LoginUser"
	SimpleBankService_HelloFromServer_FullMethodName = "/service_simple_bank.SimpleBankService/HelloFromServer"
)

Variables

View Source
var File_create_user_proto protoreflect.FileDescriptor
View Source
var File_hello_proto protoreflect.FileDescriptor
View Source
var File_login_user_proto protoreflect.FileDescriptor
View Source
var File_service_simple_bank_proto protoreflect.FileDescriptor
View Source
var File_update_user_proto protoreflect.FileDescriptor
View Source
var SimpleBankService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "service_simple_bank.SimpleBankService",
	HandlerType: (*SimpleBankServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreateUser",
			Handler:    _SimpleBankService_CreateUser_Handler,
		},
		{
			MethodName: "UpdateUser",
			Handler:    _SimpleBankService_UpdateUser_Handler,
		},
		{
			MethodName: "LoginUser",
			Handler:    _SimpleBankService_LoginUser_Handler,
		},
		{
			MethodName: "HelloFromServer",
			Handler:    _SimpleBankService_HelloFromServer_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "service_simple_bank.proto",
}

SimpleBankService_ServiceDesc is the grpc.ServiceDesc for SimpleBankService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterSimpleBankServiceHandler

func RegisterSimpleBankServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterSimpleBankServiceHandler registers the http handlers for service SimpleBankService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterSimpleBankServiceHandlerClient

func RegisterSimpleBankServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SimpleBankServiceClient) error

RegisterSimpleBankServiceHandlerClient registers the http handlers for service SimpleBankService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "SimpleBankServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "SimpleBankServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "SimpleBankServiceClient" to call the correct interceptors.

func RegisterSimpleBankServiceHandlerFromEndpoint

func RegisterSimpleBankServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterSimpleBankServiceHandlerFromEndpoint is same as RegisterSimpleBankServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterSimpleBankServiceHandlerServer

func RegisterSimpleBankServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SimpleBankServiceServer) error

RegisterSimpleBankServiceHandlerServer registers the http handlers for service SimpleBankService to "mux". UnaryRPC :call SimpleBankServiceServer 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 RegisterSimpleBankServiceHandlerFromEndpoint instead.

func RegisterSimpleBankServiceServer

func RegisterSimpleBankServiceServer(s grpc.ServiceRegistrar, srv SimpleBankServiceServer)

Types

type CreateUserRequest

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

func (*CreateUserRequest) Descriptor deprecated

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

Deprecated: Use CreateUserRequest.ProtoReflect.Descriptor instead.

func (*CreateUserRequest) GetEmail

func (x *CreateUserRequest) GetEmail() string

func (*CreateUserRequest) GetFullName

func (x *CreateUserRequest) GetFullName() string

func (*CreateUserRequest) GetPassword

func (x *CreateUserRequest) GetPassword() string

func (*CreateUserRequest) GetUsername

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

type CreateUserResponse

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

func (*CreateUserResponse) Descriptor deprecated

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

Deprecated: Use CreateUserResponse.ProtoReflect.Descriptor instead.

func (*CreateUserResponse) GetUser

func (x *CreateUserResponse) GetUser() *User

func (*CreateUserResponse) ProtoMessage

func (*CreateUserResponse) ProtoMessage()

func (*CreateUserResponse) ProtoReflect

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

func (*CreateUserResponse) Reset

func (x *CreateUserResponse) Reset()

func (*CreateUserResponse) String

func (x *CreateUserResponse) String() string

type HelloFromServerRequest

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

func (*HelloFromServerRequest) Descriptor deprecated

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

Deprecated: Use HelloFromServerRequest.ProtoReflect.Descriptor instead.

func (*HelloFromServerRequest) ProtoMessage

func (*HelloFromServerRequest) ProtoMessage()

func (*HelloFromServerRequest) ProtoReflect

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

func (*HelloFromServerRequest) Reset

func (x *HelloFromServerRequest) Reset()

func (*HelloFromServerRequest) String

func (x *HelloFromServerRequest) String() string

type HelloFromServerResponse

type HelloFromServerResponse struct {
	Message    string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	ClientIp   string `protobuf:"bytes,1,opt,name=client_ip,json=clientIp,proto3" json:"client_ip,omitempty"`
	UserAgent  string `protobuf:"bytes,4,opt,name=user_agent,json=userAgent,proto3" json:"user_agent,omitempty"`
	ServerName string `protobuf:"bytes,7,opt,name=server_name,json=serverName,proto3" json:"server_name,omitempty"`
	// contains filtered or unexported fields
}

func (*HelloFromServerResponse) Descriptor deprecated

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

Deprecated: Use HelloFromServerResponse.ProtoReflect.Descriptor instead.

func (*HelloFromServerResponse) GetClientIp

func (x *HelloFromServerResponse) GetClientIp() string

func (*HelloFromServerResponse) GetMessage

func (x *HelloFromServerResponse) GetMessage() string

func (*HelloFromServerResponse) GetServerName

func (x *HelloFromServerResponse) GetServerName() string

func (*HelloFromServerResponse) GetUserAgent

func (x *HelloFromServerResponse) GetUserAgent() string

func (*HelloFromServerResponse) ProtoMessage

func (*HelloFromServerResponse) ProtoMessage()

func (*HelloFromServerResponse) ProtoReflect

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

func (*HelloFromServerResponse) Reset

func (x *HelloFromServerResponse) Reset()

func (*HelloFromServerResponse) String

func (x *HelloFromServerResponse) String() string

type LoginUserRequest

type LoginUserRequest 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 (*LoginUserRequest) Descriptor deprecated

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

Deprecated: Use LoginUserRequest.ProtoReflect.Descriptor instead.

func (*LoginUserRequest) GetPassword

func (x *LoginUserRequest) GetPassword() string

func (*LoginUserRequest) GetUsername

func (x *LoginUserRequest) GetUsername() string

func (*LoginUserRequest) ProtoMessage

func (*LoginUserRequest) ProtoMessage()

func (*LoginUserRequest) ProtoReflect

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

func (*LoginUserRequest) Reset

func (x *LoginUserRequest) Reset()

func (*LoginUserRequest) String

func (x *LoginUserRequest) String() string

type LoginUserResponse

type LoginUserResponse struct {
	User                  *User                  `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
	SessionId             string                 `protobuf:"bytes,2,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
	AccessToken           string                 `protobuf:"bytes,3,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
	RefreshToken          string                 `protobuf:"bytes,4,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"`
	AccessTokenExpiresAt  *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=access_token_expires_at,json=accessTokenExpiresAt,proto3" json:"access_token_expires_at,omitempty"`
	RefreshTokenExpiresAt *timestamppb.Timestamp `` /* 128-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*LoginUserResponse) Descriptor deprecated

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

Deprecated: Use LoginUserResponse.ProtoReflect.Descriptor instead.

func (*LoginUserResponse) GetAccessToken

func (x *LoginUserResponse) GetAccessToken() string

func (*LoginUserResponse) GetAccessTokenExpiresAt

func (x *LoginUserResponse) GetAccessTokenExpiresAt() *timestamppb.Timestamp

func (*LoginUserResponse) GetRefreshToken

func (x *LoginUserResponse) GetRefreshToken() string

func (*LoginUserResponse) GetRefreshTokenExpiresAt

func (x *LoginUserResponse) GetRefreshTokenExpiresAt() *timestamppb.Timestamp

func (*LoginUserResponse) GetSessionId

func (x *LoginUserResponse) GetSessionId() string

func (*LoginUserResponse) GetUser

func (x *LoginUserResponse) GetUser() *User

func (*LoginUserResponse) ProtoMessage

func (*LoginUserResponse) ProtoMessage()

func (*LoginUserResponse) ProtoReflect

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

func (*LoginUserResponse) Reset

func (x *LoginUserResponse) Reset()

func (*LoginUserResponse) String

func (x *LoginUserResponse) String() string

type SimpleBankServiceClient

type SimpleBankServiceClient interface {
	CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*CreateUserResponse, error)
	UpdateUser(ctx context.Context, in *UpdateUserRequest, opts ...grpc.CallOption) (*UpdateUserResponse, error)
	LoginUser(ctx context.Context, in *LoginUserRequest, opts ...grpc.CallOption) (*LoginUserResponse, error)
	HelloFromServer(ctx context.Context, in *HelloFromServerRequest, opts ...grpc.CallOption) (*HelloFromServerResponse, error)
}

SimpleBankServiceClient is the client API for SimpleBankService 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 SimpleBankServiceServer

type SimpleBankServiceServer interface {
	CreateUser(context.Context, *CreateUserRequest) (*CreateUserResponse, error)
	UpdateUser(context.Context, *UpdateUserRequest) (*UpdateUserResponse, error)
	LoginUser(context.Context, *LoginUserRequest) (*LoginUserResponse, error)
	HelloFromServer(context.Context, *HelloFromServerRequest) (*HelloFromServerResponse, error)
	// contains filtered or unexported methods
}

SimpleBankServiceServer is the server API for SimpleBankService service. All implementations must embed UnimplementedSimpleBankServiceServer for forward compatibility

type UnimplementedSimpleBankServiceServer

type UnimplementedSimpleBankServiceServer struct {
}

UnimplementedSimpleBankServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedSimpleBankServiceServer) CreateUser

func (UnimplementedSimpleBankServiceServer) HelloFromServer

func (UnimplementedSimpleBankServiceServer) LoginUser

func (UnimplementedSimpleBankServiceServer) UpdateUser

type UnsafeSimpleBankServiceServer

type UnsafeSimpleBankServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeSimpleBankServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to SimpleBankServiceServer will result in compilation errors.

type UpdateUserRequest

type UpdateUserRequest struct {
	Username string  `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
	FullName *string `protobuf:"bytes,2,opt,name=full_name,json=fullName,proto3,oneof" json:"full_name,omitempty"` // optional is used to make the field optional
	Email    *string `protobuf:"bytes,3,opt,name=email,proto3,oneof" json:"email,omitempty"`
	Password *string `protobuf:"bytes,4,opt,name=password,proto3,oneof" json:"password,omitempty"`
	// contains filtered or unexported fields
}

func (*UpdateUserRequest) Descriptor deprecated

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

Deprecated: Use UpdateUserRequest.ProtoReflect.Descriptor instead.

func (*UpdateUserRequest) GetEmail

func (x *UpdateUserRequest) GetEmail() string

func (*UpdateUserRequest) GetFullName

func (x *UpdateUserRequest) GetFullName() string

func (*UpdateUserRequest) GetPassword

func (x *UpdateUserRequest) GetPassword() string

func (*UpdateUserRequest) GetUsername

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

type UpdateUserResponse

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

func (*UpdateUserResponse) Descriptor deprecated

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

Deprecated: Use UpdateUserResponse.ProtoReflect.Descriptor instead.

func (*UpdateUserResponse) GetUser

func (x *UpdateUserResponse) GetUser() *User

func (*UpdateUserResponse) ProtoMessage

func (*UpdateUserResponse) ProtoMessage()

func (*UpdateUserResponse) ProtoReflect

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

func (*UpdateUserResponse) Reset

func (x *UpdateUserResponse) Reset()

func (*UpdateUserResponse) String

func (x *UpdateUserResponse) String() string

type User

type User struct {
	Username          string                 `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
	FullName          string                 `protobuf:"bytes,2,opt,name=full_name,json=fullName,proto3" json:"full_name,omitempty"`
	Email             string                 `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
	PasswordChangedAt *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=password_changed_at,json=passwordChangedAt,proto3" json:"password_changed_at,omitempty"`
	CreatedAt         *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
	// contains filtered or unexported fields
}

func (*User) Descriptor deprecated

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

Deprecated: Use User.ProtoReflect.Descriptor instead.

func (*User) GetCreatedAt

func (x *User) GetCreatedAt() *timestamppb.Timestamp

func (*User) GetEmail

func (x *User) GetEmail() string

func (*User) GetFullName

func (x *User) GetFullName() string

func (*User) GetPasswordChangedAt

func (x *User) GetPasswordChangedAt() *timestamppb.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

Jump to

Keyboard shortcuts

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