Documentation ¶
Index ¶
- func Default[T any](value *T, defaultValue *T) *T
- func DefaultString(value string, defaultValue string) string
- func EnvVarCheckBool(name string) bool
- func GetTrustedIP(r *http.Request, depth int) string
- func GobHash(objs ...any) (uint32, error)
- func GobHashBytes(objs ...any) (uint32, error)
- func JsonError[T any](w http.ResponseWriter, statusCode int, message T)
- func JsonErrors[T any](w http.ResponseWriter, statusCode int, message []T)
- func JsonHash(objs ...any) (uint32, error)
- func JsonHashBytes(objs ...any) ([]byte, error)
- func JsonResponse(w http.ResponseWriter, statusCode int, data any)
- func ParseInt(s string, def int) (int, error)
- func ToBytes(a any) ([]byte, error)
- func WriteStatusCodeError(w http.ResponseWriter, code int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultString ¶
func EnvVarCheckBool ¶
func GetTrustedIP ¶ added in v0.10.0
GetTrustedIP returns the trusted IP address of the client. It checks the X-Forwarded-For header first, and falls back to the RemoteAddr field of the request if the header is not present. depth is the number of proxies that the request has passed through.
func GobHashBytes ¶
func JsonErrors ¶
func JsonErrors[T any](w http.ResponseWriter, statusCode int, message []T)
func JsonHashBytes ¶
func JsonResponse ¶
func JsonResponse(w http.ResponseWriter, statusCode int, data any)
func WriteStatusCodeError ¶
func WriteStatusCodeError(w http.ResponseWriter, code int)
Types ¶
This section is empty.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.