pb

package
v0.0.0-...-f5f9226 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package pb is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Package pb is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterAuthServiceHandler

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

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

func RegisterAuthServiceHandlerClient

func RegisterAuthServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AuthServiceClient) error

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

func RegisterAuthServiceHandlerFromEndpoint

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

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

func RegisterAuthServiceHandlerServer

func RegisterAuthServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AuthServiceServer) error

RegisterAuthServiceHandlerServer registers the http handlers for service AuthService to "mux". UnaryRPC :call AuthServiceServer 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 (such as grpc.SendHeader, etc) to stop working. Consider using RegisterAuthServiceHandlerFromEndpoint instead.

func RegisterAuthServiceServer

func RegisterAuthServiceServer(s *grpc.Server, srv AuthServiceServer)

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 (such as grpc.SendHeader, etc) to stop working. Consider using RegisterUserServiceHandlerFromEndpoint instead.

func RegisterUserServiceServer

func RegisterUserServiceServer(s *grpc.Server, srv UserServiceServer)

Types

type AuthServiceClient

type AuthServiceClient interface {
	Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginResponse, error)
	Register(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*RegisterResponse, error)
}

AuthServiceClient is the client API for AuthService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewAuthServiceClient

func NewAuthServiceClient(cc *grpc.ClientConn) AuthServiceClient

type AuthServiceServer

type AuthServiceServer interface {
	Login(context.Context, *LoginRequest) (*LoginResponse, error)
	Register(context.Context, *RegisterRequest) (*RegisterResponse, error)
}

AuthServiceServer is the server API for AuthService service.

type LoginRequest

type LoginRequest struct {
	Username             string   `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty" validate:"required" label:"用户名"`
	Password             string   `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty" validate:"required" label:"密码"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*LoginRequest) Descriptor

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

func (*LoginRequest) GetPassword

func (m *LoginRequest) GetPassword() string

func (*LoginRequest) GetUsername

func (m *LoginRequest) GetUsername() string

func (*LoginRequest) ProtoMessage

func (*LoginRequest) ProtoMessage()

func (*LoginRequest) Reset

func (m *LoginRequest) Reset()

func (*LoginRequest) String

func (m *LoginRequest) String() string

func (*LoginRequest) XXX_DiscardUnknown

func (m *LoginRequest) XXX_DiscardUnknown()

func (*LoginRequest) XXX_Marshal

func (m *LoginRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*LoginRequest) XXX_Merge

func (m *LoginRequest) XXX_Merge(src proto.Message)

func (*LoginRequest) XXX_Size

func (m *LoginRequest) XXX_Size() int

func (*LoginRequest) XXX_Unmarshal

func (m *LoginRequest) XXX_Unmarshal(b []byte) error

type LoginResponse

type LoginResponse struct {
	AccessToken          string   `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*LoginResponse) Descriptor

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

func (*LoginResponse) GetAccessToken

func (m *LoginResponse) GetAccessToken() string

func (*LoginResponse) ProtoMessage

func (*LoginResponse) ProtoMessage()

func (*LoginResponse) Reset

func (m *LoginResponse) Reset()

func (*LoginResponse) String

func (m *LoginResponse) String() string

func (*LoginResponse) XXX_DiscardUnknown

func (m *LoginResponse) XXX_DiscardUnknown()

func (*LoginResponse) XXX_Marshal

func (m *LoginResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*LoginResponse) XXX_Merge

func (m *LoginResponse) XXX_Merge(src proto.Message)

func (*LoginResponse) XXX_Size

func (m *LoginResponse) XXX_Size() int

func (*LoginResponse) XXX_Unmarshal

func (m *LoginResponse) XXX_Unmarshal(b []byte) error

type MeRequest

type MeRequest struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*MeRequest) Descriptor

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

func (*MeRequest) ProtoMessage

func (*MeRequest) ProtoMessage()

func (*MeRequest) Reset

func (m *MeRequest) Reset()

func (*MeRequest) String

func (m *MeRequest) String() string

func (*MeRequest) XXX_DiscardUnknown

func (m *MeRequest) XXX_DiscardUnknown()

func (*MeRequest) XXX_Marshal

func (m *MeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MeRequest) XXX_Merge

func (m *MeRequest) XXX_Merge(src proto.Message)

func (*MeRequest) XXX_Size

func (m *MeRequest) XXX_Size() int

func (*MeRequest) XXX_Unmarshal

func (m *MeRequest) XXX_Unmarshal(b []byte) error

type MeResponse

type MeResponse struct {
	Code                 int32    `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Msg                  string   `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"`
	User                 *User    `protobuf:"bytes,3,opt,name=user,proto3" json:"user,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*MeResponse) Descriptor

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

func (*MeResponse) GetCode

func (m *MeResponse) GetCode() int32

func (*MeResponse) GetMsg

func (m *MeResponse) GetMsg() string

func (*MeResponse) GetUser

func (m *MeResponse) GetUser() *User

func (*MeResponse) ProtoMessage

func (*MeResponse) ProtoMessage()

func (*MeResponse) Reset

func (m *MeResponse) Reset()

func (*MeResponse) String

func (m *MeResponse) String() string

func (*MeResponse) XXX_DiscardUnknown

func (m *MeResponse) XXX_DiscardUnknown()

func (*MeResponse) XXX_Marshal

func (m *MeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MeResponse) XXX_Merge

func (m *MeResponse) XXX_Merge(src proto.Message)

func (*MeResponse) XXX_Size

func (m *MeResponse) XXX_Size() int

func (*MeResponse) XXX_Unmarshal

func (m *MeResponse) XXX_Unmarshal(b []byte) error

type RegisterRequest

type RegisterRequest struct {
	Username             string   `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty" validate:"required" label:"用户名"`
	Password             string   `` /* 127-byte string literal not displayed */
	RepeatPassword       string   `protobuf:"bytes,3,opt,name=repeat_password,json=repeatPassword,proto3" json:"repeat_password,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*RegisterRequest) Descriptor

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

func (*RegisterRequest) GetPassword

func (m *RegisterRequest) GetPassword() string

func (*RegisterRequest) GetRepeatPassword

func (m *RegisterRequest) GetRepeatPassword() string

func (*RegisterRequest) GetUsername

func (m *RegisterRequest) GetUsername() string

func (*RegisterRequest) ProtoMessage

func (*RegisterRequest) ProtoMessage()

func (*RegisterRequest) Reset

func (m *RegisterRequest) Reset()

func (*RegisterRequest) String

func (m *RegisterRequest) String() string

func (*RegisterRequest) XXX_DiscardUnknown

func (m *RegisterRequest) XXX_DiscardUnknown()

func (*RegisterRequest) XXX_Marshal

func (m *RegisterRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*RegisterRequest) XXX_Merge

func (m *RegisterRequest) XXX_Merge(src proto.Message)

func (*RegisterRequest) XXX_Size

func (m *RegisterRequest) XXX_Size() int

func (*RegisterRequest) XXX_Unmarshal

func (m *RegisterRequest) XXX_Unmarshal(b []byte) error

type RegisterResponse

type RegisterResponse struct {
	Code                 int32    `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Msg                  string   `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*RegisterResponse) Descriptor

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

func (*RegisterResponse) GetCode

func (m *RegisterResponse) GetCode() int32

func (*RegisterResponse) GetMsg

func (m *RegisterResponse) GetMsg() string

func (*RegisterResponse) ProtoMessage

func (*RegisterResponse) ProtoMessage()

func (*RegisterResponse) Reset

func (m *RegisterResponse) Reset()

func (*RegisterResponse) String

func (m *RegisterResponse) String() string

func (*RegisterResponse) XXX_DiscardUnknown

func (m *RegisterResponse) XXX_DiscardUnknown()

func (*RegisterResponse) XXX_Marshal

func (m *RegisterResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*RegisterResponse) XXX_Merge

func (m *RegisterResponse) XXX_Merge(src proto.Message)

func (*RegisterResponse) XXX_Size

func (m *RegisterResponse) XXX_Size() int

func (*RegisterResponse) XXX_Unmarshal

func (m *RegisterResponse) XXX_Unmarshal(b []byte) error

type UnimplementedAuthServiceServer

type UnimplementedAuthServiceServer struct {
}

UnimplementedAuthServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedAuthServiceServer) Login

func (*UnimplementedAuthServiceServer) Register

type UnimplementedUserServiceServer

type UnimplementedUserServiceServer struct {
}

UnimplementedUserServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedUserServiceServer) Me

type User

type User struct {
	Username             string   `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*User) Descriptor

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

func (*User) GetUsername

func (m *User) GetUsername() string

func (*User) ProtoMessage

func (*User) ProtoMessage()

func (*User) Reset

func (m *User) Reset()

func (*User) String

func (m *User) String() string

func (*User) XXX_DiscardUnknown

func (m *User) XXX_DiscardUnknown()

func (*User) XXX_Marshal

func (m *User) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*User) XXX_Merge

func (m *User) XXX_Merge(src proto.Message)

func (*User) XXX_Size

func (m *User) XXX_Size() int

func (*User) XXX_Unmarshal

func (m *User) XXX_Unmarshal(b []byte) error

type UserServiceClient

type UserServiceClient interface {
	Me(ctx context.Context, in *MeRequest, opts ...grpc.CallOption) (*MeResponse, 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.

func NewUserServiceClient

func NewUserServiceClient(cc *grpc.ClientConn) UserServiceClient

type UserServiceServer

type UserServiceServer interface {
	Me(context.Context, *MeRequest) (*MeResponse, error)
}

UserServiceServer is the server API for UserService service.

Jump to

Keyboard shortcuts

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