Fork me on GitHub
#datomic
<
2017-04-04
>
karol.adamiec10:04:45

how does one usually store config values in datomic? lets say i need to define a margin value for a broad category of products. What is the most convienient way to do that with regards to easily manipulating that value, resetting it, and having only one instance of it per db ?

robert-stuttaford10:04:55

we have a ‘system’ entity on which we put global values

karol.adamiec10:04:01

so you define a system entity that has know unique name

robert-stuttaford10:04:11

actually just a particular attr

karol.adamiec10:04:15

so one can easily grab that anytine?

karol.adamiec10:04:56

could you paste an example declaration and usage pattern? 🙂

karol.adamiec10:04:14

i thinnk it would be easiest to understand the pattern

robert-stuttaford10:04:16

literally just :db/ident :system with a doc string and a bool type, and a function which finds the first entity with :system true. all other code paths use that function. we manually transacted the entity’s creation

robert-stuttaford10:04:26

after that, it’s a normal entity with schema for whatever

karol.adamiec10:04:20

ah i see. one could also slap a unique on that to always have enforced only one :system true …. and could also retrieve it by lookoup refs… correct?

karol.adamiec11:04:32

and upserting works as well…. sweet 😄

jdkealy20:04:08

I'm running into a strange error i can't really reason about. When I try to do a specific transaction, I get a stackoverflow error: https://gist.github.com/jdkealy/6a31372d05327c29df80c19a6180eac1 I have an attribute called user/org_touches ... which is cardinality = many. I have 2 user ids.... let's say 1 and 2 If i transact {:db/id 1 :user/org_touches [2] } it works fine, but if i do {:db/id 2 :user/org_touches [1] } it errors out with the above error

jdkealy20:04:42

ahh sorry nm.... was actually not the root of the error