Documentation ¶
Index ¶
- Constants
- func CGIVariableToHTTPHeader(key string) string
- func HTTPHeaderToCGIVariable(key string) string
- type Config
- func (config *Config) Address() string
- func (config *Config) Build() *Server
- func (config *Config) WithDeployment(deployment string) *Config
- func (config *Config) WithDisableMetric(disableMetric bool) *Config
- func (config *Config) WithDisableSlowQuery(disableSlowQuery bool) *Config
- func (config *Config) WithDisableTrace(disableTrace bool) *Config
- func (config *Config) WithHost(host string) *Config
- func (config *Config) WithMode(mode string) *Config
- func (config *Config) WithPort(port int) *Config
- func (config *Config) WithServiceAddress(serviceAddress string) *Config
- func (config *Config) WithSlowQueryThresholdInMilli(milli int64) *Config
- type HTTPHeader
- type HTTPHeaderCarrier
- type HTTPHeaderSetter
- type Server
Constants ¶
const ( // DebugMode indicates gin mode is debug. DebugMode = "debug" // ReleaseMode indicates gin mode is release. ReleaseMode = "release" // TestMode indicates gin mode is test. TestMode = "test" )
const ModName = "server.hertz"
ModName ..
Variables ¶
This section is empty.
Functions ¶
func CGIVariableToHTTPHeader ¶
CGIVariableToHTTPHeader converts a CGI variable into an HTTP header key. For example, `ABC_DEF` will be converted to `abc-def`.
func HTTPHeaderToCGIVariable ¶
HTTPHeaderToCGIVariable performs an CGI variable conversion. For example, an HTTP header key `abc-def` will result in `ABC_DEF`.
Types ¶
type Config ¶
type Config struct { Host string Port int Mode string Deployment string DisableMetric bool DisableTrace bool DisableSlowQuery bool ServiceAddress string SlowQueryThresholdInMill int64 }
Config HTTP config
func (*Config) WithDeployment ¶
WithDeployment ...
func (*Config) WithDisableMetric ¶
WithDisableMetric ...
func (*Config) WithDisableSlowQuery ¶
WithDisableSlowQuery ...
func (*Config) WithDisableTrace ¶
WithDisableTrace ...
func (*Config) WithServiceAddress ¶
WithServiceAddress ...
func (*Config) WithSlowQueryThresholdInMilli ¶
WithSlowQueryThresholdInMilli WithPort ...
type HTTPHeader ¶
HTTPHeader is provided to wrap an http.Header into an HTTPHeaderCarrier.
func (HTTPHeader) Set ¶
func (h HTTPHeader) Set(key, value string)
Set sets the header entries associated with key to the single element value. The key will converted into lowercase as the HTTP/2 protocol requires.
func (HTTPHeader) Visit ¶
func (h HTTPHeader) Visit(v func(k, v string))
Visit implements the HTTPHeaderCarrier interface.
type HTTPHeaderCarrier ¶
type HTTPHeaderCarrier interface {
Visit(func(k, v string))
}
HTTPHeaderCarrier accepts a visitor to access all key value pairs in an HTTP header.
type HTTPHeaderSetter ¶
type HTTPHeaderSetter interface {
Set(key, value string)
}
HTTPHeaderSetter sets a key with a value into a HTTP header.
type Server ¶
Server ...
func (*Server) GracefulStop ¶
GracefulStop implements server.Server interface it will stop gin server gracefully
func (*Server) Info ¶
func (s *Server) Info() *server.ServiceInfo
Info returns server info, used by governor and consumer balancer