dbWith method

Future<JsRef> dbWith(
  1. JsRef db,
  2. List entities
)

Applies transaction to an immutable db value, returning new immutable db value. Same as (:db-after (with db tx-data)).

var db = d.emptyDb();
var db1 = await d.dbWith(db, [[":db/add", 1, "name", "Ivan"],
                              [":db/add", 1, "age", 17]]);

Implementation

Future<JsRef> dbWith(JsRef db, List entities) async {
  return JsRef.define(context, 'databases',
      """vendor.ds.db_with(${db.toJsCode()}, ${jsonEncode(entities)});""");
}