Fork me on GitHub
#datalevin
<
2021-11-21
>
ericdallo13:11:13

What's the best way to update a value in datalevin via transact-kv?

ericdallo13:11:13

I have this inserted:

(d/transact-kv datalevin-db [[:put analysis-table-name :project-analysis {:version version
                                                                                :project-root (str project-root-path)
                                                                                :project-hash project-hash
                                                                                :kondo-config-hash kondo-config-hash
                                                                                :classpath classpath
                                                                                :stubs-generation-namespaces stubs-namespaces
                                                                                :analysis analysis}]])
I want to update this entry merging the existing :analysis with one more local analysis

ericdallo13:11:48

I can't see a way without overwriting everything again

ericdallo14:11:16

Maybe separate the keys to a a key-value pair instead of having everything in one single map

ericdallo14:11:09

nvm, I went with the read -> assoc-> write again approach, but probably I'll refactor to use different keys in the future, not sure if that would bring more advantages though