MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / parseBool

Function parseBool

dgraph/cmd/alpha/http.go:107–119  ·  view source on GitHub ↗

parseBool reads the value for given URL parameter from request and parses it into bool, empty string is converted into zero value

(r *http.Request, name string)

Source from the content-addressed store, hash-verified

105// parseBool reads the value for given URL parameter from request and
106// parses it into bool, empty string is converted into zero value
107func parseBool(r *http.Request, name string) (bool, error) {
108 value := r.URL.Query().Get(name)
109 if value == "" {
110 return false, nil
111 }
112
113 boolval, err := strconv.ParseBool(value)
114 if err != nil {
115 return false, errors.Wrapf(err, "while parsing %s as bool", name)
116 }
117
118 return boolval, nil
119}
120
121// parseDuration reads the value for given URL parameter from request and
122// parses it into time.Duration, empty string is converted into zero value

Callers 4

queryHandlerFunction · 0.85
mutationHandlerFunction · 0.85
commitHandlerFunction · 0.85
alterHandlerFunction · 0.85

Calls 2

GetMethod · 0.65
QueryMethod · 0.45

Tested by

no test coverage detected