MCPcopy Index your code
hub / github.com/coder/coder / UInt

Method UInt

coderd/httpapi/queryparams.go:60–72  ·  view source on GitHub ↗
(vals url.Values, def uint64, queryParam string)

Source from the content-addressed store, hash-verified

58}
59
60func (p *QueryParamParser) UInt(vals url.Values, def uint64, queryParam string) uint64 {
61 v, err := parseQueryParam(p, vals, func(v string) (uint64, error) {
62 return strconv.ParseUint(v, 10, 64)
63 }, def, queryParam)
64 if err != nil {
65 p.Errors = append(p.Errors, codersdk.ValidationError{
66 Field: queryParam,
67 Detail: fmt.Sprintf("Query param %q must be a valid positive integer: %s", queryParam, err.Error()),
68 })
69 return 0
70 }
71 return v
72}
73
74func (p *QueryParamParser) Int(vals url.Values, def int, queryParam string) int {
75 v, err := parseQueryParam(p, vals, strconv.Atoi, def, queryParam)

Callers 1

workspaceAgentPTYMethod · 0.95

Calls 2

parseQueryParamFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected