datascript

Immutable database and Datalog query engine for Clojure, ClojureScript and JS
eslachance 2018-05-12T16:51:23.000094Z

I apologize if this sounds noobish but I can honestly not find the answer to this. I need to have various.. "tables" in the schema, and I'm actually just wondering how to insert into a particular schema. This is the code I have right now:

(def schema
  {:guild/id   {:db/unique :db.unique/identity}
   :channel/id {:db/unique :db.unique/identity}
   :message/id {:db/unique :db.unique/identity}
   :role/id    {:db/unique :db.unique/identity}
   :emoji/id   {:db/unique :db.unique/identity}
   :user/id    {:db/unique :db.unique/identity}
   :user       {:db/type :db.type/ref}
   :guild      {:db/type :db.type/ref}
   :channel    {:db/type :db.type/ref}
   })

(def conn (d/create-conn schema))
where d is datascript.core. Pretty much all the examples I've seen only have a single table (like that aka ones in the readme and examples) so I'm a little stumped as to how to structure my d/transact! function to properly insert, say, a guild in there. I'm unfortunately looking at old code that I haven't touched in a while so I don't even remember how I got to this schema 😕