Skip to content

Instantly share code, notes, and snippets.

@moea
Last active January 5, 2019 03:17
Show Gist options
  • Save moea/45e06e772d2ba42cb6ea4153589111cc to your computer and use it in GitHub Desktop.
Save moea/45e06e772d2ba42cb6ea4153589111cc to your computer and use it in GitHub Desktop.
;; I would suggest that we use either 'datopia' or 'datopia.db' as the namespace
;; for the schemas, rather than 'db'. For users, I suspect 'db' will seem arbitrary
;; and incongruous (as it does to me, in this context).
#:datopia {:attribute :datopia.ednt/balance
:schema #:db {:cardinality :db.cardinality/one
:valueType :db.type/bigdec}
:invariant <inline query graph as map of keyword -> query,
or maybe just inline query, initially. having
'def' etc. within a tx is super weird to me.
just comments and literals>}
@vizanto
Copy link

vizanto commented Dec 12, 2018

if invariant is a map of kw -> query, we need a convention of what the keyword is for the final query returning true or nil/false.

{:balance-check [:find ...]
 :datopia.db/invariant [:find ?match . :within balance-check :where (= ... )] }

@moea
Copy link
Author

moea commented Dec 12, 2018

You could also determine it w/ a topological sort of the queries.

@vizanto
Copy link

vizanto commented Dec 13, 2018

True...

In my vector of [$key query] pairs example I was thinking of running all inside (future) and have deref do the ordering as required, last query result in the list being the invariant return value.

Thinking more about it, should not be a map of :keyword to query, but symbol or $symbol to match the :within or :in statement in the query.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment