From ab5137881357252af2ce76969d57f52a1a7ba611 Mon Sep 17 00:00:00 2001 From: Win Date: Thu, 2 May 2019 12:00:14 +0000 Subject: [PATCH] Update readme --- README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/README.md b/README.md index e9e01c7..c2bf4ce 100644 --- a/README.md +++ b/README.md @@ -141,6 +141,28 @@ parameter set to `true`: } ``` +## Synchronized map + +A map that will auto save it's values to the database. Useful for values that +mostly get updated, like settings + + ```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"; + ``` + ## Todo - [x] Upsert