aboutsummaryrefslogtreecommitdiffstats
path: root/src/Store/Query.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Store/Query.hs')
-rw-r--r--src/Store/Query.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Store/Query.hs b/src/Store/Query.hs
index 4c0f829..8520d0b 100644
--- a/src/Store/Query.hs
+++ b/src/Store/Query.hs
@@ -24,6 +24,7 @@ import Store.Query.Record
import Store.Query.Type
import Store.Store qualified as S
import System.FilePath ((</>))
+import Text.Regex.PCRE
data Paginated = Paginated
{ count :: Int,
@@ -194,6 +195,10 @@ satisfies Nothing _ = True
satisfies (Just (And ws)) vs = all (\w -> satisfies (Just w) vs) ws
satisfies (Just (Or ws)) vs = any (\w -> satisfies (Just w) vs) ws
satisfies (Just (Where (Eq f g))) vs = either Just (flip lookups vs) f == either Just (flip lookups vs) g
+satisfies (Just (Where (Regex f p))) vs =
+ case either Just (flip lookups vs) f of
+ Just (J.String s) -> p `matchTest` T.unpack s
+ _ -> False
decodeFile :: String -> String -> S.StoreM J.Value
decodeFile c fn = do