From 59b666955c80650e5b7ffa7175674df91103dbdc Mon Sep 17 00:00:00 2001 From: Win Date: Thu, 2 May 2019 12:00:24 +0000 Subject: [PATCH] Update docs --- docs/sync_map.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 docs/sync_map.rst diff --git a/docs/sync_map.rst b/docs/sync_map.rst new file mode 100644 index 0000000..2bb601b --- /dev/null +++ b/docs/sync_map.rst @@ -0,0 +1,23 @@ +Synchronized map +================ + +A map that will auto save it's values to the database. + +.. highlight:: dart + +:: + + import 'package:observable/observable.dart'; + import 'package:sqlcool/sqlcool.dart'; + + // Define the map with initial data + var myMap = SynchronizedMap( + db: db, // an Sqlcool database + table: "a_table", + where: "id=1", + data: ObservableMap.from({"k": "v"}), + verbose: true + ); + + // Changing the map will auto update the data in the database: + myMap.data["k"] = "v2"; \ No newline at end of file