From 5e0ff04f4f76be144c7c7aee0f41f3e8b0ebd6bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Wed, 7 Oct 2015 09:46:02 +0200 Subject: [PATCH] README.md --- README.md | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 9c6998bc3..4083053e6 100644 --- a/README.md +++ b/README.md @@ -1164,24 +1164,15 @@ Yet, it does a few things well: (person.name, person.citizenshipsCount) ``` -- **It provides the classic CRUD operations.** +- **It provides the classic CRUD operations.** GRDB supports all primary keys (auto-incremented RowIDs, single column, multiple columns). ```swift - // RowID primary key - let person = Person(name: "Arthur") - // String primary key - let country = Country(isoCode: "FR", name: "France") - // Multiple columns primary key - let citizenship = Citizenship(personId: person.id, countryIsoCode: country.isoCode) - - try person.insert(db) // Automatically fills person.id - person.name = "Barbara" + let person = Person(...) + try person.insert(db) // Automatically fills person.id if primary key is an auto-incremented RowID. try person.update(db) - - try country.save(db) // inserts or update - - try citizenship.delete(db) - citizenship.exists(db) // false + try person.save(db) // Inserts or updates + try person.delete(db) + try person.reload(db) ``` - **It tracks changes. Real changes**: setting a column to the same value does not constitute a change.