Versions in this module Expand all Collapse all v0 v0.0.2 Aug 13, 2024 v0.0.1 Aug 9, 2024 Changes in this version + const ContentTypeCSS + const ContentTypeDownload + const ContentTypeHTML + const ContentTypeImageGIF + const ContentTypeImageICON + const ContentTypeImageJPEG + const ContentTypeImageJPG + const ContentTypeImagePNG + const ContentTypeImageWEBP + const ContentTypeJS + const ContentTypeJSON + const ContentTypeStream + const ContentTypeTextPlain + const ContentTypeXJS + const ContentTypeXML + const CorsAccessControlAllowHeaders + const CorsAccessControlAllowMethods + const HeaderAuthorization + const HeaderContentDisposition + const HeaderContentType + const HeaderCookie + const HeaderSetCookie + const HeaderSign + const HeaderUpgrade + const HeaderXCSRFToken + const HeaderXForwardedFor + const HeaderXRealIP + const HeaderXRequestID + var Rand = rand.New(rand.NewPCG(uint64(time.Now().UnixNano() + rand.Int64N(1024)), rand.Uint64())) + func CORS(c Context) bool + func IgnoreOne[T1 any, T2 any](_t1 T1, _t2 T2) T2 + func IgnoreTwo[T1 any, T2 any](_t1 T1, _t2 T2) T1 + func PointerFalse() *bool + func PointerFloat32(i float32) *float32 + func PointerFloat64(i float64) *float64 + func PointerInt(i int) *int + func PointerInt32(i int32) *int32 + func PointerInt64(i int64) *int64 + func PointerString(str string) *string + func PointerTrue() *bool + func PointerUint(i uint) *uint + func StrToBool(str string) bool + func StrToFloat32(str string) float32 + func StrToFloat64(str string) float64 + func StrToInt(str string) int + func StrToInt32(str string) int32 + func StrToInt64(str string) int64 + func StrToUint(str string) uint + func StrToUint32(str string) uint32 + func StrToUint64(str string) uint64 + type Context interface + GetAuthorization func() string + GetBasicAuth func() (username, password string, ok bool) + GetFormFile func(name string) (multipart.File, *multipart.FileHeader, error) + GetFormFileSave func(name string, saveName string) (int64, error) + GetFormValue func(key string) string + GetFormValueBool func(key string, def ...bool) bool + GetFormValueFloat64 func(key string, def ...float64) float64 + GetFormValueInt func(key string, def ...int) int + GetFormValueInt64 func(key string, def ...int64) int64 + GetFormValueString func(key string, def ...string) string + GetFormValueUint func(key string, def ...uint) uint + GetFormValueUint64 func(key string, def ...uint64) uint64 + GetHeader func() http.Header + GetHost func() string + GetIP func() string + GetMethod func() string + GetPath func() string + GetPathValue func(key string) string + GetPathValueBool func(key string, def ...bool) bool + GetPathValueFloat64 func(key string, def ...float64) float64 + GetPathValueInt func(key string, def ...int) int + GetPathValueInt64 func(key string, def ...int64) int64 + GetPathValueString func(key string, def ...string) string + GetPathValueUint func(key string, def ...uint) uint + GetPathValueUint64 func(key string, def ...uint64) uint64 + GetPostFormValue func(key string) string + GetPostFormValueBool func(key string, def ...bool) bool + GetPostFormValueFloat64 func(key string, def ...float64) float64 + GetPostFormValueInt func(key string, def ...int) int + GetPostFormValueInt64 func(key string, def ...int64) int64 + GetPostFormValueString func(key string, def ...string) string + GetPostFormValueUint func(key string, def ...uint) uint + GetPostFormValueUint64 func(key string, def ...uint64) uint64 + GetProto func() string + GetQuery func(key string) string + GetQueryBool func(key string, def ...bool) bool + GetQueryFloat64 func(key string, def ...float64) float64 + GetQueryInt func(key string, def ...int) int + GetQueryInt64 func(key string, def ...int64) int64 + GetQueryString func(key string, def ...string) string + GetQueryUint func(key string, def ...uint) uint + GetQueryUint64 func(key string, def ...uint64) uint64 + GetRemoteAddrIP func() string + GetURI func() string + GetUserAgent func() string + GetXCSRFToken func() string + GetXForwardedForIP func() string + GetXRealIP func() string + GetXRequestID func() string + Header func() http.Header + Logger func() *slog.Logger + Rand func() *rand.Rand + ReadBody func() ([]byte, error) + ReadJson func(obj any) error + ReadJsonV func(obj any) error + ReadXml func(obj any) error + ReadXmlV func(obj any) error + Request func() *http.Request + ResponseWriter func() http.ResponseWriter + SaveFormFile func(fh *multipart.FileHeader, dest string) (int64, error) + Store func() Store + Validator func(obj any) error + Write func(bytes []byte) (int, error) + WriteBytes func(statusCode int, contentType string, body []byte) error + WriteDownload func(name string, filePath string) error + WriteFile func(filePath string) error + WriteHTML func(statusCode int, str string) error + WriteHeader func(statusCode int) + WriteJSON func(v any) error + WriteJSONBytes func(body []byte) error + WriteStatusCode func(statusCode int) + WriteStdJSON func(code int, msg string, data any, other any) error + WriteStdXML func(code int, msg string, data any, other any) error + WriteStream func(statusCode int, contentType string, reader io.Reader) error + WriteString func(statusCode int, str string) error + WriteXML func(v any) error + WriteXMLBytes func(body []byte) error + type MiddlewareFunc func(Context) bool + type Serve interface + AllRouters func() []string + Group func(prevPath string) Serve + HandleFunc func(pattern string, handler func(Context)) + ServeHTTP func(w http.ResponseWriter, r *http.Request) + SetValidator func(v Validator) + Use func(fx MiddlewareFunc) Serve + func NewServeMux(logger *slog.Logger) Serve + type StdResp struct + Code int + Data StdRespData + Msg string + type StdRespData struct + Data any + Other any + type Store interface + Get func(key string, def ...any) (any, bool) + GetBool func(key string, def ...bool) (bool, bool) + GetFloat32 func(key string, def ...float32) (float32, bool) + GetFloat64 func(key string, def ...float64) (float64, bool) + GetInt func(key string, def ...int) (int, bool) + GetInt16 func(key string, def ...int16) (int16, bool) + GetInt32 func(key string, def ...int32) (int32, bool) + GetInt64 func(key string, def ...int64) (int64, bool) + GetInt8 func(key string, def ...int8) (int8, bool) + GetString func(key string, def ...string) (string, bool) + GetTime func(key string, def ...time.Time) (time.Time, bool) + GetUint func(key string, def ...uint) (uint, bool) + GetUint16 func(key string, def ...uint16) (uint16, bool) + GetUint32 func(key string, def ...uint32) (uint32, bool) + GetUint64 func(key string, def ...uint64) (uint64, bool) + GetUint8 func(key string, def ...uint8) (uint8, bool) + Set func(key string, val any) + type Validator interface + Struct func(interface{}) error