From 2862edcea8b60bba90508ca61ca10e49804bcdf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Wed, 20 Jan 2021 19:42:32 +0100 Subject: [PATCH] Documentation --- .../GRDBCombineDemo/GRDBCombineDemo/AppDatabase.swift | 8 +++++--- Documentation/DemoApps/GRDBCombineDemo/README.md | 6 ++++++ .../DemoApps/GRDBDemoiOS/GRDBDemoiOS/AppDatabase.swift | 8 +++++--- Documentation/DemoApps/GRDBDemoiOS/README.md | 6 ++++++ 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Documentation/DemoApps/GRDBCombineDemo/GRDBCombineDemo/AppDatabase.swift b/Documentation/DemoApps/GRDBCombineDemo/GRDBCombineDemo/AppDatabase.swift index 164271eb2..db91932c1 100644 --- a/Documentation/DemoApps/GRDBCombineDemo/GRDBCombineDemo/AppDatabase.swift +++ b/Documentation/DemoApps/GRDBCombineDemo/GRDBCombineDemo/AppDatabase.swift @@ -6,14 +6,16 @@ import GRDB /// It applies the pratices recommended at /// https://github.com/groue/GRDB.swift/blob/master/Documentation/GoodPracticesForDesigningRecordTypes.md struct AppDatabase { - /// Creates an `AppDatabase` from a database connection, - /// and make sure the database schema is ready. + /// Creates an `AppDatabase`, and make sure the database schema is ready. init(_ dbWriter: DatabaseWriter) throws { self.dbWriter = dbWriter try migrator.migrate(dbWriter) } - /// The database connection + /// Provides access to the database. Application can use a `DatabasePool`, + /// and tests can use a fast in-memory `DatabaseQueue`. + /// + /// See https://github.com/groue/GRDB.swift/blob/master/README.md#database-connections private let dbWriter: DatabaseWriter /// The DatabaseMigrator that defines the database schema. diff --git a/Documentation/DemoApps/GRDBCombineDemo/README.md b/Documentation/DemoApps/GRDBCombineDemo/README.md index 23dd4793f..9ae7beb68 100644 --- a/Documentation/DemoApps/GRDBCombineDemo/README.md +++ b/Documentation/DemoApps/GRDBCombineDemo/README.md @@ -40,3 +40,9 @@ The topics covered in this demo are: - [PlayerForm.swift](GRDBCombineDemo/Views/PlayerForm.swift), [PlayerEditionView.swift](GRDBCombineDemo/Views/PlayerEditionView.swift), [PlayerCreationSheet.swift](GRDBCombineDemo/Views/PlayerCreationSheet.swift) and [PlayerFormViewModel.swift](GRDBCombineDemo/ViewModels/PlayerFormViewModel.swift). `PlayerForm` is the SwiftUI view that displays a Player editing form. It is embedded in `PlayerEditionView` and `PlayerCreationSheet`, two SwiftUI views that edit or create a player. All those views are fed by `PlayerFormViewModel`. + +- [GRDBCombineDemoTests](GRDBCombineDemoTests) + + - Test the database schema + - Test the `Player` record and its requests + - Test the `AppDatabase` methods that let the app access the application. diff --git a/Documentation/DemoApps/GRDBDemoiOS/GRDBDemoiOS/AppDatabase.swift b/Documentation/DemoApps/GRDBDemoiOS/GRDBDemoiOS/AppDatabase.swift index 87917b7b2..0d26bc69f 100644 --- a/Documentation/DemoApps/GRDBDemoiOS/GRDBDemoiOS/AppDatabase.swift +++ b/Documentation/DemoApps/GRDBDemoiOS/GRDBDemoiOS/AppDatabase.swift @@ -5,14 +5,16 @@ import GRDB /// It applies the pratices recommended at /// https://github.com/groue/GRDB.swift/blob/master/Documentation/GoodPracticesForDesigningRecordTypes.md final class AppDatabase { - /// Creates an `AppDatabase` from a database connection, - /// and make sure the database schema is ready. + /// Creates an `AppDatabase`, and make sure the database schema is ready. init(_ dbWriter: DatabaseWriter) throws { self.dbWriter = dbWriter try migrator.migrate(dbWriter) } - /// The database connection + /// Provides access to the database. Application can use a `DatabasePool`, + /// and tests can use a fast in-memory `DatabaseQueue`. + /// + /// See https://github.com/groue/GRDB.swift/blob/master/README.md#database-connections private let dbWriter: DatabaseWriter /// The DatabaseMigrator that defines the database schema. diff --git a/Documentation/DemoApps/GRDBDemoiOS/README.md b/Documentation/DemoApps/GRDBDemoiOS/README.md index 49778dac6..d32f8ba74 100644 --- a/Documentation/DemoApps/GRDBDemoiOS/README.md +++ b/Documentation/DemoApps/GRDBDemoiOS/README.md @@ -35,3 +35,9 @@ The topics covered in this demo are: - [PlayerEditionViewController.swift](GRDBDemoiOS/ViewControllers/PlayerEditionViewController.swift) `PlayerEditionViewController` can create or edit a player, and save it in the database. + +- [GRDBDemoiOSTests](GRDBDemoiOSTests) + + - Test the database schema + - Test the `Player` record and its requests + - Test the `AppDatabase` methods that let the app access the application.