apputil

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UploadMaxSize = 10 << 20 // 10M
)

Variables

This section is empty.

Functions

func ConfigPath

func ConfigPath(appConfig *common.App) string

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

func ContentSubtype(contentType string) string

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 ID

func ID(appConfig *common.App) string

ID 程序ID 例:go-srv-services/DEVELOP/main/v1.0.0/user-service

func IsDebugMode

func IsDebugMode() bool

IsDebugMode ...

func IsLocalMode

func IsLocalMode() bool

IsLocalMode ...

func ParseEnv

func ParseEnv(appEnv string) (envEnum common.RuntimeEnvEnum_RuntimeEnv)

ParseEnv ...

func RequestDecoder

func RequestDecoder(r *http.Request, v interface{}) error

RequestDecoder ...

func RewriteJSONEncoding

func RewriteJSONEncoding()

RewriteJSONEncoding 覆盖 重写 json 响应 hub-pkg + kratos的encoding

func SetRuntimeEnv

func SetRuntimeEnv(appEnv common.RuntimeEnvEnum_RuntimeEnv)

SetRuntimeEnv ...

func Validate

func Validate(req validator) error

Validate ...

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL