datascript

Immutable database and Datalog query engine for Clojure, ClojureScript and JS
2018-02-26T02:19:35.000040Z

another question. Hopefully i’ll figure this out shortly.

(ns game.db
  (:require [datascript.core :as d]))

(def schema
  {
   :player/name
   {:db/valueType :db.type/string
    :db/cardinality :db.cardinality/one}})

(def conn (d/create-conn schema))
Throws this error:
1. Caused by clojure.lang.ExceptionInfo
   Bad attribute specification for #:player{:name #:db{:valueType
   :db.type/string}}, expected one of #{:db.type/ref}
   {:error :schema/validation,
    :attribute :player/name,
    :key :db/valueType,
    :value :db.type/string}
which tells me the issue, i just dont get it. why does it expect valueType to have to be a ref? maybe i’m only supposed to specify refs with this setup? I would like to specify the types of everything though in the db…

2018-02-26T02:26:35.000178Z

i’m trying to follow some combination of the datomic and datascript docs. Notable this example: https://github.com/cognitect-labs/day-of-datomic-cloud/blob/master/tutorial/hello_world.clj

2018-02-26T02:32:48.000098Z

possible because im not resetting the db…

2018-02-26T02:39:57.000167Z

https://github.com/tonsky/datascript/wiki/Tips-&-tricks yea. ok so its a bit different then datomic. Thats ok.

devn 2018-02-26T21:25:01.000184Z

howdy. im a datomic/datascript newb. Here's what I'd like to do: - I have a collection of maps that changes over time [{:a 1 :b 2} ...]. - Every five minutes I go out and check if there's a new version of this collection. If there is, I would like to incrementally update my datascript store. I don't care about being able to query old versions, I just want my datascript db to be the current view of that collection. Question: - There are a lot of maps in this collection. For my described use case would you recommend I just swap an atom using a background thread containing something like (d/with-db (d/empty-db) (map #(assoc % :db/id (d/tempid 1)) my-coll-of-maps)?

devn 2018-02-26T22:07:26.000202Z

Do limits work with pull?