diff options
Diffstat (limited to 'src/Store/Query/Parser.hs')
-rw-r--r-- | src/Store/Query/Parser.hs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/Store/Query/Parser.hs b/src/Store/Query/Parser.hs index 99ddc79..5b7bc1b 100644 --- a/src/Store/Query/Parser.hs +++ b/src/Store/Query/Parser.hs @@ -51,7 +51,11 @@ instance IsString Query where w <- P.optional do where_ whereClause - pure $ Select fs c js es w, + l <- P.optional do + limitClause + o <- P.optional do + offsetClause + pure $ Select fs c js es w l o, do update c <- collection @@ -83,6 +87,8 @@ instance IsString Query where or = void $ lexeme (P.string "OR") select = void $ lexeme (P.string "SELECT") where_ = void $ lexeme (P.string "WHERE") + offset_ = void $ lexeme (P.string "OFFSET") + limit_ = void $ lexeme (P.string "LIMIT") collection = lexeme $ P.takeWhile1P (Just "collection") (not . isSpace) @@ -119,6 +125,14 @@ instance IsString Query where b <- P.choice [Left <$> value, Right <$> field] pure $ Eq a b + offsetClause = do + offset_ + Offset <$> lexeme P.decimal + + limitClause = do + limit_ + Limit <$> lexeme P.decimal + fieldSelector = lexeme $ P.choice |