mirror of
https://github.com/infinite-iroha/touka.git
synced 2026-06-13 15:47:38 +08:00
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:
parent
9e3e43bf88
commit
c4c0160b5f
6 changed files with 187 additions and 36 deletions
4
sse.go
4
sse.go
|
|
@ -40,8 +40,8 @@ func (e *Event) Render(w io.Writer) error {
|
|||
buf.WriteString("\n")
|
||||
}
|
||||
if len(e.Data) > 0 {
|
||||
lines := strings.Split(e.Data, "\n")
|
||||
for _, line := range lines {
|
||||
lines := strings.SplitSeq(e.Data, "\n")
|
||||
for line := range lines {
|
||||
buf.WriteString("data: ")
|
||||
buf.WriteString(line)
|
||||
buf.WriteString("\n")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue