refactor: improve binding, performance, and type safety

- Implement ShouldBind with support for JSON, Form, WANF, and GOB formats
- Add ShouldBindForm, ShouldBindGOB, and helper functions for form binding
- Use fmt.Appendf instead of fmt.Sprintf for better performance
- Replace interface{} with any for modern Go style
- Use maps.Copy for cleaner header copying
- Update strings.SplitSeq to use range over strings.Seq
- Remove deprecated placeholder comments and add proper implementations
- Fix reflect.Pointer usage for Go 1.22+ compatibility
This commit is contained in:
WJQSERVER 2026-03-17 12:02:49 +08:00
parent 9e3e43bf88
commit c4c0160b5f
6 changed files with 187 additions and 36 deletions

View file

@ -12,7 +12,7 @@ const (
defaultMemory = 32 << 20 // 32 MB, Gin 的默认值,用于 ParseMultipartForm
)
type H map[string]interface{} // map简写, 类似gin.H
type H map[string]any // map简写, 类似gin.H
type Handle func(http.ResponseWriter, *http.Request, Params)