(create m)
creates an graph database instance for use with component
(graph/create {:type :datomic :uri "datomic:mem://graph-test" :schema {:user {:email [{:required true}] :firstname [{}] :lastname [{}] :hash [{}]}}}) ;; #datomic{:type :datomic, ;; :uri "datomic:mem://graph-test", ;; :schema {...}}
creates an graph database instance for use with component (graph/create {:type :datomic :uri "datomic:mem://graph-test" :schema {:user {:email [{:required true}] :firstname [{}] :lastname [{}] :hash [{}]}}}) ;; #datomic{:type :datomic, ;; :uri "datomic:mem://graph-test", ;; :schema {...}}
(delete db selector)
(delete db selector opts)
deletes an entry in the graph database
(-> (graph db-config) (graph/insert [{:user {:email "a@a.com"}} {:user {:email "b@b.com"}}]) (graph/delete {:user {:email "a@a.com"}}) (graph/select :user)) => #{{:user {:email "b@b.com"}}}
deletes an entry in the graph database (-> (graph db-config) (graph/insert [{:user {:email "a@a.com"}} {:user {:email "b@b.com"}}]) (graph/delete {:user {:email "a@a.com"}}) (graph/select :user)) => #{{:user {:email "b@b.com"}}}
(graph m)
creates an active graph database instance
(graph {:type :datomic :uri "datomic:mem://graph-test" :schema {:user {:email [{:required true}] :firstname [{}] :lastname [{}] :hash [{}]}} :options {:install-schema true :reset-db true}}) ;; #datomic{:type :datomic, ;; :uri "datomic:mem://graph-test", ;; :schema #schema{...}, ;; :options {:install-schema true, :reset-db true}, ;; :connection #conn{1000 #inst "2018-06-26T00:55:42.316-00:00"}}
creates an active graph database instance (graph {:type :datomic :uri "datomic:mem://graph-test" :schema {:user {:email [{:required true}] :firstname [{}] :lastname [{}] :hash [{}]}} :options {:install-schema true :reset-db true}}) ;; #datomic{:type :datomic, ;; :uri "datomic:mem://graph-test", ;; :schema #schema{...}, ;; :options {:install-schema true, :reset-db true}, ;; :connection #conn{1000 #inst "2018-06-26T00:55:42.316-00:00"}}
(insert db data)
(insert db data opts)
inserts into the graph database
(-> (graph db-config) (graph/insert {:user {:email "a@a.com"}}) (graph/select :user)) => #{{:user {:email "a@a.com"}}}
inserts into the graph database (-> (graph db-config) (graph/insert {:user {:email "a@a.com"}}) (graph/select :user)) => #{{:user {:email "a@a.com"}}}
(install-schema db schema)
installs the schema within the graph database
(-> (graph {:type :datomic :uri "datomic:mem://graph-test" :options {:reset-db true}}) (graph/install-schema {:user {:email [{:required true}] :firstname [{}] :lastname [{}] :hash [{}]}})) ;; #datomic{:type :datomic, ;; :uri "datomic:mem://graph-test", ;; :schema #schema{...}, ;; :options {:install-schema true, :reset-db true}, ;; :connection #conn{1000 #inst "2018-06-26T00:55:42.316-00:00"}}
installs the schema within the graph database (-> (graph {:type :datomic :uri "datomic:mem://graph-test" :options {:reset-db true}}) (graph/install-schema {:user {:email [{:required true}] :firstname [{}] :lastname [{}] :hash [{}]}})) ;; #datomic{:type :datomic, ;; :uri "datomic:mem://graph-test", ;; :schema #schema{...}, ;; :options {:install-schema true, :reset-db true}, ;; :connection #conn{1000 #inst "2018-06-26T00:55:42.316-00:00"}}
(purge db)
(purge db opts)
destroys all the data within a graph database
(-> (graph db-config) (graph/insert [{:user {:email "a@a.com"}} {:user {:email "b@b.com"}}]) (graph/purge) (graph/select {:user '_})) => #{}
destroys all the data within a graph database (-> (graph db-config) (graph/insert [{:user {:email "a@a.com"}} {:user {:email "b@b.com"}}]) (graph/purge) (graph/select {:user '_})) => #{}
(retract db selector keys)
(retract db selector keys opts)
retracts a property of an entry in the graph database
(-> (graph db-config) (graph/insert [{:user {:email "a@a.com", :firstname "Allan", :lastname "Adams"}} {:user {:email "b@b.com", :firstname "Billy", :lastname "Bob"}}]) (graph/retract :user [:user/firstname]) (graph/select :user)) => #{{:user {:email "a@a.com", :lastname "Adams"}} {:user {:email "b@b.com", :lastname "Bob"}}}
retracts a property of an entry in the graph database (-> (graph db-config) (graph/insert [{:user {:email "a@a.com", :firstname "Allan", :lastname "Adams"}} {:user {:email "b@b.com", :firstname "Billy", :lastname "Bob"}}]) (graph/retract :user [:user/firstname]) (graph/select :user)) => #{{:user {:email "a@a.com", :lastname "Adams"}} {:user {:email "b@b.com", :lastname "Bob"}}}
(select db selector)
(select db selector opts)
given a query, selects the relevent results
(-> (graph db-config) (graph/insert [{:user {:email "a@a.com"}} {:user {:email "b@b.com"}}]) (graph/select {:user '_})) => #{{:user {:email "a@a.com"}} {:user {:email "b@b.com"}}}
given a query, selects the relevent results (-> (graph db-config) (graph/insert [{:user {:email "a@a.com"}} {:user {:email "b@b.com"}}]) (graph/select {:user '_})) => #{{:user {:email "a@a.com"}} {:user {:email "b@b.com"}}}
(update db selector data)
(update db selector data opts)
updates an entry in the graph database
(-> (graph db-config) (graph/insert [{:user {:email "a@a.com"}} {:user {:email "b@b.com"}}]) (graph/update {:user {:email "a@a.com"}} {:user {:firstname "Allan" :lastname "Adams"}}) (graph/select :user)) #{{:user {:email "a@a.com", :firstname "Allan", :lastname "Adams"}} {:user {:email "b@b.com"}}}
updates an entry in the graph database (-> (graph db-config) (graph/insert [{:user {:email "a@a.com"}} {:user {:email "b@b.com"}}]) (graph/update {:user {:email "a@a.com"}} {:user {:firstname "Allan" :lastname "Adams"}}) (graph/select :user)) #{{:user {:email "a@a.com", :firstname "Allan", :lastname "Adams"}} {:user {:email "b@b.com"}}}
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close