Documentation ¶
Index ¶
- Variables
- func ErrorToPb(e error) *pb.Error
- func ErrorWithHint(e *pb.Error, errorNumber uint32, hint string) *pb.Error
- func GetAccountFromContext(ctx context.Context) string
- func GetEmpIDFromContext(ctx context.Context) string
- func GetLoginStatusFromContext(ctx context.Context) string
- func GetMethodFromContext(ctx context.Context) string
- func GetURLPathFromContext(ctx context.Context) string
- type GrpcServer
- func (s *GrpcServer) NginxStatus(_ context.Context, _ *pb.PingRequest) (*pb.PingReply, error)
- func (s *GrpcServer) Ping(_ context.Context, _ *pb.PingRequest) (*pb.PingReply, error)
- func (s *GrpcServer) SayHello(_ context.Context, in *pb.HelloRequest) (*pb.HelloReply, error)
- func (s *GrpcServer) Serve(address string) error
- func (s *GrpcServer) Stop()
- func (s *GrpcServer) Wait() error
Constants ¶
This section is empty.
Variables ¶
var ( Ok = &pb.Error{Code: pb.ErrCode_ERR_CODE_OK, Msg: "ok"} ErrUnknown = &pb.Error{Code: pb.ErrCode_ERR_CODE_UNKNOWN, Msg: "未知错误"} ErrArgsInvalid = &pb.Error{Code: pb.ErrCode_ERR_CODE_ARGS_INVALID, Msg: "无效的请求参数"} ErrBadRequest = &pb.Error{Code: pb.ErrCode_ERR_CODE_BAD_REQUEST, Msg: "请求错误"} ErrInternal = &pb.Error{Code: pb.ErrCode_ERR_CODE_INTERNAL, Msg: "系统内部错误"} ErrBussiness = &pb.Error{Code: pb.ErrCode_ERR_CODE_BUSINESS, Msg: "业务逻辑错误"} )
错误列表
Functions ¶
func ErrorWithHint ¶
ErrorWithHint creates a pb Error with hint message.
func GetAccountFromContext ¶
GetAccountFromContext 从 metadata 中获取 account
func GetEmpIDFromContext ¶
GetEmpIDFromContext returns the empId that has been stored in Context, if available. This will return 0 if the user has not logged in. If there is an error attempting to return the empId it will be returned. It's valid for this function to return 0 with no error, which indicates the user has not logged in.
func GetLoginStatusFromContext ¶
GetLoginStatusFromContext returns the empId login status that has been stored in Context
func GetMethodFromContext ¶
GetMethodFromContext 从 metadata 中获取 url_path
func GetURLPathFromContext ¶
GetURLPathFromContext 从 metadata 中获取 url_path
Types ¶
type GrpcServer ¶
type GrpcServer struct { // Embed the unimplemented server pb.UnimplementedQMgmtServer // contains filtered or unexported fields }
GrpcServer implements pb.UnimplementedMarsaxlokkServer.
func NewGrpcServer ¶
func NewGrpcServer(r *run.RunTime) *GrpcServer
NewGrpcServer creates a new GrpcServer.
func (*GrpcServer) NginxStatus ¶
func (s *GrpcServer) NginxStatus(_ context.Context, _ *pb.PingRequest) (*pb.PingReply, error)
func (*GrpcServer) Ping ¶
func (s *GrpcServer) Ping(_ context.Context, _ *pb.PingRequest) (*pb.PingReply, error)
func (*GrpcServer) SayHello ¶
func (s *GrpcServer) SayHello(_ context.Context, in *pb.HelloRequest) (*pb.HelloReply, error)
func (*GrpcServer) Serve ¶
func (s *GrpcServer) Serve(address string) error
Serve starts the grpc server.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
proto
|
|
protoc-gen-openapiv2/internal/genopenapi
Package genopenapi provides a code generator for OpenAPI v2.
|
Package genopenapi provides a code generator for OpenAPI v2. |
qmgmt
Package qmgmt is a reverse proxy.
|
Package qmgmt is a reverse proxy. |