{
:db/id #db/id[:db.part/db]
:db/ident :outcome/weighting
:db/valueType :db.type/float
:db/cardinality :db.cardinality/one
:db.install/_attribute :db.part/db
}
I get an error when I try and add 1
to the entity.
:message "java.lang.IllegalArgumentException: :db.error/wrong-type-for-attribute Value 1 is not a valid :float for attribute :outcome/weighting"
It works fine if I pass in 1.0
.
I appreciate that (= (float? 1) false)
but is there any other way I can avoid this via Datomic settings without parsing the incoming EDN and adjusting from 1
to 1.0
?
Datalog is a deductive query system, typically consisting of: A database of facts. A set of rules for deriving new facts from existing facts. a query processor that, given some partial specification of a fact or rule: finds all instances of that specification implied by the database and rules.
Because Datomic queries run in application process space, they can be faster than any possible RPC query in some circumstances.
You can't store both ints and floats in the same schema attribute in Datomic. So you'll need to coerce the value to whatever type you pick (probably float or double here) appropriately before transacting it. You can do this in the code performing the transaction, or could even do it in a transaction function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With