Documentation
¶
Index ¶
- func SetAccessLog(accessLog AccessLog)
- func SetPrometheusRecord(prometheusRecord PrometheusRecord)
- func Start(s *Server)
- func StreamAccess(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, ...) (err error)
- func UnaryAccess(conf *Config) ...
- func Validator(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (resp interface{}, err error)
- type AccessLog
- type Config
- type ConvertContext
- type CustomContext
- type Http
- type Http3
- type PrometheusRecord
- type Server
- type StaticFsConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetAccessLog ¶
func SetAccessLog(accessLog AccessLog)
func SetPrometheusRecord ¶
func SetPrometheusRecord(prometheusRecord PrometheusRecord)
func StreamAccess ¶
func StreamAccess(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) (err error)
func UnaryAccess ¶
func UnaryAccess(conf *Config) func( context.Context, interface{}, *grpc.UnaryServerInfo, grpc.UnaryHandler, ) (interface{}, 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, uri, method, body, result string, code int)
type Config ¶
type Config struct {
ServerName string
Http Http
Http2 http2.Server
Http3 *Http3 `json:"http3"`
StopTimeout time.Duration
StaticFs []StaticFsConfig `json:"static_fs"`
Gin gini.Config `json:"gin"`
EnableCors bool
Cors *cors.Options `json:"cors"`
// Grpc options
GRPCOptions []grpc.ServerOption
EnableGrpcWeb bool
GrpcWebOption []web.Option `json:"grpc_web"`
Trace, Prometheus, GenDoc bool
BaseContext func() context.Context
}
func (*Config) InitAfterInject ¶
func (c *Config) InitAfterInject()
func (*Config) InitBeforeInject ¶
func (c *Config) InitBeforeInject()
type ConvertContext ¶
type ConvertContext func(r *http.Request) *http_context.Context
type PrometheusRecord ¶
type PrometheusRecord = func(ctxi *http_context.Context, uri, method string, code int)
type Server ¶
type Server struct {
Config *Config
// 注册 grpc 服务
GRPCHandler func(*grpc.Server)
// 注册 grpc-gateway 服务
GatewayHandler gateway.GatewayHandler
// 注册 gin 服务
GinHandler func(*gin.Engine)
// 注册 graphql 服务
GraphqlHandler graphql.ExecutableSchema
// 各种钩子函数
OnBeforeStart func(context.Context)
OnAfterStart func(context.Context)
OnBeforeStop func(context.Context)
OnAfterStop func(context.Context)
}
type StaticFsConfig ¶
Click to show internal directories.
Click to hide internal directories.