|
|
@@ -136,11 +136,11 @@ parent: child page 2
|
|
|
(testing "Single page query"
|
|
|
(are [x y] (= (q-count x) y)
|
|
|
"[[page 1]]"
|
|
|
- {:query '[[?b :block/path-ref-pages [:block/name "page 1"]]]
|
|
|
+ {:query '[[?b :block/path-refs [:block/name "page 1"]]]
|
|
|
:count 6}
|
|
|
|
|
|
"[[page 2]]"
|
|
|
- {:query '[[?b :block/path-ref-pages [:block/name "page 2"]]]
|
|
|
+ {:query '[[?b :block/path-refs [:block/name "page 2"]]]
|
|
|
:count 4}))
|
|
|
|
|
|
(testing "Block properties query"
|
|
|
@@ -327,29 +327,29 @@ parent: child page 2
|
|
|
(testing "AND queries"
|
|
|
(are [x y] (= (q-count x) y)
|
|
|
"(and [[tag1]] [[page 2]])"
|
|
|
- {:query '([?b :block/path-ref-pages [:block/name "tag1"]]
|
|
|
- [?b :block/path-ref-pages [:block/name "page 2"]])
|
|
|
+ {:query '([?b :block/path-refs [:block/name "tag1"]]
|
|
|
+ [?b :block/path-refs [:block/name "page 2"]])
|
|
|
:count 1})
|
|
|
|
|
|
(are [x y] (= (q-count x) y)
|
|
|
"(and [[tag1]] [[page 2]])"
|
|
|
- {:query '([?b :block/path-ref-pages [:block/name "tag1"]]
|
|
|
- [?b :block/path-ref-pages [:block/name "page 2"]])
|
|
|
+ {:query '([?b :block/path-refs [:block/name "tag1"]]
|
|
|
+ [?b :block/path-refs [:block/name "page 2"]])
|
|
|
:count 1}))
|
|
|
|
|
|
(testing "OR queries"
|
|
|
(are [x y] (= (q-count x) y)
|
|
|
"(or [[tag1]] [[page 2]])"
|
|
|
{:query '(or
|
|
|
- (and [?b :block/path-ref-pages [:block/name "tag1"]])
|
|
|
- (and [?b :block/path-ref-pages [:block/name "page 2"]]))
|
|
|
+ (and [?b :block/path-refs [:block/name "tag1"]])
|
|
|
+ (and [?b :block/path-refs [:block/name "page 2"]]))
|
|
|
:count 4}))
|
|
|
|
|
|
(testing "NOT queries"
|
|
|
(are [x y] (= (q-count x) y)
|
|
|
"(not [[page 1]])"
|
|
|
{:query '([?b :block/uuid]
|
|
|
- (not [?b :block/path-ref-pages [:block/name "page 1"]]))
|
|
|
+ (not [?b :block/path-refs [:block/name "page 1"]]))
|
|
|
:count 8}))
|
|
|
|
|
|
(testing "Between query"
|
|
|
@@ -375,15 +375,15 @@ parent: child page 2
|
|
|
{:query '([?b :block/uuid]
|
|
|
[?b :block/marker ?marker]
|
|
|
[(contains? #{"DONE"} ?marker)]
|
|
|
- (not [?b :block/path-ref-pages [:block/name "page 1"]]))
|
|
|
+ (not [?b :block/path-refs [:block/name "page 1"]]))
|
|
|
:count 0})
|
|
|
|
|
|
(are [x y] (= (q-count x) y)
|
|
|
"(and (todo now later) (or [[page 1]] [[page 2]]))"
|
|
|
{:query '([?b :block/marker ?marker]
|
|
|
[(contains? #{"NOW" "LATER"} ?marker)]
|
|
|
- (or (and [?b :block/path-ref-pages [:block/name "page 1"]])
|
|
|
- (and [?b :block/path-ref-pages [:block/name "page 2"]])))
|
|
|
+ (or (and [?b :block/path-refs [:block/name "page 1"]])
|
|
|
+ (and [?b :block/path-refs [:block/name "page 2"]])))
|
|
|
:count 3})
|
|
|
|
|
|
(are [x y] (= (q-count x) y)
|
|
|
@@ -393,8 +393,8 @@ parent: child page 2
|
|
|
[?b :block/marker ?marker]
|
|
|
[(contains? #{"NOW" "LATER"} ?marker)]
|
|
|
(or
|
|
|
- (and [?b :block/path-ref-pages [:block/name "page 1"]])
|
|
|
- (and [?b :block/path-ref-pages [:block/name "page 2"]]))))
|
|
|
+ (and [?b :block/path-refs [:block/name "page 1"]])
|
|
|
+ (and [?b :block/path-refs [:block/name "page 2"]]))))
|
|
|
:count 11})
|
|
|
|
|
|
;; FIXME: not working
|
|
|
@@ -412,8 +412,8 @@ parent: child page 2
|
|
|
[?b :block/marker ?marker]
|
|
|
[(contains? #{"NOW" "LATER" "DONE"} ?marker)]
|
|
|
(or
|
|
|
- (and [?b :block/path-ref-pages [:block/name "page 1"]])
|
|
|
- (and (not [?b :block/path-ref-pages [:block/name "page 1"]]))))
|
|
|
+ (and [?b :block/path-refs [:block/name "page 1"]])
|
|
|
+ (and (not [?b :block/path-refs [:block/name "page 1"]]))))
|
|
|
:count 5}))
|
|
|
|
|
|
(testing "sort-by (created_at defaults to desc)"
|