valuesFromQuery returns a function that extracts values from the query string.
(param string, limit uint)
| 162 | |
| 163 | // valuesFromQuery returns a function that extracts values from the query string. |
| 164 | func valuesFromQuery(param string, limit uint) ValuesExtractor { |
| 165 | if limit == 0 { |
| 166 | limit = 1 |
| 167 | } |
| 168 | return func(c *echo.Context) ([]string, ExtractorSource, error) { |
| 169 | result := c.QueryParams()[param] |
| 170 | if len(result) == 0 { |
| 171 | return nil, ExtractorSourceQuery, errQueryExtractorValueMissing |
| 172 | } else if len(result) > int(limit)-1 { |
| 173 | result = result[:limit] |
| 174 | } |
| 175 | return result, ExtractorSourceQuery, nil |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | // valuesFromParam returns a function that extracts values from the url param string. |
| 180 | func valuesFromParam(param string, limit uint) ValuesExtractor { |
searching dependent graphs…