What data type to use so that 1 and 1.0 are valid in Datomic?

{ :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 to add 1 to the entity.

: message "java.lang.IllegalArgumentException :: db.error / invalid type for attribute Value 1 is not valid: float for attribute: result / weight"

This works fine if I go to 1.0 .

I appreciate this (= (float? 1) false) but is there any other way to avoid this through Datomic settings without parsing the incoming EDN and settings from 1 to 1.0 ?

+5
source share

Source: https://habr.com/ru/post/1232338/


All Articles