sync from project

This commit is contained in:
2025-06-18 10:12:19 +08:00
parent 61ffeeb3b8
commit fb579e8689
20 changed files with 1332 additions and 103 deletions

View File

@ -2,12 +2,8 @@ package magic
import "net/http"
type State[T any] struct {
Data T
}
func RegisterState[T any](data T) {
RegisterExtractor(State[T]{}, func(r *http.Request) (any, error) {
return State[T]{Data: data}, nil
RegisterExtractor(data, func(r *http.Request) (any, error) {
return data, nil
})
}