Documentation ¶
Index ¶
- Constants
- func ConfigPath(appConfig *common.App) string
- func ContentSubtype(contentType string) string
- func ErrorEncoder(w stdhttp.ResponseWriter, r *stdhttp.Request, err error)
- func ID(appConfig *common.App) string
- func IsDebugMode() bool
- func IsLocalMode() bool
- func ParseEnv(appEnv string) (envEnum common.RuntimeEnvEnum_RuntimeEnv)
- func RequestDecoder(r *http.Request, v interface{}) error
- func RewriteJSONEncoding()
- func SetRuntimeEnv(appEnv common.RuntimeEnvEnum_RuntimeEnv)
- func Validate(req validator) error
Constants ¶
View Source
const (
UploadMaxSize = 10 << 20 // 10M
)
Variables ¶
This section is empty.
Functions ¶
func ConfigPath ¶
ConfigPath 配置路径;用于配置中心,如:consul、etcd、... @result = app.BelongTo + "/" + app.RuntimeEnv + "/" + app.Branch + "/" + app.Version + "/" + app.Name 例:go-srv-services/DEVELOP/main/v1.0.0/user-service
func ContentSubtype ¶
ContentSubtype returns the content-subtype for the given content-type. The given content-type must be a valid content-type that starts with but no content-subtype will be returned. according rfc7231. contentType is assumed to be lowercase already.
func ErrorEncoder ¶
func ErrorEncoder(w stdhttp.ResponseWriter, r *stdhttp.Request, err error)
ErrorEncoder http.DefaultErrorEncoder TODO: move it to server.http.error.handler
func ParseEnv ¶
func ParseEnv(appEnv string) (envEnum common.RuntimeEnvEnum_RuntimeEnv)
ParseEnv ...
func RewriteJSONEncoding ¶
func RewriteJSONEncoding()
RewriteJSONEncoding 覆盖 重写 json 响应 hub-pkg + kratos的encoding
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.