diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-04 22:09:18 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-04 22:09:18 +0200 |
| commit | bb46cfbccea301721fb93485ea7169f5841feda3 (patch) | |
| tree | a5f8f72477004206b06ac86b3ab105323bd1ce1e /internal | |
| parent | 8b7116421dc30ddef2d8426f825cc7f50f3f0ccd (diff) | |
refactor: simplify nil-or-empty token checks in query parser (task 338)
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/mapr/query.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/internal/mapr/query.go b/internal/mapr/query.go index 06a8dc2..5492848 100644 --- a/internal/mapr/query.go +++ b/internal/mapr/query.go @@ -164,14 +164,14 @@ func (q *Query) parseTokens(tokens []token) ([]token, error) { } case "group": tokens = tokensConsumeOptional(tokens[1:], "by") - if tokens == nil || len(tokens) < 1 { + if len(tokens) < 1 { return tokens, errors.New(invalidQuery + unexpectedEnd) } tokens, q.GroupBy = tokensConsumeStr(tokens) q.GroupKey = strings.Join(q.GroupBy, ",") case "rorder": tokens = tokensConsumeOptional(tokens[1:], "by") - if tokens == nil || len(tokens) < 1 { + if len(tokens) < 1 { return tokens, errors.New(invalidQuery + unexpectedEnd) } tokens, found = tokensConsume(tokens) @@ -182,7 +182,7 @@ func (q *Query) parseTokens(tokens []token) ([]token, error) { q.ReverseOrder = true case "order": tokens = tokensConsumeOptional(tokens[1:], "by") - if tokens == nil || len(tokens) < 1 { + if len(tokens) < 1 { return tokens, errors.New(invalidQuery + unexpectedEnd) } tokens, found = tokensConsume(tokens) |
