specter

J 2023-12-05T20:42:20.308579Z

Hi guys! I have this kind of data:

(def index
  {"foo/article/*" {:exclude #{:a} :include #{:b}}
   "foo*" {:exclude #{:c}}
   "baz" {:exclude #{:d} :include #{:a}}})
I want to match all exclude and include keys for all the key who end with a *. This works:
(def ks (s/select [s/MAP-KEYS (s/pred #(str/ends-with? % "*"))] index))
  (def path (apply s/multi-path (mapv #(vector (s/keypath %)) ks)))
  (s/select path url-index)
but is there an other way to achieve this query?

xificurC 2023-12-05T20:52:06.785279Z

[s/ALL (fn [[k v]] (str/ends-with? k "*")) s/LAST]. Untested

J 2023-12-05T20:59:58.726549Z

Yes it works! Thanks!