Files
EvoBGP/internal/httpapi/list_params.go
T

25 lines
308 B
Go

package httpapi
import (
"net/http"
"strconv"
)
func parseListLimit(r *http.Request) int {
limit, _ := strconv.Atoi(r.URL.Query().Get("limit"))
if limit <= 0 {
return 50
}
if limit > 500 {
return 500
}
return limit
}
func strPtrOrNull(s string) any {
if s == "" {
return nil
}
return s
}