Liking cljdoc? Tell your friends :D

pyramid.core

A library for storing graph data in a Clojure map that automatically normalizes nested data and allows querying via EQL.

Create a new db with db. db values are normal maps with a tabular structure.

Add new ones using add.

Entities are identified by the first key with the name "id", e.g. :person/id. Adding data about the same entity will merge them together in order of addition. To replace an entity, dissoc it first.

Query them w/ EQL using pull.

To get meta-information about what entities were added or queried, use the add-report and pull-report functions.

A library for storing graph data in a Clojure map that automatically
normalizes nested data and allows querying via EQL.

Create a new db with `db`. db values are normal maps with a tabular structure.

Add new ones using `add`.

Entities are identified by the first key with the name "id", e.g.
:person/id. Adding data about the same entity will merge them together in
order of addition. To replace an entity, `dissoc` it first.

Query them w/ EQL using `pull`.

To get meta-information about what entities were added or queried, use the
`add-report` and `pull-report` functions.
raw docstring

addclj/s

(add db data)
(add db data & more)

Takes a normalized map db, and some new data.

Returns a new map with the data normalized and merged into db.

Takes a normalized map `db`, and some new `data`.

Returns a new map with the data normalized and merged into `db`.
sourceraw docstring

add-reportclj/s

(add-report db data)

Takes a normalized map db, and some new data. Returns a map containing keys: :db - the data normalized and merged into db. :entities - a set of entities found in data

Takes a normalized map `db`, and some new `data`.
Returns a map containing keys:
 :db - the data normalized and merged into `db`.
 :entities - a set of entities found in `data`
sourceraw docstring

add-report*clj/s

(add-report* db data)

For normal usage, see pyramid.core/add-report.

Takes a normalized map db and some new data. Returns a 0-arity function (thunk) which, when called, will return either another thunk or a map containing the keys:

  • :db - the data normalized and merged into db
  • :entities - a set of entities found in data

Each thunk should be called to continue the process until the result is returned. See clojure.core/trampoline.

For normal usage, see `pyramid.core/add-report`.

Takes a normalized map `db` and some new `data`.
Returns a 0-arity function (thunk) which, when called, will return either
another thunk or a map containing the keys:
- :db - the data normalized and merged into `db`
- :entities - a set of entities found in `data`

Each thunk should be called to continue the process until the result is
returned. See `clojure.core/trampoline`.
sourceraw docstring

data->astclj/s

(data->ast data)

Like pyramid.core/data->query, but returns the AST.

Like pyramid.core/data->query, but returns the AST.
sourceraw docstring

data->queryclj/s

(data->query data)

Returns an EQL query that matches the shape of data passed to it. Useful when you have some data already and want to see what an EQL query that returns that data would look like.

Returns an EQL query that matches the shape of `data` passed to it.
Useful when you have some data already and want to see what an EQL query that
returns that data would look like.
sourceraw docstring

dbclj/s

(db)
(db entities)
(db entities identify)

Takes an optional collection of entities.

Returns a new map with the entities normalized.

Takes an optional collection of `entities`.

Returns a new map with the `entities` normalized.
sourceraw docstring

default-identclj/s

source

deleteclj/s

(delete db lookup-ref)

Deletes an entity from the db, removing all references to it. A lookup-ref is a vector of [keyword id], e.g. [:person/id "a123"]

Deletes an entity from the db, removing all references to it. A lookup-ref is
a vector of [keyword id], e.g. [:person/id "a123"]
sourceraw docstring

entitiesclj/s

(entities db)

Returns a lazy seq of all entity maps in the DB

Returns a lazy seq of all entity maps in the DB
sourceraw docstring

identifyclj/s

(identify db data)
source

pullclj/s

(pull db query)

Executes an EQL query against a normalized map db and returns the result.

Executes an EQL query against a normalized map `db` and returns the result.
sourceraw docstring

pull-reportclj/s

(pull-report db query)

Executes an EQL query against a normalized map db. Returns a map with the following keys: :data - the result of the query :entities - a set of lookup refs that were visited during the query

Executes an EQL query against a normalized map `db`. Returns a map with the
following keys:
  :data - the result of the query
  :entities - a set of lookup refs that were visited during the query
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close