package webutil import ( "fmt" "net/http" ) type PathScanner struct { r *http.Request err error } func NewPathScanner(r *http.Request) *PathScanner { return &PathScanner{r: r} } func (s *PathScanner) Scan(name string, val any) *PathScanner { if s.err != nil { return s } if err := scan(s.r.PathValue(name), val); err != nil { s.err = fmt.Errorf("Error in field %s: %w", name, err) } return s } func (s *PathScanner) Error() error { return s.err }