-
Notifications
You must be signed in to change notification settings - Fork 223
Utility to update entry properties: update-entry-properties #1037
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
38112b3
to
ec0d5ce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the implementation can be simplified a bit
(let [schema (m/schema ?schema) | ||
e (or (find schema k) | ||
(m/-fail! ::no-entry {:schema schema :k k})) | ||
[k p v] (case (count e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
entry contains always 3 elements I believe.
@@ -990,3 +990,25 @@ | |||
(mu/assoc-in [:foo :bar] :int) | |||
(mu/assoc-in [:foo :baz] :int) | |||
(mu/closed-schema))))) | |||
|
|||
(deftest update-entry-properties-test | |||
(is (= [:map [:me {:a 1, :b 1} :int]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add a failing test here too.
well, I can do those. merging. thanks! |
(mu/find [:map [:x :int]] :x)
; => [:x nil :int] |
Thanks! I was trying to reverse engineer this line, tbh I still don't understand it. Line 360 in 48544d5
|
(m/-get-entries (m/schema [:map [:x :int]]) :x nil)
; => :int
(m/-get-entries (m/schema [:map [:x :int]]) [::m/find :x] nil)
; => [:x nil :int] |
This is what I came up with to answer this slack question: https://clojurians.slack.com/archives/CLDK6MFMK/p1712696483105789