(let [kv (d/datalog-kv conn)]
;; DBI opening is idempotent, so this is safe during application startup.
(d/open-dbi kv "audit-log")
(d/with-transaction [cn conn]
(let [cn-kv (d/datalog-kv cn)]
(d/transact! cn
[{:order/id "o-1001"
:order/status :order.status/paid}])
(d/transact-kv cn-kv "audit-log"
[[:put "o-1001"
{:event/type :order/paid
:order/id "o-1001"}]]
:string :data))))
I'm reading above example from the book, the kv store has a type called ':data'
I'm wondering why don't we have an explicit datalog schema value like :db.type/data for example? (Basically an edn idoc but without need for indexing by path feature)
Right now, the correct way I assume is just not to define schema at all if I want a 'arbitrary map data' as value type in the datalog store?Shall we give default a explicit name like :data then?
For example, given {:user/name "alice" :user/data {:a 1 :b 2 {:c "d"}}}
It feels weird just to
:user/name {:db/valueType :db.type/string}
rather than
:user/name {:db/valueType :db.type/string}
:user/data {:db/valueType :db.type/data}
Also the book mentions "Lockdown: In production, consider opening the connection with {:closed-schema? true} to reject unknown attributes, and {:validate-data? true} to check values against their declared types."
If default has no named type, then it's hard to do the above I guess?I didn't know about :user/data {} trick, that make sense, thanks