aboutsummaryrefslogtreecommitdiffstats
path: root/src/Store/Query/Record.hs
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2024-02-19 04:55:36 +0100
committerLibravatar Alexander Foremny <aforemny@posteo.de>2024-02-19 04:55:36 +0100
commitbbe3b75bfd0767c61bcd436e843b9c785efd289f (patch)
tree5d3f62f0e8eb8b96f89175bfc43e443648ad4f8c /src/Store/Query/Record.hs
parent748f82632e5ab6fc2c2f7a6eedb1ac4c467ccb3e (diff)
support `INSERT`, `DELETE`, `UPDATE`
Diffstat (limited to 'src/Store/Query/Record.hs')
-rw-r--r--src/Store/Query/Record.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Store/Query/Record.hs b/src/Store/Query/Record.hs
index b00be27..d663716 100644
--- a/src/Store/Query/Record.hs
+++ b/src/Store/Query/Record.hs
@@ -5,6 +5,7 @@ module Store.Query.Record
lookup,
Records,
lookups,
+ union,
disjointUnion,
disjointUnions,
)
@@ -52,6 +53,11 @@ lookups f rs =
[v] -> Just v
(_ : _) -> throw (DuplicateField (toString f))
+union :: J.Value -> J.Value -> J.Value
+union (J.Object r) (J.Object s) =
+ J.Object (JM.unionWith union r s)
+union _ s = s
+
disjointUnion :: J.Value -> J.Value -> J.Value
disjointUnion (J.Object r) (J.Object s) =
J.Object (JM.unionWithKey disjointUnion' r s)