Documentation
¶
Index ¶
- func NewGrpcWebServer(grpcServer *grpc.Server) *web.WrappedGrpcServer
- func SetAccessLog(accessLog AccessLog)
- func Start(s *Server)
- func StreamAccess(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, ...) (err error)
- func UnaryAccess(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (resp interface{}, err error)
- func Validator(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (resp interface{}, err error)
- type AccessLog
- type ConvertContext
- type CustomContext
- type Http3Config
- type Server
- type ServerConfig
- type StaticFsConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGrpcWebServer ¶
func NewGrpcWebServer(grpcServer *grpc.Server) *web.WrappedGrpcServer
func SetAccessLog ¶
func SetAccessLog(accessLog AccessLog)
func Start ¶
func Start(s *Server)
func Start(config *ServerConfig, ginhandle func(*gin.Engine), grpchandle func(*grpc.Server), grpcoptions []grpc.ServerOption, gatewayregist gateway.GatewayHandle, graphqlresolve graphql.ExecutableSchema) {
NewServer(config, ginhandle, grpchandle, grpcoptions, gatewayregist, graphqlresolve).Start()
}
func StreamAccess ¶
func StreamAccess(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) (err error)
func UnaryAccess ¶
func UnaryAccess( ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler, ) (resp interface{}, err error)
func Validator ¶
func Validator( ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler, ) (resp interface{}, err error)
Types ¶
type AccessLog ¶
type AccessLog = func(ctxi *http_context.Context, url, method, body, result string, code int)
type ConvertContext ¶
type ConvertContext func(r *http.Request) *http_context.Context
type Http3Config ¶
type Server ¶
type Server struct {
Config *ServerConfig
// Grpc options
GRPCOptions []grpc.ServerOption
// 注册 grpc 服务
GRPCHandle func(*grpc.Server)
// 注册 grpc-gateway 服务
GatewayRegistr gateway.GatewayHandle
// 注册 gin 服务
GinHandle func(engine *gin.Engine)
// 注册 graphql 服务
GraphqlResolve graphql.ExecutableSchema
}
func NewServer ¶
func NewServer(config *ServerConfig, ginhandle func(*gin.Engine), grpchandle func(*grpc.Server), grpcoptions []grpc.ServerOption, gatewayregist gateway.GatewayHandle, graphqlresolve graphql.ExecutableSchema) *Server
type ServerConfig ¶
type ServerConfig struct {
Protocol string
Domain string
Port int32
StaticFs []*StaticFsConfig
ReadTimeout time.Duration `expr:"$+5"`
WriteTimeout time.Duration `expr:"$+5"`
OpenTracing, Prometheus, GenDoc bool
Gin *gini.Config
GrpcWeb bool
Http3 *Http3Config
Cors cors.Options
}
func (*ServerConfig) Init ¶
func (c *ServerConfig) Init()
type StaticFsConfig ¶
Click to show internal directories.
Click to hide internal directories.