diff options
author | Michael Muré <batolettre@gmail.com> | 2021-02-27 20:31:10 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2021-02-27 20:31:10 +0100 |
commit | fab626a7a663a8fa6ef27848bb63e91af812ab8c (patch) | |
tree | c0d7c4f0cfe23044af8eee72dd3d1eee34801bb5 /query/parser.go | |
parent | cb61245078a0e8f14e359ed20e0582a695645a08 (diff) | |
download | git-bug-fab626a7a663a8fa6ef27848bb63e91af812ab8c.tar.gz |
query: refactor to reuse the split function for both query and token
Diffstat (limited to 'query/parser.go')
-rw-r--r-- | query/parser.go | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/query/parser.go b/query/parser.go index e820c629..6fd5cd74 100644 --- a/query/parser.go +++ b/query/parser.go @@ -71,13 +71,7 @@ func Parse(query string) (*Query, error) { case tokenKindKVV: switch t.qualifier { case "metadata": - if len(t.subQualifier) == 0 { - return nil, fmt.Errorf("empty value for sub-qualifier \"metadata:%s\"", t.subQualifier) - } - var pair StringPair - pair.Key = t.subQualifier - pair.Value = t.value - q.Metadata = append(q.Metadata, pair) + q.Metadata = append(q.Metadata, StringPair{Key: t.subQualifier, Value: t.value}) default: return nil, fmt.Errorf("unknown qualifier \"%s:%s\"", t.qualifier, t.subQualifier) |