2025-04-15 23:49:28 +03:00

22 lines
275 B
Go

package request
import (
"net/http"
"strconv"
)
func Param(r *http.Request, name string) (uint64, error) {
idStr := r.PathValue(name)
id, err := strconv.ParseUint(idStr, 10, 64)
if err != nil {
return id, err
}
if id < 1 {
return id, err
}
return id, nil
}