Documentation
¶
Index ¶
- 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 Config
- type ConvertContext
- type CustomContext
- type Server
- type StaticFsConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetAccessLog ¶
func SetAccessLog(accessLog AccessLog)
func Start ¶
func Start(s *Server)
func Start(config *Config, 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 Config ¶ added in v1.6.0
type Config struct {
Http http.Server
Http2 http2.Server
Http3 *http3.Server `json:"http3,omitempty"`
StopTimeout time.Duration
CertFile string `json:"cert_file,omitempty"`
KeyFile string `json:"key_file,omitempty"`
StaticFs []*StaticFsConfig `json:"static_fs,omitempty"`
Gin *gin.Engine `json:"gin,omitempty"`
EnableCors bool
Cors *cors.Options `json:"cors"`
// Grpc options
GRPCOptions []grpc.ServerOption
EnableGrpcWeb bool
GrpcWebOption []web.Option `json:"grpc_web,omitempty"`
Trace, Prometheus, GenDoc bool
}
func (*Config) InitAfterInject ¶ added in v1.6.0
func (c *Config) InitAfterInject()
func (*Config) InitBeforeInject ¶ added in v1.6.0
func (c *Config) InitBeforeInject()
type ConvertContext ¶
type ConvertContext func(r *http.Request) *http_context.Context
type Server ¶
type Server struct {
Config *Config
// 注册 grpc 服务
GRPCHandle func(*grpc.Server)
// 注册 grpc-gateway 服务
GatewayHandle gateway.GatewayHandle
// 注册 gin 服务
GinHandle func(engine *gin.Engine)
// 注册 graphql 服务
GraphqlHandle graphql.ExecutableSchema
}
type StaticFsConfig ¶
Click to show internal directories.
Click to hide internal directories.