Documentation
¶
Index ¶
- func SetAccessLog(accessLog AccessLog)
- func SetMetricsRecord(metricsRecord MetricsRecord)
- func Start(s *Server)
- func StreamAccess(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, ...) (err error)
- func StreamValidator(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, ...) (err error)
- func UnaryAccess(conf *Config) ...
- func UnaryValidator(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (resp interface{}, err error)
- type AccessLog
- type Config
- type Http
- type Http3
- type HttpOption
- type MetricsRecord
- type Server
- type ServerOption
- type StaticFsConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetAccessLog ¶
func SetAccessLog(accessLog AccessLog)
func SetMetricsRecord ¶ added in v1.0.6
func SetMetricsRecord(metricsRecord MetricsRecord)
func StreamAccess ¶
func StreamAccess(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) (err error)
func StreamValidator ¶ added in v1.5.11
func StreamValidator(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 UnaryValidator ¶ added in v1.5.11
func UnaryValidator( 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
Gin gini.Config `json:"gin"`
EnableCors bool
Cors *cors.Options `json:"cors"`
Middlewares []http.HandlerFunc
HttpOption HttpOption
// Grpc options
GrpcOptions []grpc.ServerOption
EnableGrpcWeb bool
GrpcWebOption []web.Option `json:"grpc_web"`
Tracing, Metrics, GenDoc bool
BaseContext func() context.Context
}
type HttpOption ¶ added in v1.0.6
type HttpOption struct {
ExcludeLogPrefixes []string
IncludeLogPrefixes []string
StaticFs []StaticFsConfig `json:"static_fs"`
Middlewares []http.HandlerFunc
}
type MetricsRecord ¶ added in v1.0.6
type MetricsRecord = 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 ServerOption ¶ added in v1.0.6
type ServerOption interface {
// contains filtered or unexported methods
}
TODO
type StaticFsConfig ¶
Click to show internal directories.
Click to hide internal directories.