Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterHandler ¶ added in v0.1.6
func RegisterHandler(e *gin.Engine, handlerFunc func(mux *runtime.ServeMux), serveMuxOptions ...runtime.ServeMuxOption)
RegisterHandler registers a handler function with gin 注册一个处理器函数与gin 支持使用 gin 实现 grpc-gateway 的 http server
Types ¶
type Config ¶
type Config struct {
Addr string `mapstructure:"addr" yaml:"addr"` // HTTP server address // HTTP服务器地址
SwaggerDir string `mapstructure:"swaggerDir" yaml:"swaggerDir"` // Directory containing swagger files // 包含swagger文件的目录
ReadTimeout types.Duration `mapstructure:"readTimeout" yaml:"readTimeout"` // HTTP read timeout // HTTP读取超时时间
WriteTimeout types.Duration `mapstructure:"writeTimeout" yaml:"writeTimeout"` // HTTP write timeout // HTTP写入超时时间
ShutdownTimeout types.Duration `mapstructure:"shutdownTimeout" yaml:"shutdownTimeout"` // Graceful shutdown timeout // 优雅关闭超时时间
}
Config holds the configuration for gateway server 网关服务器配置
func DefaultGatewayConfig ¶
func DefaultGatewayConfig() *Config
DefaultGatewayConfig returns a default configuration for gateway 返回默认网关配置
type Gateway ¶
type Gateway struct {
// contains filtered or unexported fields
}
Gateway implements the Server interface for grpc-gateway Gateway 实现了 grpc-gateway 的 Server 接口
func New ¶
func New(cfg *Config, handlerFunc func(mux *runtime.ServeMux), serveMuxOptions ...runtime.ServeMuxOption) *Gateway
New creates a new Gateway instance 创建一个新的 Gateway 实例
func (*Gateway) ServeSwaggerUI ¶
ServeSwaggerUI serves swagger UI if enabled 如果启用了swagger,则提供swagger UI服务
Click to show internal directories.
Click to hide internal directories.