Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial js API #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions src/posh/js.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
(ns datascript.js
(:refer-clojure)
(:require
[core :as p])

;; Public API

;; posh(conn)
;; transact(conn, tx)
;; q(conn, query, args)
;; db_tx(conn, tx)
;; pull_tx(conn, txPatterns, pullPattern, entityId)
;; q_tx(conn, patterns, query, args)
;; after_tx(conn, patterns, handlerFn]

(defn ^:export posh [conn]
(p/posh! conn))

(defn ^:export transact [conn tx]
(p/transact! conn tx))

(defn ^:export db_tx [conn patterns]
(p/db-tx conn patterns))

(defn ^:export pull_tx [conn tx-patterns pull-pattern entity-id]
(p/pull-tx conn tx-patterns pull-pattern entity-id))

(defn ^:export q_tx [conn patterns query & args]
(p/q-tx conn patterns query args))

(defn ^:export q [conn query & args]
(p/q conn query args))

(defn ^:export after_tx [conn patterns handler-fn]
(p/after-tx! conn patterns handler-fn))