How to use the datascript.create_conn function in datascript

To help you get started, we’ve selected a few datascript examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gurdasnijor / react-datascript / examples / follower-graph / createDBConn.js View on Github external
*/
  const twitterUserSchema = {
    name: {
      ':db/cardinality': ':db.cardinality/one',
      ':db/unique': ':db.unique/identity'
    },
    follows: {
      ':db/cardinality': ':db.cardinality/many',
      ':db/valueType': ':db.type/ref'
    }
  };

  /**
   * Create connection to db (that's been instantiated with the schema above.)
   */
  const conn = datascript.create_conn(twitterUserSchema);

  /**
   * Define some seed data; including some `follower` references (that make
   * use of a temporary id to point to other entities within the array.)
   */
  const datoms = [
    {
      ':db/id': -1,
      name: 'John',
      follows: -3
    },
    {
      ':db/id': -2,
      name: 'David',
      follows: [-3, -1]
    },

datascript

Immutable in-memory triplestore with Datalog queries

EPL-1.0
Latest version published 2 days ago

Package Health Score

76 / 100
Full package analysis