News for hackers. Stuff that matters.
Re:DataScript: Immutable database and Datalog query engine i... by dwwoelfel on Friday July 03, 2015 @07:12PM (#9828408)
With this one, the database is an immutable value, so you can hold on to old versions of it. Here's an incomplete example of how you could implement optimistic updates:

    tx_report = datascript.transact(db_conn, [{:key "value"}]);
    set_db_to_render_from(tx_report.db_after);
    send_report_to_server(tx_report, function(error) {
      set_db_to_render_from(tx.report.db_before);
    });

There are no comments on this comment yet.