aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/Main.hs18
1 files changed, 9 insertions, 9 deletions
diff --git a/app/Main.hs b/app/Main.hs
index 4ccf455..dfee5e0 100644
--- a/app/Main.hs
+++ b/app/Main.hs
@@ -80,7 +80,7 @@ main = do
[]
data Query
- = Select FieldSelector Collection [Join FilePath] Where
+ = Select FieldSelector Collection [Join FilePath] WhereClauses
deriving (Show)
data FieldSelector
@@ -96,14 +96,14 @@ data Field
type Collection = FilePath
data Join a
- = LeftJoin a Where
- | RightJoin a Where
- | FullJoin a Where
+ = LeftJoin a WhereClauses
+ | RightJoin a WhereClauses
+ | FullJoin a WhereClauses
deriving (Show)
-type Where = [Cmp]
+type WhereClauses = [WhereClause]
-data Cmp
+data WhereClause
= Eq Field Field
deriving (Show)
@@ -228,13 +228,13 @@ join' = foldl' merge (J.Object JM.empty)
joinUnsafe :: [J.Value] -> J.Value
joinUnsafe = foldl' mergeUnsafe (J.Object JM.empty)
-where_ :: Where -> [[Record J.Value]] -> [[Record J.Value]]
+where_ :: WhereClauses -> [[Record J.Value]] -> [[Record J.Value]]
where_ ws vss = filter (satisfies ws) vss
-satisfies :: [Cmp] -> [Record J.Value] -> Bool
+satisfies :: WhereClauses -> [Record J.Value] -> Bool
satisfies ws vs = all (\w -> satisfy w vs) ws
-satisfy :: Cmp -> [Record J.Value] -> Bool
+satisfy :: WhereClause -> [Record J.Value] -> Bool
satisfy (Eq f f') vs = unique f vs == unique f' vs
data DuplicateField' = DuplicateField'