Asami is schema-less, but during transactions it can be useful to incorporate schema information. For instance:
(transact conn {:tx-data [{:db/ident "first" :data 1}]})
(transact conn {:tx-data [{:db/ident "first" :data 42}]
:schema {:db/ident :data
:db/cardinality :db/cardinality/one})
By indicating a cardinality of one, this is equivalent to using an update annotation on the :data attribute.
{:data 42}
Without the schema, this would have resulted in:
{:data #{1 42}}
Also, data integrity can be checked:
(transact conn {:tx-data [{:db/ident "first" :data "forty-two"}]
:schema {:db/ident :data
:db/valueType :db.type/long})
This would throw an ExceptionInfo, with a message like:
Attribute :data cannot accept data: "forty-two". Requires Long value.
These changes will occur in asami.entities
Asami is schema-less, but during transactions it can be useful to incorporate schema information. For instance:
By indicating a cardinality of one, this is equivalent to using an update annotation on the
:dataattribute.{:data 42}Without the schema, this would have resulted in:
{:data #{1 42}}Also, data integrity can be checked:
This would throw an
ExceptionInfo, with a message like:Attribute :data cannot accept data: "forty-two". Requires Long value.These changes will occur in
asami.entities