diff --git a/docs/pubspec.yaml b/docs/pubspec.yaml index e24140b8..acb71570 100644 --- a/docs/pubspec.yaml +++ b/docs/pubspec.yaml @@ -44,8 +44,6 @@ dev_dependencies: dependency_overrides: - moor_generator: - path: ../moor_generator drift: path: ../drift drift_dev: diff --git a/docs/tool/write_versions.dart b/docs/tool/write_versions.dart index c04e7125..36e3dd74 100644 --- a/docs/tool/write_versions.dart +++ b/docs/tool/write_versions.dart @@ -12,8 +12,6 @@ class _VersionsBuilder extends Builder { @override Future build(BuildStep buildStep) async { const packages = [ - 'moor', - 'moor_generator', 'sqlparser', 'path', 'build_runner', diff --git a/drift_dev/lib/integrations/build.dart b/drift_dev/lib/integrations/build.dart index a33aa6cc..a2062ebf 100644 --- a/drift_dev/lib/integrations/build.dart +++ b/drift_dev/lib/integrations/build.dart @@ -2,14 +2,12 @@ import 'package:build/build.dart'; import 'package:drift_dev/src/backends/build/drift_builder.dart'; import 'package:drift_dev/src/backends/build/preprocess_builder.dart'; -Builder driftBuilder(BuilderOptions options) => - DriftSharedPartBuilder(options, isForNewDriftPackage: true); +Builder driftBuilder(BuilderOptions options) => DriftSharedPartBuilder(options); Builder driftBuilderNotShared(BuilderOptions options) => - DriftPartBuilder(options, isForNewDriftPackage: true); + DriftPartBuilder(options); -Builder preparingBuilder(BuilderOptions options) => - PreprocessBuilder(isForNewDriftPackage: true); +Builder preparingBuilder(BuilderOptions options) => PreprocessBuilder(); PostProcessBuilder driftCleanup(BuilderOptions options) { return const FileDeletingBuilder(['.temp.dart']); diff --git a/drift_dev/lib/src/backends/build/drift_builder.dart b/drift_dev/lib/src/backends/build/drift_builder.dart index dbcdbd71..528f1a32 100644 --- a/drift_dev/lib/src/backends/build/drift_builder.dart +++ b/drift_dev/lib/src/backends/build/drift_builder.dart @@ -18,15 +18,9 @@ final _flags = Resource(() => _BuilderFlags()); mixin DriftBuilder on Builder { DriftOptions get options; - bool get isForNewDriftPackage; Writer createWriter() { - return Writer( - options, - generationOptions: GenerationOptions( - writeForMoorPackage: !isForNewDriftPackage, - ), - ); + return Writer(options); } Future analyzeDartFile(BuildStep step) async { @@ -72,18 +66,13 @@ class DriftSharedPartBuilder extends SharedPartBuilder with DriftBuilder { @override final DriftOptions options; - @override - final bool isForNewDriftPackage; - - DriftSharedPartBuilder._(List generators, String name, - this.options, this.isForNewDriftPackage) + DriftSharedPartBuilder._( + List generators, String name, this.options) : super(generators, name); - factory DriftSharedPartBuilder(BuilderOptions options, - {bool isForNewDriftPackage = false}) { + factory DriftSharedPartBuilder(BuilderOptions options) { return _createBuilder(options, (generators, parsedOptions) { - return DriftSharedPartBuilder._( - generators, 'moor', parsedOptions, isForNewDriftPackage); + return DriftSharedPartBuilder._(generators, 'drift', parsedOptions); }); } @@ -93,7 +82,7 @@ class DriftSharedPartBuilder extends SharedPartBuilder with DriftBuilder { if (!flags.didWarnAboutDeprecatedOptions && options.enabledDeprecatedOption) { print('You have the eagerly_load_dart_ast option enabled. The option is ' - 'no longer necessary and will be removed in a future moor version. ' + 'no longer necessary and will be removed in a future drift version. ' 'Consider removing the option from your build.yaml.'); flags.didWarnAboutDeprecatedOptions = true; } @@ -106,21 +95,12 @@ class DriftPartBuilder extends PartBuilder with DriftBuilder { @override final DriftOptions options; - @override - final bool isForNewDriftPackage; - - DriftPartBuilder._(List generators, String extension, this.options, - this.isForNewDriftPackage) + DriftPartBuilder._(List generators, String extension, this.options) : super(generators, extension); - factory DriftPartBuilder(BuilderOptions options, - {bool isForNewDriftPackage = false}) { + factory DriftPartBuilder(BuilderOptions options) { return _createBuilder(options, (generators, parsedOptions) { - return DriftPartBuilder._( - generators, - isForNewDriftPackage ? '.drift.dart' : '.moor.dart', - parsedOptions, - isForNewDriftPackage); + return DriftPartBuilder._(generators, '.drift.dart', parsedOptions); }); } } diff --git a/drift_dev/lib/src/backends/build/preprocess_builder.dart b/drift_dev/lib/src/backends/build/preprocess_builder.dart index 34c537bc..ef6ec3d3 100644 --- a/drift_dev/lib/src/backends/build/preprocess_builder.dart +++ b/drift_dev/lib/src/backends/build/preprocess_builder.dart @@ -26,14 +26,12 @@ import 'package:sqlparser/sqlparser.dart'; class PreprocessBuilder extends Builder { static const _outputs = ['.temp.dart', '.dart_in_drift']; - final bool isForNewDriftPackage; - - PreprocessBuilder({this.isForNewDriftPackage = false}); + PreprocessBuilder(); @override late final Map> buildExtensions = { '.moor': _outputs, - if (isForNewDriftPackage) '.drift': _outputs + '.drift': _outputs }; @override diff --git a/drift_dev/lib/src/cli/commands/schema/generate_utils.dart b/drift_dev/lib/src/cli/commands/schema/generate_utils.dart index 25297b8d..167d80c7 100644 --- a/drift_dev/lib/src/cli/commands/schema/generate_utils.dart +++ b/drift_dev/lib/src/cli/commands/schema/generate_utils.dart @@ -42,8 +42,6 @@ class GenerateUtilsCommand extends Command { @override Future run() async { - final isForMoor = argResults!.arguments.contains('moor_generator'); - final rest = argResults!.rest; if (rest.length != 2) { usageException('Expected input and output directories'); @@ -71,11 +69,10 @@ class GenerateUtilsCommand extends Command { entities, argResults?['data-classes'] as bool, argResults?['companions'] as bool, - isForMoor, ); } - await _writeLibraryFile(outputDir, schema.keys, isForMoor); + await _writeLibraryFile(outputDir, schema.keys); print( 'Wrote ${schema.length + 1} files into ${p.relative(outputDir.path)}'); } @@ -106,7 +103,6 @@ class GenerateUtilsCommand extends Command { _ExportedSchema schema, bool dataClasses, bool companions, - bool isForMoor, ) { // let serialized options take precedence, otherwise use current options // from project. @@ -121,20 +117,14 @@ class GenerateUtilsCommand extends Command { forSchema: version, writeCompanions: companions, writeDataClasses: dataClasses, - writeForMoorPackage: isForMoor, ), ); final file = File(p.join(output.path, _filenameForVersion(version))); - final leaf = writer.leaf() + writer.leaf() ..writeln(_prefix) - ..writeln('//@dart=2.12'); - - if (isForMoor) { - leaf.writeln("import 'package:moor/moor.dart';"); - } else { - leaf.writeln("import 'package:drift/drift.dart';"); - } + ..writeln('//@dart=2.12') + ..writeln("import 'package:drift/drift.dart';"); final db = Database( declaredQueries: const [], @@ -146,21 +136,12 @@ class GenerateUtilsCommand extends Command { return file.writeAsString(_dartfmt.format(writer.writeGenerated())); } - Future _writeLibraryFile( - Directory output, Iterable versions, bool useMoorImports) { + Future _writeLibraryFile(Directory output, Iterable versions) { final buffer = StringBuffer() ..writeln(_prefix) - ..writeln('//@dart=2.12'); - - if (useMoorImports) { - buffer - ..writeln("import 'package:moor/moor.dart';") - ..writeln("import 'package:moor_generator/api/migrations.dart';"); - } else { - buffer - ..writeln("import 'package:drift/drift.dart';") - ..writeln("import 'package:drift_dev/api/migrations.dart';"); - } + ..writeln('//@dart=2.12') + ..writeln("import 'package:drift/drift.dart';") + ..writeln("import 'package:drift_dev/api/migrations.dart';"); for (final version in versions) { buffer.writeln("import '${_filenameForVersion(version)}' as v$version;"); diff --git a/drift_dev/lib/src/writer/tables/data_class_writer.dart b/drift_dev/lib/src/writer/tables/data_class_writer.dart index a9fc1978..82e3ab13 100644 --- a/drift_dev/lib/src/writer/tables/data_class_writer.dart +++ b/drift_dev/lib/src/writer/tables/data_class_writer.dart @@ -18,10 +18,6 @@ class DataClassWriter { String get serializerType => 'ValueSerializer?'; - String get _runtimeOptions => scope.generationOptions.writeForMoorPackage - ? 'moorRuntimeOptions' - : 'driftRuntimeOptions'; - void write() { final parentClass = table.customParentClass ?? 'DataClass'; _buffer.write('class ${table.dartTypeCode()} extends $parentClass '); @@ -104,7 +100,7 @@ class DataClassWriter { ..write('factory $dataClassName.fromJson(' 'Map json, {$serializerType serializer}' ') {\n') - ..write('serializer ??= $_runtimeOptions.defaultSerializer;\n') + ..write('serializer ??= driftRuntimeOptions.defaultSerializer;\n') ..write('return $dataClassName('); for (final column in columns) { @@ -143,7 +139,7 @@ class DataClassWriter { void _writeToJson() { _buffer.write('@override Map toJson(' '{$serializerType serializer}) {\n' - 'serializer ??= $_runtimeOptions.defaultSerializer;\n' + 'serializer ??= driftRuntimeOptions.defaultSerializer;\n' 'return {\n'); for (final column in columns) { diff --git a/drift_dev/lib/src/writer/writer.dart b/drift_dev/lib/src/writer/writer.dart index 6d2321dd..78053d8e 100644 --- a/drift_dev/lib/src/writer/writer.dart +++ b/drift_dev/lib/src/writer/writer.dart @@ -114,15 +114,10 @@ class GenerationOptions { /// Whether companions should be generated. final bool writeCompanions; - /// Whether we're generating code for the old moor package instead of the - /// new `drift` package. - final bool writeForMoorPackage; - const GenerationOptions({ this.forSchema, this.writeDataClasses = true, this.writeCompanions = true, - this.writeForMoorPackage = false, }); /// Whether, instead of generating the full database code, we're only diff --git a/drift_dev/pubspec.yaml b/drift_dev/pubspec.yaml index e5309b96..53ca374f 100644 --- a/drift_dev/pubspec.yaml +++ b/drift_dev/pubspec.yaml @@ -51,8 +51,6 @@ dev_dependencies: build_runner: ^2.0.0 build_test: ^2.0.0 json_serializable: ^6.2.0 - # Used to test the migration from moor to drift - moor: any executables: drift_dev: diff --git a/drift_dev/pubspec_overrides.yaml b/drift_dev/pubspec_overrides.yaml index 12cdfd77..ba6a3b11 100644 --- a/drift_dev/pubspec_overrides.yaml +++ b/drift_dev/pubspec_overrides.yaml @@ -1,7 +1,5 @@ dependency_overrides: drift: path: ../drift - moor: - path: ../moor sqlparser: path: ../sqlparser diff --git a/drift_dev/test/cli/migrate_test.dart b/drift_dev/test/cli/migrate_test.dart index a770394b..e522deec 100644 --- a/drift_dev/test/cli/migrate_test.dart +++ b/drift_dev/test/cli/migrate_test.dart @@ -34,15 +34,16 @@ Future _setup(Iterable lib, final driftDevUrl = config.packages.singleWhere((e) => e.name == 'drift_dev').root; - final moorFlutterUrl = driftDevUrl.resolve('../moor_flutter/'); + final moorUrl = driftDevUrl.resolve('../extras/assets/old_moor_package/'); + final moorFlutterUrl = + driftDevUrl.resolve('../extras/assets/old_moor_flutter_package/'); final appUri = '${File(p.join(d.sandbox, 'app')).absolute.uri}/'; final newConfig = PackageConfig([ ...config.packages, Package('app', Uri.parse(appUri), packageUriRoot: Uri.parse('${appUri}lib/')), - // Need to fake moor_flutter because drift_dev can't depend on Flutter - // packages + Package('moor', moorUrl, packageUriRoot: Uri.parse('${moorUrl}lib/')), Package('moor_flutter', moorFlutterUrl, packageUriRoot: Uri.parse('${moorFlutterUrl}lib/')), ]); diff --git a/drift_dev/test/writer/data_class_writer_test.dart b/drift_dev/test/writer/data_class_writer_test.dart index 5f33f87e..1c48cfa8 100644 --- a/drift_dev/test/writer/data_class_writer_test.dart +++ b/drift_dev/test/writer/data_class_writer_test.dart @@ -14,7 +14,7 @@ void main() { 'generates const constructor for data classes can companion classes', () async { await testBuilder( - DriftPartBuilder(const BuilderOptions({}), isForNewDriftPackage: true), + DriftPartBuilder(const BuilderOptions({})), const { 'a|lib/main.dart': r''' import 'package:drift/drift.dart'; @@ -47,7 +47,7 @@ class Database extends _$Database {} 'generates async mapping code for existing row class with async factory', () async { await testBuilder( - DriftPartBuilder(const BuilderOptions({}), isForNewDriftPackage: true), + DriftPartBuilder(const BuilderOptions({})), const { 'a|lib/main.dart': r''' import 'package:drift/drift.dart'; diff --git a/drift_dev/test/writer/mutable_classes_integration_test.dart b/drift_dev/test/writer/mutable_classes_integration_test.dart index 79ce91ad..212240b6 100644 --- a/drift_dev/test/writer/mutable_classes_integration_test.dart +++ b/drift_dev/test/writer/mutable_classes_integration_test.dart @@ -11,7 +11,7 @@ import 'package:test/test.dart'; const _testInput = r''' import 'package:drift/drift.dart'; -part 'main.moor.dart'; +part 'main.drift.dart'; class Users extends Table { IntColumn get id => integer().autoIncrement()(); @@ -34,7 +34,7 @@ void main() { const {'a|lib/main.dart': _testInput}, reader: await PackageAssetReader.currentIsolate(), outputs: const { - 'a|lib/main.moor.dart': _GeneratesWithoutFinalFields( + 'a|lib/main.drift.dart': _GeneratesWithoutFinalFields( {'User', 'UsersCompanion', 'SomeQueryResult'}, ), }, diff --git a/moor_flutter/.gitignore b/extras/assets/old_moor_flutter_package/.gitignore similarity index 100% rename from moor_flutter/.gitignore rename to extras/assets/old_moor_flutter_package/.gitignore diff --git a/extras/assets/old_moor_flutter_package/README.md b/extras/assets/old_moor_flutter_package/README.md new file mode 100644 index 00000000..580f354c --- /dev/null +++ b/extras/assets/old_moor_flutter_package/README.md @@ -0,0 +1,5 @@ +This is a scaffold of the old `moor_flutter` package, roughly resembling the latest +(and discontinued) version of `moor_flutter` on pub.dev. + +This package is contained in this repository so that the migration from `moor` +to `drift`, which is implemented in `drift_dev`, can still be tested. diff --git a/moor_flutter/lib/moor_flutter.dart b/extras/assets/old_moor_flutter_package/lib/moor_flutter.dart similarity index 100% rename from moor_flutter/lib/moor_flutter.dart rename to extras/assets/old_moor_flutter_package/lib/moor_flutter.dart diff --git a/extras/assets/old_moor_flutter_package/pubspec.yaml b/extras/assets/old_moor_flutter_package/pubspec.yaml new file mode 100644 index 00000000..56d8a0d9 --- /dev/null +++ b/extras/assets/old_moor_flutter_package/pubspec.yaml @@ -0,0 +1,20 @@ +name: moor_flutter +description: Flutter implementation of moor, a safe and reactive persistence library for Dart applications +version: 4.1.0 +repository: https://github.com/simolus3/drift +homepage: https://drift.simonbinder.eu/ +issue_tracker: https://github.com/simolus3/drift/issues + +environment: + sdk: '>=2.12.0 <3.0.0' + +dependencies: + moor: ^4.0.0 + sqflite: ^2.0.0+3 + path: ^1.8.0 + flutter: + sdk: flutter + +dev_dependencies: + flutter_test: + sdk: flutter diff --git a/moor/.gitignore b/extras/assets/old_moor_package/.gitignore similarity index 100% rename from moor/.gitignore rename to extras/assets/old_moor_package/.gitignore diff --git a/extras/assets/old_moor_package/README.md b/extras/assets/old_moor_package/README.md new file mode 100644 index 00000000..20042914 --- /dev/null +++ b/extras/assets/old_moor_package/README.md @@ -0,0 +1,5 @@ +This is a scaffold of the old `moor` package, roughly resembling the latest +(and discontinued) version of `moor` on pub.dev. + +This package is contained in this repository so that the migration from `moor` +to `drift`, which is implemented in `drift_dev`, can still be tested. diff --git a/moor/lib/backends.dart b/extras/assets/old_moor_package/lib/backends.dart similarity index 100% rename from moor/lib/backends.dart rename to extras/assets/old_moor_package/lib/backends.dart diff --git a/moor/lib/extensions/json1.dart b/extras/assets/old_moor_package/lib/extensions/json1.dart similarity index 100% rename from moor/lib/extensions/json1.dart rename to extras/assets/old_moor_package/lib/extensions/json1.dart diff --git a/moor/lib/extensions/moor_ffi.dart b/extras/assets/old_moor_package/lib/extensions/moor_ffi.dart similarity index 100% rename from moor/lib/extensions/moor_ffi.dart rename to extras/assets/old_moor_package/lib/extensions/moor_ffi.dart diff --git a/moor/lib/ffi.dart b/extras/assets/old_moor_package/lib/ffi.dart similarity index 100% rename from moor/lib/ffi.dart rename to extras/assets/old_moor_package/lib/ffi.dart diff --git a/moor/lib/isolate.dart b/extras/assets/old_moor_package/lib/isolate.dart similarity index 100% rename from moor/lib/isolate.dart rename to extras/assets/old_moor_package/lib/isolate.dart diff --git a/moor/lib/moor.dart b/extras/assets/old_moor_package/lib/moor.dart similarity index 100% rename from moor/lib/moor.dart rename to extras/assets/old_moor_package/lib/moor.dart diff --git a/moor/lib/moor_web.dart b/extras/assets/old_moor_package/lib/moor_web.dart similarity index 100% rename from moor/lib/moor_web.dart rename to extras/assets/old_moor_package/lib/moor_web.dart diff --git a/moor/lib/remote.dart b/extras/assets/old_moor_package/lib/remote.dart similarity index 100% rename from moor/lib/remote.dart rename to extras/assets/old_moor_package/lib/remote.dart diff --git a/moor/lib/sqlite_keywords.dart b/extras/assets/old_moor_package/lib/sqlite_keywords.dart similarity index 100% rename from moor/lib/sqlite_keywords.dart rename to extras/assets/old_moor_package/lib/sqlite_keywords.dart diff --git a/moor/lib/src/deprecated.dart b/extras/assets/old_moor_package/lib/src/deprecated.dart similarity index 100% rename from moor/lib/src/deprecated.dart rename to extras/assets/old_moor_package/lib/src/deprecated.dart diff --git a/moor/pubspec.yaml b/extras/assets/old_moor_package/pubspec.yaml similarity index 52% rename from moor/pubspec.yaml rename to extras/assets/old_moor_package/pubspec.yaml index 0b81ca89..eb3e8844 100644 --- a/moor/pubspec.yaml +++ b/extras/assets/old_moor_package/pubspec.yaml @@ -16,24 +16,3 @@ dependencies: meta: ^1.3.0 stream_channel: ^2.1.0 sqlite3: ^1.0.0 - -dev_dependencies: - build_test: ^2.0.0 - build_runner_core: ^7.0.0 - moor_generator: any - uuid: ^3.0.0 - path: ^1.8.0 - build_runner: ^2.0.0 - test: ^1.17.0 - mockito: ^5.0.7 - rxdart: ^0.27.0 - -dependency_overrides: - drift: - path: ../drift - drift_dev: - path: ../drift_dev - moor_generator: - path: ../moor_generator - sqlparser: - path: ../sqlparser diff --git a/moor/CHANGELOG.md b/moor/CHANGELOG.md deleted file mode 100644 index 2c0d2121..00000000 --- a/moor/CHANGELOG.md +++ /dev/null @@ -1,556 +0,0 @@ -## 4.6.1 - -- Fix the moor analyzer plugin not starting - -Version 4.6.1+1 adds information about the name change to the README. - -## 4.6.0 - -- Add `DoUpdate.withExcluded` to refer to the excluded row in an upsert clause. -- Add optional `where` clause to `DoUpdate` constructors - -### Important notice - -Moor has been renamed to `drift`. This package will continue to be supported until the next major release (5.0.0), -no immediate action is needed. - -At the next breaking release, moor will be discontinued in favor of the `drift` package. -Please consider migrating to `drift` at a suitable opportunity. -Automated migration tooling exists! See https://drift.simonbinder.eu/name for details. - -## 4.5.0 - -- Add `moorRuntimeOptions.debugPrint` option to control which `print` method is used by moor. -- Add a `rowId` extension on generated tables. -- Add `NullAwareTypeConverter` to simplify type converters that always map `null` from and to `null`. -- Kill backing isolates after calling `MoorIsolate.shutdownAll`. - -## 4.4.1 - -- Include latest generator in analyzer plugin - -## 4.4.0 - -- Add `Value.ofNullable` constructor to easily wrap nullable values. -- Support selecting views declared in a moor file in Dart (with `select`, - `join` and similar methods) -- Add the `scoped_dart_components` builder option to generate a function for - [Dart components in SQL](https://drift.simonbinder.eu/docs/using-sql/moor_files/#dart-components-in-sql). - The function's parameters reflect tables that are in scope. -- Add the `UpsertMultiple` class to run multiple upsert clauses in an insert. - This requires sqlite3 version 3.35 or later. -- Add the `closeUnderlyingOnClose` argument to `VmDatabase.opened` as an option - to keep the underlying instance opened when closing the `VmDatabase`. -- The `tableUpdates` stream now emits the relevant updates instead of `null`. -- Reflect type converters in generated columns. The `equalsValue` method can be used - as an equals with a value mapped by a type converter. -- Improve nullability analysis for SQL queries. -- __Note__: You have to re-generate sources with `moor_generator` version 4.4.0 after - upgrading to this version. Apologies for the inconvenience. - -## 4.3.2 - -- Fix `insertReturning` not updating streams -- Fix streams emitting stale data if a new subscriber attaches immediately - after an update. - -## 4.3.1 - -- Fix encoding table updates without a kind over isolates -- Fix deserializing some nullable types in the default value serializer - -## 4.3.0 - -- Support custom, existing classes for rows! See the `@UseRowClass` annotation - for details. -- Add `CASE WHEN` expressions with the `caseMatch` method on `Expression` -- Add `insertReturning` which returns the generated row after an insert -- Add `min`, `max` and `avg` functions for `DateTime` expressions -- On supported platforms, cancel pending stream selects when the stream is disposed - - `moor_flutter` is supported - - `moor/ffi` is supported when used on a background isolate - -## 4.2.1 - -- Deprecate `readBool`, `readString`, `readInt`, `readDouble`, `readDateTime` - and `readBlob` in `QueryRow`. - Use `read` directly (which supports nullable types). - -## 4.2.0 - -- Fixed subqueries not affecting stream updates -- Throw a `CouldNotRollBackException` when rolling back a transaction throws - -## 4.1.0 - -- Reverted the `SelectableUtils` extension, its members have been added back to the - `Selectable` class. -- Add `trim()`, `trimLeft()` and `trimRight()` extensions for text expressions -- Initial support for sub-queries in the Dart api: - - `Expression.isInQuery` and `isNotInQuery` for `IS IN (SELECT ...)` matching - - `subqueryExpression` to use single-column, single-row selects as values - - `existsQuery` and `notExistsQuery` for `EXISTS` expressions -- New `package:moor/remote.dart` library to access databases over any `StreamChannel`. The isolate library has been - rewritten on top of that api. - -## 4.0.0-nullsafety.1 - -- __Breaking__: `getSingle()` and `watchSingle()` are now non-nullable and throw for empty results. - Use `getSingleOrNull()` and `watchSingleOrNull()` for the old behavior. -- __Breaking__: Removed `QueryEngine`, its methods have been moved to `DatabaseConnectionUser` -- __Breaking__: Changed the `args` parameter in `QueryExecutor` methods to `List` -- __Breaking__: Removed the second type parameter from `TypedResult.read` -- __Breaking__: `TypedResult.read` and `TypedResult.readTable` now throw if the row does not contain the requested table - or expression (they used to return `null`). -- __Breaking__: `MoorWebStorage.indexedDbIfSupported` now returns a future -- __Breaking__: `getSingle` and `watchSingle` (and their `orNull()` variants) are now an extension on `Selectable`. - Import `package:moor/moor.dart` to files using those methods. -- Support null safety -- Changed the sql representation of text types from `VARCHAR` to `TEXT` -- Added extensions for `isNull` and `isNotNull` -- Support creating a `VmDatabase` from a raw sqlite3 `Database` via `VmDatabase.opened` -- New `named_parameters` build option to generate named parameters for named variables in moor files -- Added `Migrator.renameTable` to rename tables - -## 3.4.0 - -- New `TableMigration` api to make complex table migrations easier. See the - [updated documentation](https://drift.simonbinder.eu/docs/advanced-features/migrations/#complex-migrations) for details - on how to use this feature. -- New `DatabaseConnection.delayed` constructor to synchronously obtain a database connection that requires an async - setup. This can be useful when connecting to a `MoorIsolate`. -- `VmDatabase`: Create directory of database file to avoid misuse errors from sqlite3. -- New feature in moor files: You can now set the default value for Dart templates: - `filter ($predicate = TRUE): SELECT * FROM my_table WHERE $predicate`. This generates an optional named parameter in - Dart. -- New `generate_values_in_copy_with` [build option](https://drift.simonbinder.eu/docs/advanced-features/builder_options/) - . It wraps nullable columns in a `Value` in `copyWith` methods so that they can be set to `null`. -- Added `groupConcat`, `cast` and `coalesce` functions to the Dart query builder. -- Added `renameColumn` to `Migrator` to generate `ALTER TABLE RENAME COLUMN` statements. -- Added `VmDatabase.closeExistingInstances()` to close zombie database connections after hot restarts on some OSes. - -## 3.3.1 - -- Support changing `onData` handlers for query streams. This fixes a bug occurring when using `queryStream.first` - multiple times. - -## 3.3.0 - -- New `package:moor/ffi.dart` library to replace the `moor_ffi` package. When migrating, Flutter users need to depend on - the `sqlite3_flutter_libs` package as well. The changelog of `moor_ffi` contains further information about this -- New (in - generator): `apply_converters_on_variables` [build option](https://drift.simonbinder.eu/docs/advanced-features/builder_options/) - . When enabled, type converter will be enabled on variables for analyzed queries. This will be the default option in - the future. - -## 3.2.0 - -- It's now possible to change the name of a class generated for moor-file queries. See - [the documentation](https://drift.simonbinder.eu/docs/using-sql/moor_files/#result-class-names) for details. -- Added the `multiLine`, `caseSensitive`, `unicode` and `doAll` flags to the `regex` sql extension method. They - require `moor_ffi` version `0.7.0` or later. - -## 3.1.0 - -- Update companions now implement `==` and `hashCode` -- New `containsCase` method for text in `package:moor/extensions/moor_ffi.dart` -- The `toCompanion` method is back for data classes, but its generation can be disabled with a build option -- New - feature: [Implicit enum converters](https://drift.simonbinder.eu/docs/advanced-features/type_converters/#implicit-enum-converters) -- Added the `destructiveFallback` extension to databases. It can be used in `migrationStrategy` to delete and then - re-create all tables, indices and triggers. - -## 3.0.2 - -- Fix update statements not escaping column names ([#539](https://github.com/simolus3/drift/issues/539)) - -## 3.0.1 - -- Fix `mapFromRowOrNull` not working without a prefix ([#534](https://github.com/simolus3/drift/pull/534)) - -## 3.0.0 - -- __Breaking__: `package:moor/moor_web.dart` no longer exports `package:moor/moor.dart`. If you've relied on this, - you'll now need to import `package:moor/moor.dart` as well. -- __Breaking__: Remove deprecated members: - - top-level `and`, `or` and `not` methods. Use `&`, `|` and `.not()` instead. - - top-level `year`, `month`, `day`, `hour`, `minute`, `second` methods. Use the extension member - on `Expression` instead. - - `InsertStatement.insertAll` (use batches instead) - - the `orReplace` boolean parameter on inserts (use `mode: InsertMode.orReplace` instead) - - remove the top-level `isIn` and `isNotIn` functions - (use the `.isIn` and `.isNotIn` instance methods instead) - - `CustomSelectStatement.execute` and `constructFetcher` - use `get()` or `watch()`, respectively -- __Breaking__: Remove the second type variable on `Expression` and subclasses. -- __Breaking__: Remove `customSelectStream` from `QueryEngine`. The `customSelect` - method now returns an `Selectable` (like `customSelectQuery`, which in turn has been deprecated). -- __Breaking__: Columns that are aliases to sqlite's `rowid` column are no longer considered required for inserts -- __Breaking__: Changes the way data classes and companions are inserted: - - Removed `Insertable.toCompanion` - - Added `Insertable.toColumns` to obtain a map from column names to values that should be inserted - - Removed `TableInfo.entityToSql` - use `Insertable.toColumns` instead -- __Breaking__: Renamed the `db` field in daos to `attachedDatabase`. The old field is available through an extension. -- __Breaking__: The `compact_query_methods` and `use_column_name_as_json_key_when_defined_in_moor_file` build options - are now enabled by default. This means that queries in moor files now generate a `Selectable` method by default ( - instead of two methods for `get` and `watch`). Columns defined in moor files will have their sql name as json key ( - moor used to transform their name to `camelCase`). You can still disable both options to keep the old behavior. -- __Breaking__: The last statement in a moor file must now end with a semicolon as well -- Batches now run statements in the order they were issued. This required a breaking change for engine implementers. -- Experimentally support IndexedDB to store sqlite data on the web -- Moor will no longer wait for query stream listeners to receive a done event when closing a database or transaction. -- Updated stream queries: They now take triggers into account and more accurately detect when an update is necessary. -- New `tableUpdates` method that can be used to listen for a subset of table updates outside of a query. -- New feature: Nested results for compiled queries ([#288](https://github.com/simolus3/drift/issues/288)) - See the [documentation](https://drift.simonbinder.eu/docs/using-sql/moor_files/#nested-results) for details on how and - when to use this feature. -- New feature: Use sql expressions for inserts or updates with the new `custom` factory on companions -- New feature: Upserts in the Dart api! Read everything you need to know - [here](https://drift.simonbinder.eu/docs/getting-started/writing_queries/#upserts). -- Support using `MoorIsolates` in scenarios where only primitive messages can be passed between isolates. - -## 2.4.2 - -- Fix `beforeOpen` callback deadlocking when using the isolate executor - ([#431](https://github.com/simolus3/drift/issues/431)) -- Fix limit clause not being applied when using `.join` afterwards - ([#433](https://github.com/simolus3/drift/issues/433)) - -## 2.4.1 - -- Don't generate double quoted string literals in date time functions - -## 2.4.0 - -- Support aggregate expressions and `group by` in the Dart api -- Support type converters in moor files! - The [documentation](https://drift.simonbinder.eu/docs/advanced-features/type_converters/) - has been updated to explain how to use them. -- Support stream queries in transactions ([#356](https://github.com/simolus3/drift/issues/365)) -- Support table-valued functions (like `json_each` and `json_tree`) in moor files - [#260](https://github.com/simolus3/drift/issues/260). -- Fix a crash when opening a transaction without using it ([#361](https://github.com/simolus3/drift/issues/361)) -- New `mapFromCompanion` method in generated tables to convert a `UpdateCompanion` to a model. -- Support generated moor classes in other builders (like `built_value`). - Details [in the docs](https://drift.simonbinder.eu/docs/advanced-features/builder_options/) - -## 2.3.0 - -- New `clientDefault` method for columns. It can be used for dynamic defaults that might be different for each row. For - instance, you can generate a uuid for each row with `text().clientDefault(() => Uuid().v4()();` -- New CLI tool to analyze moor files: Learn more at [https://drift.simonbinder.eu/cli](https://drift.simonbinder.eu/cli) -- Ability to override the default `ValueSerializer` globally by using `moorRuntimeOptions.valueSerializer`. -- Moor files: You can now explicitly declare column types in those cases that the analyzer can't infer it: - ``` - selectVariable(:variable AS TEXT): SELECT :variable; - ``` -- Support for triggers and indices! You can declare them in a `.moor` file with a regular `CREATE TRIGGER` - or `CREATE INDEX` statement. Both triggers and indices will be created in the default `onCreate` function. To create - them in `onUpgrade`, use the new `createIndex` and `createTrigger` functions on a `Migrator`. -- Support for moor-file queries that run on initialization ([#280](https://github.com/simolus3/drift/issues/280)) - Declare them like this `@create: INSERT INTO users VALUES ('default', 'user')` -- Support deletes in batches ([#325](https://github.com/simolus3/drift/issues/325)) -- Reduce unnecessary queries when a stream is unsubscribed and then - re-subscribed ([#329](https://github.com/simolus3/drift/issues/329)) -- Experimental new type inference for the sql analyzer. For details, check the - `use_experimental_inference` [build option](https://drift.simonbinder.eu/docs/advanced-features/builder_options/) -- Web: New `initializer` parameter to create the database when it doesn't exist - -## 2.2.0 - -- Support custom expressions for selects in the Dart API: - ```dart - final currentBalance = accounts.income - accounts.expenses; - select(accounts).addColumns([currentBalance]).map((row) { - Account account = row.readTable(accounts); - int balanceOfAccount = row.read(currentBalance); - return ... - }).get(); - ``` -- Support the `json1` and `fts5` extensions! Using them also requires version 2.2 of `moor_generator` - and they require `moor_ffi`. For details, see - the [documentation](https://drift.simonbinder.eu/docs/using-sql/extensions/). -- Standardized behavior of batches in transactions across backends -- Introduced `OrderingTerm.asc` and `OrderingTerm.desc` factories to construct ordering terms more easily - -## 2.1.1 - -- Fix crash when closing a database with asserts disabled -- Web: Save the database after migrations ran -- Escape column names in insert statements, if necessary - -## 2.1.0 - -- New extension methods to simplify the Dart api! - - Use `&`, `or` and `.not()` to combine boolean expressions. - ```dart - // OLD - select(animals)..where((a) => and(not(a.isMammal), a.amountOfLegs.equals(4))) - // NEW: - select(animals)..where((a) => a.isMammal.not() & a.amountOfLegs.equals(4)) - ``` - - Arithmetic: New `+`, `-`, `*` and `/` operators for int and double sql expressions - - New `+` operator for string concatenation -- Fix crash when `customStatement` is the first operation used on a - database ([#199](https://github.com/simolus3/drift/issues/199)) -- Allow transactions inside a `beforeOpen` callback -- New `batch` method on generated databases to execute multiple queries in a single batch -- Experimental support to run moor on a background isolate -- Reduce use of parentheses in SQL code generated at runtime -- Query streams now emit errors that happened while running the query -- Upgraded the sql parser which now supports `WITH` clauses in moor files -- Internal refactorings on the runtime query builder - -## 2.0.1 - -- Introduced `isBetween` and `isBetweenValues` methods for comparable expressions (int, double, datetime) - to check values for both an upper and lower bound -- Automatically map `BOOLEAN` and `DATETIME` columns declared in a sql file to the appropriate type - (both used to be `double` before). -- Fix streams not emitting cached data when listening multiple times -- __Breaking__: Remove the type parameter from `Insertable.createCompanion` (it was declared as an internal method) - -__2.0.1+1__: Fix crash when `customStatement` is the first operation used on a database -([#199](https://github.com/simolus3/drift/issues/199)) - -## 2.0.0 - -This is the first major update after the initial release and moor and we have a lot to cover: -`.moor` files can now have their own imports and queries, you can embed Dart in sql queries using the new templates -feature and we have a prototype of a pure-Dart SQL IDE ready. Finally, we also removed a variety of deprecated features. -See the breaking changes section to learn what components are affected and what alternatives are available. - -### New features - -#### Updates to the sql parser - -`.moor` files were introduced in moor 1.7 as an experimental way to declare tables by using -`CREATE TABLE` statements. In this version, they become stable and support their own import and query system. This -allows you to write queries in their own file: - -```sql -CREATE TABLE users -( - id INT NOT NULL PRIMARY KEY AUTOINCREMENT, - name VARCHAR NOT NULL -); - -findByName -: -SELECT * -FROM users -WHERE name LIKE :query; -``` - -When this file is included from a `@UseMoor` annotation, moor will generate methods to run the query. Of course, you can -also write Dart queries for tables declared in sql: - -```dart -Stream loadUserById(int id) { - return (select(users) - ..where((u) => u.id.equals(2))).watchSingle(); -} -``` - -Moor files can also import other moor files by using an `import 'other.moor';` statement at the top. Then, all tables -defined in `other.moor` will also be available to the current file. - -Moor takes Dart and SQL interop even further with the new "Dart in SQL templates". You can define a query like this: - -```sql -findDynamic -: -SELECT * -FROM users -WHERE $condition; -``` - -And moor will generate a method `findDynamic(Expression condition)` for you. This allows you to bind the -template with a predicate as complex as you'd like. At the moment, Dart templates are supported for -expressions, `OrderBy`, `OrderingTerm` and `Limit`. - -`INSERT` statements can now be used as a compiled statement - both in moor files and in a `@UseMoor` or `@UseDao` -annotation. A new builtin linter will even warn you when you forget to provide a value for a non-nullable column - right -at compile time! - -And finally, we now generate better query code when queries only return a single column. Instead of generating a whole -new class for that, we simply return the value directly. - -#### Experimental ffi support - -We released an experimental version of moor built on top of `dart:ffi`. It works cross-platform and is much, much faster -than `moor_flutter`. It you want to try it out, read the docs [here](https://drift.simonbinder.eu/docs/other-engines/vm/) -. - -### Minor changes - -- a `Constant` can now be written to SQL, it used to throw before. This is useful if you need default values for - strings columns. This also works for `BLOBS` - (`Constant`). -- new `LazyDatabase` for when you want to construct a database asynchronously (for instance, if you first need to find a - file before you can open a database). - -### Breaking changes - -- __THIS LIKELY AFFECTS YOUR APP:__ Removed the `transaction` parameter for callbacks in transactions and `beforeOpen` - callbacks. So, instead of writing - ```dart - transaction((t) async { - await t.update(table)...; - }); - ``` - simply write - ```dart - transaction(() async { - await update(table)...; - }); - ``` - Similarly, instead of using `onOpen: (db, details) async {...}`, use - `onOpen: (details) async {...}`. You don't have to worry about calling methods on your database instead of a - transaction objects. They will be delegated automatically. - - On a similar note, we also removed the `operateOn` parameter from compiled queries. -- Compiled queries that return only a single column (e.g. `SELECT COUNT(*) FROM users`) - will just return their value (in this case, an `int`) now. Moor no longer generates a new class in that case. -- Removed `MigrationStrategy.onFinished`. Use `beforeOpen` instead. -- Compiled sql queries starting with an underscore will now generate private match queries. Previously, the - query `_allUsers` would generate a `watchAllUsers` method, that has been adopted to `_watchAllUsers`. - The `generate_private_watch_methods` builder option, which backported this fix to older versions, has thus been - removed. -- Removed `InsertStatement.insertOrReplace`. Use `insert(data, orReplace: true)` instead. -- Removed the diff util and `MoorAnimatedList`. Use a third party library for that. - -## 1.7.2 - -- Fixed a race condition that caused the database to be opened multiple times on slower devices. This problem was - introduced in `1.7.0` and was causing problems during migrations. - -## 1.7.1 - -- Better documentation on `getSingle` and `watchSingle` for queries. -- Fix `INTEGER NOT NULL PRIMARY KEY` wrongly requiring a value during insert (this never affected - `AUTOINCREMENT` columns, and only affects columns declared in a `.moor` file) - -## 1.7.0 - -- Support custom columns via type converters. See the [docs](https://drift.simonbinder.eu/type_converters) - for details on how to use this feature. -- Transactions now roll back when not completed successfully, they also rethrow the exception to make debugging easier. -- New `backends` api, making it easier to write database drivers that work with moor. Apart from - `moor_flutter`, new experimental backends can be checked out from git: - 1. `encrypted_moor`: An encrypted moor database: https://github.com/simolus3/drift/tree/develop/extras/encryption -- The compiled sql feature is no longer experimental and will stay stable until a major version bump -- New, experimental support for `.moor` files! Instead of declaring your tables in Dart, you can choose to declare them - with sql by writing the `CREATE TABLE` statement in a `.moor` file. You can then use these tables in the database and - with daos by using the `include` parameter on `@UseMoor` and `@UseDao`. Again, please notice that this is an - experimental api and there might be some hiccups. Please report any issues you run into. - -## 1.6.0 - -- Experimental web support! See [the documentation](https://drift.simonbinder.eu/web) for details. -- Make transactions easier to use: Thanks to some Dart async magic, you no longer need to run queries on the transaction - explicitly. This - ```dart - Future deleteCategory(Category category) { - return transaction((t) async { - await t.delete(categories).delete(category); - }); - } - ``` - is now the same as this (notice how we don't have to use the `t.` in front of the delete) - ```dart - Future deleteCategory(Category category) { - return transaction((t) async { - await delete(categories).delete(category); - }); - } - ``` - This makes it much easier to compose operations by extracting them into methods, as you don't have to worry about not - using the `t` parameter. -- Moor now provides syntax sugar for list parameters in compiled custom queries - (`SELECT * FROM entries WHERE id IN ?`) -- Support `COLLATE` expressions. -- Date time columns are now comparable -- The `StringType` now supports arbitrary data from sqlite ([#70](https://github.com/simolus3/drift/pull/70)). - Thanks, [knaeckeKami](https://github.com/knaeckeKami)! -- Bugfixes related to stream queries and `LIMIT` clauses. - -## 1.5.1 - -- Fixed an issue where transformed streams would not always update -- Emit a `INSERT INTO table DEFAULT VALUES` when appropriate. Moor used to generate invalid sql before. - -## 1.5.0 - -This version introduces some new concepts and features, which are explained in more detail below. Here is a quick -overview of the new features: - -- More consistent and reliable callbacks for migrations. You can now use `MigrationStrategy.beforeOpen` - to run queries after migrations, but before fully opening the database. This is useful to initialize data. -- Greatly expanded documentation, introduced additional checks to provide more helpful error messages -- New `getSingle` and `watchSingle` methods on queries: Queries that you know will only return one row can now be - instructed to return the value directly instead of wrapping it in a list. -- New "update companion" classes to clearly separate between absent values and explicitly setting values back to null - - explained below. -- Experimental support for compiled sql queries: __Moor can now generate typesafe APIs for written sql__. Read on to get - started. - -### Update companions - -Newly introduced "Update companions" allow you to insert or update data more precisely than before. Previously, there -was no clear separation between "null" and absent values. For instance, let's say we had a table "users" that stores an -id, a name, and an age. Now, let's say we wanted to set the age of a user to null without changing its name. Would we -use `User(age: null)`? Here, the `name` column would implicitly be set to null, so we can't cleanly separate that. -However, with `UsersCompanion(age: Value(null))`, we know the difference between `Value(null)` and the -default `Value.absent()`. - -Don't worry, all your existing code will continue to work, this change is fully backwards compatible. You might get -analyzer warnings about missing required fields. The migration to update companions will fix that. Replacing normal -classes with their update companions is simple and the only thing needed to fix that. -The [documentation](https://drift.simonbinder.eu/queries/#updates-and-deletes) -has been updated to reflect this. If you have additional questions, feel free to -[create an issue](https://github.com/simolus3/drift/issues/new). - -### Compiled sql queries - -Experimental support for compile time custom statements. Sounds super boring, but it actually gives you a fluent way to -write queries in pure sql. The moor generator will figure out what your queries return and automatically generate the -boring mapping part. Head on to -[the documentation](https://drift.simonbinder.eu/queries/custom) to find out how to use this new feature. - -Please note that this feature is in an experimental state: Expect minor, but breaking changes in the API and in the -generated code. Also, if you run into any issues with this feature, -[reporting them](https://github.com/simolus3/drift/issues/new) would be super appreciated. - -## 1.4.0 - -- Added the `RealColumn`, which stores floating point values -- Better configuration for the serializer with the `JsonKey` annotation and the ability to use a - custom `ValueSerializer` - -## 1.3.0 - -- Moor now supports table joins - - Added table aliases -- Default values for columns: Just use the `withDefault` method when declaring a column - - added expressions that resolve to the current date or time -- Fixed a crash that would occur if the first operation was a transaction -- Better support for custom expressions as part of a regular query -- Faster hashcode implementation in generated data classes - -## 1.2.0 - -- __Breaking__: Generated DAO classes are now called `_$YourNameHere`, it used to be just `_YourNameHere` (without the - dollar sign) -- Blob data type -- `insertOrReplace` method for insert statements -- DAOs can now operate on transactions -- Custom constraints -- Query streams are now cached so that equal queries yield identical streams. This can improve performance. - -## 1.1.0 - -- Transactions - -## 1.0.0 - -- Initial version of the Moor library diff --git a/moor/LICENSE b/moor/LICENSE deleted file mode 100644 index e4b21941..00000000 --- a/moor/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2019 Simon Binder - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/moor/README.md b/moor/README.md deleted file mode 100644 index 3c6dd4fc..00000000 --- a/moor/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# Moor - -__Important notice__: Moor has been renamed to Drift. -This package will continue to be supported for a while, but we encourage users to migrate to `drift`. -Automated tooling to help you make the switch is available! For more information, see [the documentation](https://drift.simonbinder.eu/name/). -Thank you for understanding! - -__To start using Drift, read our detailed [docs](https://drift.simonbinder.eu/docs/getting-started/).__ - -## Proudly Sponsored by [Stream 💙](https://getstream.io/chat/sdk/android/?utm_source=Moor&utm_medium=Github_Repo_Content_Ad&utm_content=Developer&utm_campaign=Moor_July2022_AndroidChatSDK_klmh22) - -

- - - - - - -
-
Try the Flutter Chat Tutorial  ðŸ’¬ -
-

diff --git a/moor/analysis_options.yaml b/moor/analysis_options.yaml deleted file mode 100644 index 8b443153..00000000 --- a/moor/analysis_options.yaml +++ /dev/null @@ -1,10 +0,0 @@ -#include: ../analysis_options.yaml - -analyzer: - errors: - public_member_api_docs: warning - deprecated_member_use_from_same_package: ignore - exclude: - - "example_web/**" - - "**/*.g.dart" - - "**/*.mocks.dart" diff --git a/moor/build.yaml b/moor/build.yaml deleted file mode 100644 index c2e159df..00000000 --- a/moor/build.yaml +++ /dev/null @@ -1,21 +0,0 @@ -targets: - $default: - builders: - moor_generator: - options: - override_hash_and_equals_in_result_sets: true - use_column_name_as_json_key_when_defined_in_moor_file: true - generate_connect_constructor: true - compact_query_methods: true - write_from_json_string_constructor: true - raw_result_set_data: true - apply_converters_on_variables: true - generate_values_in_copy_with: true - named_parameters: true - new_sql_code_generation: true - scoped_dart_components: true - sqlite: - version: "3.35" - modules: - - json1 - - fts5 diff --git a/moor/example/example.dart b/moor/example/example.dart deleted file mode 100644 index 0b7af6d3..00000000 --- a/moor/example/example.dart +++ /dev/null @@ -1,69 +0,0 @@ -import 'package:moor/moor.dart'; - -part 'example.g.dart'; - -// Define tables that can model a database of recipes. - -@DataClassName('Category') -class Categories extends Table { - IntColumn get id => integer().autoIncrement()(); - TextColumn get description => text().nullable()(); -} - -class Recipes extends Table { - IntColumn get id => integer().autoIncrement()(); - TextColumn get title => text().withLength(max: 16)(); - TextColumn get instructions => text()(); - IntColumn get category => integer().nullable()(); -} - -class Ingredients extends Table { - IntColumn get id => integer().autoIncrement()(); - TextColumn get name => text()(); - IntColumn get caloriesPer100g => integer().named('calories')(); -} - -class IngredientInRecipes extends Table { - @override - String get tableName => 'recipe_ingredients'; - - // We can also specify custom primary keys - @override - Set get primaryKey => {recipe, ingredient}; - - IntColumn get recipe => integer()(); - IntColumn get ingredient => integer()(); - - IntColumn get amountInGrams => integer().named('amount')(); -} - -@UseMoor( - tables: [Categories, Recipes, Ingredients, IngredientInRecipes], - queries: { - // query to load the total weight for each recipe by loading all ingredients - // and taking the sum of their amountInGrams. - 'totalWeight': ''' - SELECT r.title, SUM(ir.amount) AS total_weight - FROM recipes r - INNER JOIN recipe_ingredients ir ON ir.recipe = r.id - GROUP BY r.id - ''' - }, -) -class Database extends _$Database { - Database(QueryExecutor e) : super(e); - - @override - int get schemaVersion => 1; - - @override - MigrationStrategy get migration { - return MigrationStrategy( - beforeOpen: (details) async { - // populate data - await into(categories) - .insert(const CategoriesCompanion(description: Value('Sweets'))); - }, - ); - } -} diff --git a/moor/example/example.g.dart b/moor/example/example.g.dart deleted file mode 100644 index b6d83daf..00000000 --- a/moor/example/example.g.dart +++ /dev/null @@ -1,938 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'example.dart'; - -// ************************************************************************** -// MoorGenerator -// ************************************************************************** - -// ignore_for_file: unnecessary_brace_in_string_interps, unnecessary_this -class Category extends DataClass implements Insertable { - final int id; - final String? description; - Category({required this.id, this.description}); - factory Category.fromData(Map data, GeneratedDatabase db, - {String? prefix}) { - final effectivePrefix = prefix ?? ''; - return Category( - id: const IntType() - .mapFromDatabaseResponse(data['${effectivePrefix}id'])!, - description: const StringType() - .mapFromDatabaseResponse(data['${effectivePrefix}description']), - ); - } - @override - Map toColumns(bool nullToAbsent) { - final map = {}; - map['id'] = Variable(id); - if (!nullToAbsent || description != null) { - map['description'] = Variable(description); - } - return map; - } - - CategoriesCompanion toCompanion(bool nullToAbsent) { - return CategoriesCompanion( - id: Value(id), - description: description == null && nullToAbsent - ? const Value.absent() - : Value(description), - ); - } - - factory Category.fromJson(Map json, - {ValueSerializer? serializer}) { - serializer ??= moorRuntimeOptions.defaultSerializer; - return Category( - id: serializer.fromJson(json['id']), - description: serializer.fromJson(json['description']), - ); - } - factory Category.fromJsonString(String encodedJson, - {ValueSerializer? serializer}) => - Category.fromJson( - DataClass.parseJson(encodedJson) as Map, - serializer: serializer); - @override - Map toJson({ValueSerializer? serializer}) { - serializer ??= moorRuntimeOptions.defaultSerializer; - return { - 'id': serializer.toJson(id), - 'description': serializer.toJson(description), - }; - } - - Category copyWith( - {int? id, Value description = const Value.absent()}) => - Category( - id: id ?? this.id, - description: description.present ? description.value : this.description, - ); - @override - String toString() { - return (StringBuffer('Category(') - ..write('id: $id, ') - ..write('description: $description') - ..write(')')) - .toString(); - } - - @override - int get hashCode => Object.hash(id, description); - @override - bool operator ==(Object other) => - identical(this, other) || - (other is Category && - other.id == this.id && - other.description == this.description); -} - -class CategoriesCompanion extends UpdateCompanion { - final Value id; - final Value description; - const CategoriesCompanion({ - this.id = const Value.absent(), - this.description = const Value.absent(), - }); - CategoriesCompanion.insert({ - this.id = const Value.absent(), - this.description = const Value.absent(), - }); - static Insertable custom({ - Expression? id, - Expression? description, - }) { - return RawValuesInsertable({ - if (id != null) 'id': id, - if (description != null) 'description': description, - }); - } - - CategoriesCompanion copyWith({Value? id, Value? description}) { - return CategoriesCompanion( - id: id ?? this.id, - description: description ?? this.description, - ); - } - - @override - Map toColumns(bool nullToAbsent) { - final map = {}; - if (id.present) { - map['id'] = Variable(id.value); - } - if (description.present) { - map['description'] = Variable(description.value); - } - return map; - } - - @override - String toString() { - return (StringBuffer('CategoriesCompanion(') - ..write('id: $id, ') - ..write('description: $description') - ..write(')')) - .toString(); - } -} - -class $CategoriesTable extends Categories - with TableInfo<$CategoriesTable, Category> { - final GeneratedDatabase _db; - final String? _alias; - $CategoriesTable(this._db, [this._alias]); - final VerificationMeta _idMeta = const VerificationMeta('id'); - late final GeneratedColumn id = GeneratedColumn( - 'id', aliasedName, false, - typeName: 'INTEGER', - requiredDuringInsert: false, - defaultConstraints: 'PRIMARY KEY AUTOINCREMENT'); - final VerificationMeta _descriptionMeta = - const VerificationMeta('description'); - late final GeneratedColumn description = GeneratedColumn( - 'description', aliasedName, true, - typeName: 'TEXT', requiredDuringInsert: false); - @override - List get $columns => [id, description]; - @override - String get aliasedName => _alias ?? 'categories'; - @override - String get actualTableName => 'categories'; - @override - VerificationContext validateIntegrity(Insertable instance, - {bool isInserting = false}) { - final context = VerificationContext(); - final data = instance.toColumns(true); - if (data.containsKey('id')) { - context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); - } - if (data.containsKey('description')) { - context.handle( - _descriptionMeta, - description.isAcceptableOrUnknown( - data['description']!, _descriptionMeta)); - } - return context; - } - - @override - Set get $primaryKey => {id}; - @override - Category map(Map data, {String? tablePrefix}) { - return Category.fromData(data, _db, - prefix: tablePrefix != null ? '$tablePrefix.' : null); - } - - @override - $CategoriesTable createAlias(String alias) { - return $CategoriesTable(_db, alias); - } -} - -class Recipe extends DataClass implements Insertable { - final int id; - final String title; - final String instructions; - final int? category; - Recipe( - {required this.id, - required this.title, - required this.instructions, - this.category}); - factory Recipe.fromData(Map data, GeneratedDatabase db, - {String? prefix}) { - final effectivePrefix = prefix ?? ''; - return Recipe( - id: const IntType() - .mapFromDatabaseResponse(data['${effectivePrefix}id'])!, - title: const StringType() - .mapFromDatabaseResponse(data['${effectivePrefix}title'])!, - instructions: const StringType() - .mapFromDatabaseResponse(data['${effectivePrefix}instructions'])!, - category: const IntType() - .mapFromDatabaseResponse(data['${effectivePrefix}category']), - ); - } - @override - Map toColumns(bool nullToAbsent) { - final map = {}; - map['id'] = Variable(id); - map['title'] = Variable(title); - map['instructions'] = Variable(instructions); - if (!nullToAbsent || category != null) { - map['category'] = Variable(category); - } - return map; - } - - RecipesCompanion toCompanion(bool nullToAbsent) { - return RecipesCompanion( - id: Value(id), - title: Value(title), - instructions: Value(instructions), - category: category == null && nullToAbsent - ? const Value.absent() - : Value(category), - ); - } - - factory Recipe.fromJson(Map json, - {ValueSerializer? serializer}) { - serializer ??= moorRuntimeOptions.defaultSerializer; - return Recipe( - id: serializer.fromJson(json['id']), - title: serializer.fromJson(json['title']), - instructions: serializer.fromJson(json['instructions']), - category: serializer.fromJson(json['category']), - ); - } - factory Recipe.fromJsonString(String encodedJson, - {ValueSerializer? serializer}) => - Recipe.fromJson(DataClass.parseJson(encodedJson) as Map, - serializer: serializer); - @override - Map toJson({ValueSerializer? serializer}) { - serializer ??= moorRuntimeOptions.defaultSerializer; - return { - 'id': serializer.toJson(id), - 'title': serializer.toJson(title), - 'instructions': serializer.toJson(instructions), - 'category': serializer.toJson(category), - }; - } - - Recipe copyWith( - {int? id, - String? title, - String? instructions, - Value category = const Value.absent()}) => - Recipe( - id: id ?? this.id, - title: title ?? this.title, - instructions: instructions ?? this.instructions, - category: category.present ? category.value : this.category, - ); - @override - String toString() { - return (StringBuffer('Recipe(') - ..write('id: $id, ') - ..write('title: $title, ') - ..write('instructions: $instructions, ') - ..write('category: $category') - ..write(')')) - .toString(); - } - - @override - int get hashCode => Object.hash(id, title, instructions, category); - @override - bool operator ==(Object other) => - identical(this, other) || - (other is Recipe && - other.id == this.id && - other.title == this.title && - other.instructions == this.instructions && - other.category == this.category); -} - -class RecipesCompanion extends UpdateCompanion { - final Value id; - final Value title; - final Value instructions; - final Value category; - const RecipesCompanion({ - this.id = const Value.absent(), - this.title = const Value.absent(), - this.instructions = const Value.absent(), - this.category = const Value.absent(), - }); - RecipesCompanion.insert({ - this.id = const Value.absent(), - required String title, - required String instructions, - this.category = const Value.absent(), - }) : title = Value(title), - instructions = Value(instructions); - static Insertable custom({ - Expression? id, - Expression? title, - Expression? instructions, - Expression? category, - }) { - return RawValuesInsertable({ - if (id != null) 'id': id, - if (title != null) 'title': title, - if (instructions != null) 'instructions': instructions, - if (category != null) 'category': category, - }); - } - - RecipesCompanion copyWith( - {Value? id, - Value? title, - Value? instructions, - Value? category}) { - return RecipesCompanion( - id: id ?? this.id, - title: title ?? this.title, - instructions: instructions ?? this.instructions, - category: category ?? this.category, - ); - } - - @override - Map toColumns(bool nullToAbsent) { - final map = {}; - if (id.present) { - map['id'] = Variable(id.value); - } - if (title.present) { - map['title'] = Variable(title.value); - } - if (instructions.present) { - map['instructions'] = Variable(instructions.value); - } - if (category.present) { - map['category'] = Variable(category.value); - } - return map; - } - - @override - String toString() { - return (StringBuffer('RecipesCompanion(') - ..write('id: $id, ') - ..write('title: $title, ') - ..write('instructions: $instructions, ') - ..write('category: $category') - ..write(')')) - .toString(); - } -} - -class $RecipesTable extends Recipes with TableInfo<$RecipesTable, Recipe> { - final GeneratedDatabase _db; - final String? _alias; - $RecipesTable(this._db, [this._alias]); - final VerificationMeta _idMeta = const VerificationMeta('id'); - late final GeneratedColumn id = GeneratedColumn( - 'id', aliasedName, false, - typeName: 'INTEGER', - requiredDuringInsert: false, - defaultConstraints: 'PRIMARY KEY AUTOINCREMENT'); - final VerificationMeta _titleMeta = const VerificationMeta('title'); - late final GeneratedColumn title = GeneratedColumn( - 'title', aliasedName, false, - additionalChecks: GeneratedColumn.checkTextLength(maxTextLength: 16), - typeName: 'TEXT', - requiredDuringInsert: true); - final VerificationMeta _instructionsMeta = - const VerificationMeta('instructions'); - late final GeneratedColumn instructions = GeneratedColumn( - 'instructions', aliasedName, false, - typeName: 'TEXT', requiredDuringInsert: true); - final VerificationMeta _categoryMeta = const VerificationMeta('category'); - late final GeneratedColumn category = GeneratedColumn( - 'category', aliasedName, true, - typeName: 'INTEGER', requiredDuringInsert: false); - @override - List get $columns => [id, title, instructions, category]; - @override - String get aliasedName => _alias ?? 'recipes'; - @override - String get actualTableName => 'recipes'; - @override - VerificationContext validateIntegrity(Insertable instance, - {bool isInserting = false}) { - final context = VerificationContext(); - final data = instance.toColumns(true); - if (data.containsKey('id')) { - context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); - } - if (data.containsKey('title')) { - context.handle( - _titleMeta, title.isAcceptableOrUnknown(data['title']!, _titleMeta)); - } else if (isInserting) { - context.missing(_titleMeta); - } - if (data.containsKey('instructions')) { - context.handle( - _instructionsMeta, - instructions.isAcceptableOrUnknown( - data['instructions']!, _instructionsMeta)); - } else if (isInserting) { - context.missing(_instructionsMeta); - } - if (data.containsKey('category')) { - context.handle(_categoryMeta, - category.isAcceptableOrUnknown(data['category']!, _categoryMeta)); - } - return context; - } - - @override - Set get $primaryKey => {id}; - @override - Recipe map(Map data, {String? tablePrefix}) { - return Recipe.fromData(data, _db, - prefix: tablePrefix != null ? '$tablePrefix.' : null); - } - - @override - $RecipesTable createAlias(String alias) { - return $RecipesTable(_db, alias); - } -} - -class Ingredient extends DataClass implements Insertable { - final int id; - final String name; - final int caloriesPer100g; - Ingredient( - {required this.id, required this.name, required this.caloriesPer100g}); - factory Ingredient.fromData(Map data, GeneratedDatabase db, - {String? prefix}) { - final effectivePrefix = prefix ?? ''; - return Ingredient( - id: const IntType() - .mapFromDatabaseResponse(data['${effectivePrefix}id'])!, - name: const StringType() - .mapFromDatabaseResponse(data['${effectivePrefix}name'])!, - caloriesPer100g: const IntType() - .mapFromDatabaseResponse(data['${effectivePrefix}calories'])!, - ); - } - @override - Map toColumns(bool nullToAbsent) { - final map = {}; - map['id'] = Variable(id); - map['name'] = Variable(name); - map['calories'] = Variable(caloriesPer100g); - return map; - } - - IngredientsCompanion toCompanion(bool nullToAbsent) { - return IngredientsCompanion( - id: Value(id), - name: Value(name), - caloriesPer100g: Value(caloriesPer100g), - ); - } - - factory Ingredient.fromJson(Map json, - {ValueSerializer? serializer}) { - serializer ??= moorRuntimeOptions.defaultSerializer; - return Ingredient( - id: serializer.fromJson(json['id']), - name: serializer.fromJson(json['name']), - caloriesPer100g: serializer.fromJson(json['caloriesPer100g']), - ); - } - factory Ingredient.fromJsonString(String encodedJson, - {ValueSerializer? serializer}) => - Ingredient.fromJson( - DataClass.parseJson(encodedJson) as Map, - serializer: serializer); - @override - Map toJson({ValueSerializer? serializer}) { - serializer ??= moorRuntimeOptions.defaultSerializer; - return { - 'id': serializer.toJson(id), - 'name': serializer.toJson(name), - 'caloriesPer100g': serializer.toJson(caloriesPer100g), - }; - } - - Ingredient copyWith({int? id, String? name, int? caloriesPer100g}) => - Ingredient( - id: id ?? this.id, - name: name ?? this.name, - caloriesPer100g: caloriesPer100g ?? this.caloriesPer100g, - ); - @override - String toString() { - return (StringBuffer('Ingredient(') - ..write('id: $id, ') - ..write('name: $name, ') - ..write('caloriesPer100g: $caloriesPer100g') - ..write(')')) - .toString(); - } - - @override - int get hashCode => Object.hash(id, name, caloriesPer100g); - @override - bool operator ==(Object other) => - identical(this, other) || - (other is Ingredient && - other.id == this.id && - other.name == this.name && - other.caloriesPer100g == this.caloriesPer100g); -} - -class IngredientsCompanion extends UpdateCompanion { - final Value id; - final Value name; - final Value caloriesPer100g; - const IngredientsCompanion({ - this.id = const Value.absent(), - this.name = const Value.absent(), - this.caloriesPer100g = const Value.absent(), - }); - IngredientsCompanion.insert({ - this.id = const Value.absent(), - required String name, - required int caloriesPer100g, - }) : name = Value(name), - caloriesPer100g = Value(caloriesPer100g); - static Insertable custom({ - Expression? id, - Expression? name, - Expression? caloriesPer100g, - }) { - return RawValuesInsertable({ - if (id != null) 'id': id, - if (name != null) 'name': name, - if (caloriesPer100g != null) 'calories': caloriesPer100g, - }); - } - - IngredientsCompanion copyWith( - {Value? id, Value? name, Value? caloriesPer100g}) { - return IngredientsCompanion( - id: id ?? this.id, - name: name ?? this.name, - caloriesPer100g: caloriesPer100g ?? this.caloriesPer100g, - ); - } - - @override - Map toColumns(bool nullToAbsent) { - final map = {}; - if (id.present) { - map['id'] = Variable(id.value); - } - if (name.present) { - map['name'] = Variable(name.value); - } - if (caloriesPer100g.present) { - map['calories'] = Variable(caloriesPer100g.value); - } - return map; - } - - @override - String toString() { - return (StringBuffer('IngredientsCompanion(') - ..write('id: $id, ') - ..write('name: $name, ') - ..write('caloriesPer100g: $caloriesPer100g') - ..write(')')) - .toString(); - } -} - -class $IngredientsTable extends Ingredients - with TableInfo<$IngredientsTable, Ingredient> { - final GeneratedDatabase _db; - final String? _alias; - $IngredientsTable(this._db, [this._alias]); - final VerificationMeta _idMeta = const VerificationMeta('id'); - late final GeneratedColumn id = GeneratedColumn( - 'id', aliasedName, false, - typeName: 'INTEGER', - requiredDuringInsert: false, - defaultConstraints: 'PRIMARY KEY AUTOINCREMENT'); - final VerificationMeta _nameMeta = const VerificationMeta('name'); - late final GeneratedColumn name = GeneratedColumn( - 'name', aliasedName, false, - typeName: 'TEXT', requiredDuringInsert: true); - final VerificationMeta _caloriesPer100gMeta = - const VerificationMeta('caloriesPer100g'); - late final GeneratedColumn caloriesPer100g = GeneratedColumn( - 'calories', aliasedName, false, - typeName: 'INTEGER', requiredDuringInsert: true); - @override - List get $columns => [id, name, caloriesPer100g]; - @override - String get aliasedName => _alias ?? 'ingredients'; - @override - String get actualTableName => 'ingredients'; - @override - VerificationContext validateIntegrity(Insertable instance, - {bool isInserting = false}) { - final context = VerificationContext(); - final data = instance.toColumns(true); - if (data.containsKey('id')) { - context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); - } - if (data.containsKey('name')) { - context.handle( - _nameMeta, name.isAcceptableOrUnknown(data['name']!, _nameMeta)); - } else if (isInserting) { - context.missing(_nameMeta); - } - if (data.containsKey('calories')) { - context.handle( - _caloriesPer100gMeta, - caloriesPer100g.isAcceptableOrUnknown( - data['calories']!, _caloriesPer100gMeta)); - } else if (isInserting) { - context.missing(_caloriesPer100gMeta); - } - return context; - } - - @override - Set get $primaryKey => {id}; - @override - Ingredient map(Map data, {String? tablePrefix}) { - return Ingredient.fromData(data, _db, - prefix: tablePrefix != null ? '$tablePrefix.' : null); - } - - @override - $IngredientsTable createAlias(String alias) { - return $IngredientsTable(_db, alias); - } -} - -class IngredientInRecipe extends DataClass - implements Insertable { - final int recipe; - final int ingredient; - final int amountInGrams; - IngredientInRecipe( - {required this.recipe, - required this.ingredient, - required this.amountInGrams}); - factory IngredientInRecipe.fromData( - Map data, GeneratedDatabase db, - {String? prefix}) { - final effectivePrefix = prefix ?? ''; - return IngredientInRecipe( - recipe: const IntType() - .mapFromDatabaseResponse(data['${effectivePrefix}recipe'])!, - ingredient: const IntType() - .mapFromDatabaseResponse(data['${effectivePrefix}ingredient'])!, - amountInGrams: const IntType() - .mapFromDatabaseResponse(data['${effectivePrefix}amount'])!, - ); - } - @override - Map toColumns(bool nullToAbsent) { - final map = {}; - map['recipe'] = Variable(recipe); - map['ingredient'] = Variable(ingredient); - map['amount'] = Variable(amountInGrams); - return map; - } - - IngredientInRecipesCompanion toCompanion(bool nullToAbsent) { - return IngredientInRecipesCompanion( - recipe: Value(recipe), - ingredient: Value(ingredient), - amountInGrams: Value(amountInGrams), - ); - } - - factory IngredientInRecipe.fromJson(Map json, - {ValueSerializer? serializer}) { - serializer ??= moorRuntimeOptions.defaultSerializer; - return IngredientInRecipe( - recipe: serializer.fromJson(json['recipe']), - ingredient: serializer.fromJson(json['ingredient']), - amountInGrams: serializer.fromJson(json['amountInGrams']), - ); - } - factory IngredientInRecipe.fromJsonString(String encodedJson, - {ValueSerializer? serializer}) => - IngredientInRecipe.fromJson( - DataClass.parseJson(encodedJson) as Map, - serializer: serializer); - @override - Map toJson({ValueSerializer? serializer}) { - serializer ??= moorRuntimeOptions.defaultSerializer; - return { - 'recipe': serializer.toJson(recipe), - 'ingredient': serializer.toJson(ingredient), - 'amountInGrams': serializer.toJson(amountInGrams), - }; - } - - IngredientInRecipe copyWith( - {int? recipe, int? ingredient, int? amountInGrams}) => - IngredientInRecipe( - recipe: recipe ?? this.recipe, - ingredient: ingredient ?? this.ingredient, - amountInGrams: amountInGrams ?? this.amountInGrams, - ); - @override - String toString() { - return (StringBuffer('IngredientInRecipe(') - ..write('recipe: $recipe, ') - ..write('ingredient: $ingredient, ') - ..write('amountInGrams: $amountInGrams') - ..write(')')) - .toString(); - } - - @override - int get hashCode => Object.hash(recipe, ingredient, amountInGrams); - @override - bool operator ==(Object other) => - identical(this, other) || - (other is IngredientInRecipe && - other.recipe == this.recipe && - other.ingredient == this.ingredient && - other.amountInGrams == this.amountInGrams); -} - -class IngredientInRecipesCompanion extends UpdateCompanion { - final Value recipe; - final Value ingredient; - final Value amountInGrams; - const IngredientInRecipesCompanion({ - this.recipe = const Value.absent(), - this.ingredient = const Value.absent(), - this.amountInGrams = const Value.absent(), - }); - IngredientInRecipesCompanion.insert({ - required int recipe, - required int ingredient, - required int amountInGrams, - }) : recipe = Value(recipe), - ingredient = Value(ingredient), - amountInGrams = Value(amountInGrams); - static Insertable custom({ - Expression? recipe, - Expression? ingredient, - Expression? amountInGrams, - }) { - return RawValuesInsertable({ - if (recipe != null) 'recipe': recipe, - if (ingredient != null) 'ingredient': ingredient, - if (amountInGrams != null) 'amount': amountInGrams, - }); - } - - IngredientInRecipesCompanion copyWith( - {Value? recipe, Value? ingredient, Value? amountInGrams}) { - return IngredientInRecipesCompanion( - recipe: recipe ?? this.recipe, - ingredient: ingredient ?? this.ingredient, - amountInGrams: amountInGrams ?? this.amountInGrams, - ); - } - - @override - Map toColumns(bool nullToAbsent) { - final map = {}; - if (recipe.present) { - map['recipe'] = Variable(recipe.value); - } - if (ingredient.present) { - map['ingredient'] = Variable(ingredient.value); - } - if (amountInGrams.present) { - map['amount'] = Variable(amountInGrams.value); - } - return map; - } - - @override - String toString() { - return (StringBuffer('IngredientInRecipesCompanion(') - ..write('recipe: $recipe, ') - ..write('ingredient: $ingredient, ') - ..write('amountInGrams: $amountInGrams') - ..write(')')) - .toString(); - } -} - -class $IngredientInRecipesTable extends IngredientInRecipes - with TableInfo<$IngredientInRecipesTable, IngredientInRecipe> { - final GeneratedDatabase _db; - final String? _alias; - $IngredientInRecipesTable(this._db, [this._alias]); - final VerificationMeta _recipeMeta = const VerificationMeta('recipe'); - late final GeneratedColumn recipe = GeneratedColumn( - 'recipe', aliasedName, false, - typeName: 'INTEGER', requiredDuringInsert: true); - final VerificationMeta _ingredientMeta = const VerificationMeta('ingredient'); - late final GeneratedColumn ingredient = GeneratedColumn( - 'ingredient', aliasedName, false, - typeName: 'INTEGER', requiredDuringInsert: true); - final VerificationMeta _amountInGramsMeta = - const VerificationMeta('amountInGrams'); - late final GeneratedColumn amountInGrams = GeneratedColumn( - 'amount', aliasedName, false, - typeName: 'INTEGER', requiredDuringInsert: true); - @override - List get $columns => [recipe, ingredient, amountInGrams]; - @override - String get aliasedName => _alias ?? 'recipe_ingredients'; - @override - String get actualTableName => 'recipe_ingredients'; - @override - VerificationContext validateIntegrity(Insertable instance, - {bool isInserting = false}) { - final context = VerificationContext(); - final data = instance.toColumns(true); - if (data.containsKey('recipe')) { - context.handle(_recipeMeta, - recipe.isAcceptableOrUnknown(data['recipe']!, _recipeMeta)); - } else if (isInserting) { - context.missing(_recipeMeta); - } - if (data.containsKey('ingredient')) { - context.handle( - _ingredientMeta, - ingredient.isAcceptableOrUnknown( - data['ingredient']!, _ingredientMeta)); - } else if (isInserting) { - context.missing(_ingredientMeta); - } - if (data.containsKey('amount')) { - context.handle( - _amountInGramsMeta, - amountInGrams.isAcceptableOrUnknown( - data['amount']!, _amountInGramsMeta)); - } else if (isInserting) { - context.missing(_amountInGramsMeta); - } - return context; - } - - @override - Set get $primaryKey => {recipe, ingredient}; - @override - IngredientInRecipe map(Map data, {String? tablePrefix}) { - return IngredientInRecipe.fromData(data, _db, - prefix: tablePrefix != null ? '$tablePrefix.' : null); - } - - @override - $IngredientInRecipesTable createAlias(String alias) { - return $IngredientInRecipesTable(_db, alias); - } -} - -abstract class _$Database extends GeneratedDatabase { - _$Database(QueryExecutor e) : super(SqlTypeSystem.defaultInstance, e); - _$Database.connect(DatabaseConnection c) : super.connect(c); - late final $CategoriesTable categories = $CategoriesTable(this); - late final $RecipesTable recipes = $RecipesTable(this); - late final $IngredientsTable ingredients = $IngredientsTable(this); - late final $IngredientInRecipesTable ingredientInRecipes = - $IngredientInRecipesTable(this); - Selectable totalWeight() { - return customSelect( - 'SELECT r.title, SUM(ir.amount) AS total_weight FROM recipes AS r INNER JOIN recipe_ingredients AS ir ON ir.recipe = r.id GROUP BY r.id', - variables: [], - readsFrom: { - recipes, - ingredientInRecipes, - }).map((QueryRow row) { - return TotalWeightResult( - row: row, - title: row.read('title'), - totalWeight: row.read('total_weight'), - ); - }); - } - - @override - Iterable get allTables => allSchemaEntities.whereType(); - @override - List get allSchemaEntities => - [categories, recipes, ingredients, ingredientInRecipes]; -} - -class TotalWeightResult extends CustomResultSet { - final String title; - final int totalWeight; - TotalWeightResult({ - required QueryRow row, - required this.title, - required this.totalWeight, - }) : super(row); - @override - int get hashCode => Object.hash(title, totalWeight); - @override - bool operator ==(Object other) => - identical(this, other) || - (other is TotalWeightResult && - other.title == this.title && - other.totalWeight == this.totalWeight); - @override - String toString() { - return (StringBuffer('TotalWeightResult(') - ..write('title: $title, ') - ..write('totalWeight: $totalWeight') - ..write(')')) - .toString(); - } -} diff --git a/moor/mono_pkg.yaml b/moor/mono_pkg.yaml deleted file mode 100644 index 01ae3517..00000000 --- a/moor/mono_pkg.yaml +++ /dev/null @@ -1,10 +0,0 @@ -dart: - - stable - -stages: - - analyze: - - dartanalyzer: --fatal-infos --fatal-warnings lib/ test/ - - dartfmt - - unit_test: - - command: pub run build_runner build -v --delete-conflicting-outputs - - test \ No newline at end of file diff --git a/moor/tools/analyzer_plugin/bin/plugin.dart b/moor/tools/analyzer_plugin/bin/plugin.dart deleted file mode 100644 index 08aefb39..00000000 --- a/moor/tools/analyzer_plugin/bin/plugin.dart +++ /dev/null @@ -1,43 +0,0 @@ -//@dart=2.6 - -import 'dart:convert'; -import 'dart:isolate'; - -import 'package:moor_generator/integrations/plugin.dart' as plugin; -import 'package:web_socket_channel/io.dart'; - -const useDebuggingVariant = false; - -void main(List args, SendPort sendPort) { - if (useDebuggingVariant) { - _PluginProxy(sendPort).start(); - } else { - plugin.start(args, sendPort); - } -} - -// Used during development. See CONTRIBUTING.md in the moor repo on how to debug -// the plugin. -class _PluginProxy { - final SendPort sendToAnalysisServer; - - ReceivePort _receive; - IOWebSocketChannel _channel; - - _PluginProxy(this.sendToAnalysisServer); - - Future start() async { - _channel = IOWebSocketChannel.connect('ws://localhost:9999'); - _receive = ReceivePort(); - sendToAnalysisServer.send(_receive.sendPort); - - _receive.listen((data) { - // the server will send messages as maps, convert to json - _channel.sink.add(json.encode(data)); - }); - - _channel.stream.listen((data) { - sendToAnalysisServer.send(json.decode(data as String)); - }); - } -} diff --git a/moor/tools/analyzer_plugin/pubspec.yaml b/moor/tools/analyzer_plugin/pubspec.yaml deleted file mode 100644 index befaa290..00000000 --- a/moor/tools/analyzer_plugin/pubspec.yaml +++ /dev/null @@ -1,18 +0,0 @@ -name: analyzer_load_moor_plugin -version: 1.0.0 -description: This pubspec is a part of moor and determines the version of the moor analyzer to load - -environment: - sdk: '>=2.9.0 <3.0.0' - -dependencies: - moor_generator: ^4.4.1 - web_socket_channel: ^1.0.15 - -# These overrides are only needed when working on the plugin with useDebuggingVariant = false (not recommended) - -#dependency_overrides: -# moor_generator: -# path: /path/to/moor/moor_generator -# sqlparser: -# path: /path/to/moor/sqlparser \ No newline at end of file diff --git a/moor_flutter/.flutter-plugins b/moor_flutter/.flutter-plugins deleted file mode 100644 index 3e4cc2a8..00000000 --- a/moor_flutter/.flutter-plugins +++ /dev/null @@ -1 +0,0 @@ -sqflite=/home/simon/Android/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.1.0/ diff --git a/moor_flutter/.metadata b/moor_flutter/.metadata deleted file mode 100644 index 6209bc9f..00000000 --- a/moor_flutter/.metadata +++ /dev/null @@ -1,10 +0,0 @@ -# This file tracks properties of this Flutter project. -# Used by Flutter tool to assess capabilities and perform upgrades etc. -# -# This file should be version controlled and should not be manually edited. - -version: - revision: 5391447fae6209bb21a89e6a5a6583cac1af9b4b - channel: stable - -project_type: package diff --git a/moor_flutter/CHANGELOG.md b/moor_flutter/CHANGELOG.md deleted file mode 100644 index 94bff635..00000000 --- a/moor_flutter/CHANGELOG.md +++ /dev/null @@ -1,145 +0,0 @@ -## 4.1.0 - -- Support query cancellations introduced in moor 4.3.0 -- Clarify that this package has been renamed to `drift`. - -## 4.0.0 - -- Support moor version 4 -- Migrate to null-safety - -## 3.1.0 - -Don't write the schema version to the database if the migration throws an exception. - -## 3.0.0 - -Support `moor` version 3.0. To learn what's new, head over to [its changelog](https://pub.dev/packages/moor). - -## 2.1.1 - -- Fix `runCustom` not using the provided variables ([#406](https://github.com/simolus3/drift/issues/406)) - -## 2.1.0 - -- Expose the underlying database from sqflite in `FlutterQueryExecutor`. - This exists only to make migrations to moor easier. - -## 2.0.0 -See the changelog of [moor](https://pub.dev/packages/moor#-changelog-tab-) for details, -or check out an overview of new features [here](https://drift.simonbinder.eu/v2) - -## 1.7.0 -- Support custom columns via type converters. See the [docs](https://drift.simonbinder.eu/type_converters) -for details on how to use this feature. -- Transactions now roll back when not completed successfully, they also rethrow the exception -to make debugging easier. -- New `backends` api, making it easier to write database drivers that work with moor. Apart from -`moor_flutter`, new experimental backends can be checked out from git: - 1. `encrypted_moor`: An encrypted moor database: https://github.com/simolus3/drift/tree/develop/extras/encryption -- The compiled sql feature is no longer experimental and will stay stable until a major version bump -- New, experimental support for `.moor` files! Instead of declaring your tables in Dart, you can - choose to declare them with sql by writing the `CREATE TABLE` statement in a `.moor` file. - You can then use these tables in the database and with daos by using the `include` parameter - on `@UseMoor` and `@UseDao`. Again, please notice that this is an experimental api and there - might be some hiccups. Please report any issues you run into. - -## 1.6.0 -- Experimental web support! See [the documentation](https://drift.simonbinder.eu/web) for details. -- Make transactions easier to use: Thanks to some Dart async magic, you no longer need to run - queries on the transaction explicitly. This - ```dart - Future deleteCategory(Category category) { - return transaction((t) async { - await t.delete(categories).delete(category); - }); - } - ``` - is now the same as this (notice how we don't have to use the `t.` in front of the delete) - ```dart - Future deleteCategory(Category category) { - return transaction((t) async { - await delete(categories).delete(category); - }); - } - ``` - This makes it much easier to compose operations by extracting them into methods, as you don't - have to worry about not using the `t` parameter. -- Moor now provides syntax sugar for list parameters in compiled custom queries - (`SELECT * FROM entries WHERE id IN ?`) -- Support `COLLATE` expressions. -- Date time columns are now comparable -- The `StringType` now supports arbitrary data from sqlite ([#70](https://github.com/simolus3/drift/pull/70)). - Thanks, [knaeckeKami](https://github.com/knaeckeKami)! -- Bugfixes related to stream queries and `LIMIT` clauses. - -## 1.5.0 -This version introduces some new concepts and features, which are explained in more detail below. -Here is a quick overview of the new features: -- More consistent and reliable callbacks for migrations. You can now use `MigrationStrategy.beforeOpen` -to run queries after migrations, but before fully opening the database. This is useful to initialize data. -- Greatly expanded documentation, introduced additional checks to provide more helpful error messages -- New `getSingle` and `watchSingle` methods on queries: Queries that you know will only - return one row can now be instructed to return the value directly instead of wrapping it in a list. -- New "update companion" classes to clearly separate between absent values and explicitly setting -values back to null - explained below. -- Experimental support for compiled sql queries: __Moor can now generate typesafe APIs for - written sql__. Read on to get started. - -### Update companions -Newly introduced "Update companions" allow you to insert or update data more precisely than before. -Previously, there was no clear separation between "null" and absent values. For instance, let's -say we had a table "users" that stores an id, a name, and an age. Now, let's say we wanted to set -the age of a user to null without changing its name. Would we use `User(age: null)`? Here, -the `name` column would implicitly be set to null, so we can't cleanly separate that. However, -with `UsersCompanion(age: Value(null))`, we know the difference between `Value(null)` and the -default `Value.absent()`. - -Don't worry, all your existing code will continue to work, this change is fully backwards -compatible. You might get analyzer warnings about missing required fields. The migration to -update companions will fix that. Replacing normal classes with their update companions is simple -and the only thing needed to fix that. The [documentation](https://drift.simonbinder.eu/queries/#updates-and-deletes) -has been updated to reflect this. If you have additional questions, feel free to -[create an issue](https://github.com/simolus3/drift/issues/new). -### Compiled sql queries -Experimental support for compile time custom statements. Sounds super boring, but it -actually gives you a fluent way to write queries in pure sql. The moor generator will figure -out what your queries return and automatically generate the boring mapping part. Head on to -[the documentation](https://drift.simonbinder.eu/queries/custom) to find out how to use this new feature. - -Please note that this feature is in an experimental state: Expect minor, but breaking changes -in the API and in the generated code. Also, if you run into any issues with this feature, -[reporting them](https://github.com/simolus3/drift/issues/new) would be super appreciated. - -## 1.4.0 -- Added the `RealColumn`, which stores floating point values -- Better configuration for the serializer with the `JsonKey` annotation and the ability to -use a custom `ValueSerializer`s - -## 1.3.0 -- Moor now supports table joins - - Added table aliases -- Default values for columns: Just use the `withDefault` method when declaring a column - - added expressions that resolve to the current date or time -- Fixed a crash that would occur if the first operation was a transaction -- Better support for custom expressions as part of a regular query -- Faster hashcode implementation in generated data classes - -## 1.2.0 -Changes from the moor and moor_generator libraries: -- __Breaking__: Generated DAO classes are now called `_$YourNameHere`, it used to -be just `_YourNameHere` (without the dollar sign) -- Blob data type -- `insertOrReplace` method for insert statements -- DAOs can now operate on transactions -- Custom constraints -- Query streams are now cached so that equal queries yield identical streams. - This can improve performance. -- Generated classes now use lazy getters instead of recalculating fields on each access -- Data classes can be converted from and to json - -## 1.1.0 -- Transactions - -## 1.0.0 -- Initial release diff --git a/moor_flutter/LICENSE b/moor_flutter/LICENSE deleted file mode 100644 index e4b21941..00000000 --- a/moor_flutter/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2019 Simon Binder - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/moor_flutter/README.md b/moor_flutter/README.md deleted file mode 100644 index 70761ac5..00000000 --- a/moor_flutter/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# `moor_flutter` - -__Important notice__: Moor has been renamed to Drift. -This package will continue to be supported for a while, but we encourage users to migrate to `drift` and `drift_sqflite`. -Automated tooling to help you make the switch is available! For more information, see [the documentation](https://drift.simonbinder.eu/name/). -Thanks yor your understanding! - -Please see the homepage of [drift](https://drift.simonbinder.eu/) for details on how to use this package. diff --git a/moor_flutter/analysis_options.yaml b/moor_flutter/analysis_options.yaml deleted file mode 100644 index 98d91963..00000000 --- a/moor_flutter/analysis_options.yaml +++ /dev/null @@ -1,175 +0,0 @@ -analyzer: - strong-mode: - implicit-casts: false - errors: - unused_element: error - unused_import: error - unused_local_variable: error - dead_code: error - public_member_api_docs: ignore # turned on by user-facing subpackages - deprecated_member_use_from_same_package: ignore - exclude: - - "**/*.g.dart" - # Will be analyzed anyway, nobody knows why ¯\_(ツ)_/¯. We're only analyzing lib/ and test/ as a workaround - - ".dart_tool/build/entrypoint/build.dart" - - "tool/**" - - "**/*.mocks.dart" - -# this should always include all rules. Those we don't use are commented out -linter: - rules: - # ERROR RULES - - avoid_empty_else - # - avoid_print (all our prints can be turned off) - - avoid_relative_lib_imports - - avoid_returning_null_for_future - # - avoid_slow_async_io - - avoid_types_as_parameter_names - - cancel_subscriptions - - close_sinks - - comment_references - - control_flow_in_finally - # - diagnostic_describe_all_properties (Flutter-specific, not relevant for us) - - empty_statements - - hash_and_equals - # - invariant_booleans (turned off because the lint rule is buggy) - - iterable_contains_unrelated_type - - list_remove_unrelated_type - - literal_only_boolean_expressions - - no_adjacent_strings_in_list - - no_duplicate_case_values - # - prefer_relative_imports (clashes with avoid_relative_lib_imports) - # - prefer_void_to_null (we do use Null as a type for alwaysThrows functions) - - test_types_in_equals - - throw_in_finally - - unnecessary_statements - - unrelated_type_equality_checks - - unsafe_html - - valid_regexps - # STYLE RULES - - always_declare_return_types - # - always_put_control_body_on_new_line (we don't do this if it fits on the same line) - # - always_put_required_named_parameters_first (we just don't do this) - # - always_require_non_null_named_parameters (we don't use assert foo != null for parameters) - # - always_specify_types (we prefer to omit the type parameter when possible) - - annotate_overrides - # - avoid_annotating_with_dynamic (we prefer to make dynamic explicit) - # - avoid_as (we prefer to make explicit casts explicit!) - - avoid_bool_literals_in_conditional_expressions - # - avoid_catches_without_on_clauses (we have a lot of generic catches) - - avoid_catching_errors - - avoid_classes_with_only_static_members - - avoid_double_and_int_checks - # - avoid_equals_and_hash_code_on_mutable_classes (lint is to generic for transient fields) - - avoid_field_initializers_in_const_classes - - avoid_function_literals_in_foreach_calls - # - avoid_implementing_value_types (maybe we can consider turning this on?) - - avoid_init_to_null - - avoid_js_rounded_ints - - avoid_null_checks_in_equality_operators - # - avoid_positional_boolean_parameters (there pretty useful when there's only one boolean param) - # - avoid_private_typedef_functions (they're still useful) - - avoid_renaming_method_parameters - - avoid_return_types_on_setters - - avoid_returning_null - - avoid_returning_null_for_void - - avoid_returning_this - - avoid_setters_without_getters - - avoid_shadowing_type_parameters - - avoid_single_cascade_in_expression_statements - # - avoid_types_on_closure_parameters (the interference isn't THAT good) - # - avoid_unnecessary_containers (Flutter-specific, not relevant here) - - avoid_unused_constructor_parameters - - avoid_void_async - - await_only_futures - - camel_case_extensions - - camel_case_types - # - cascade_invocations (sometimes the explicit notation is more readable) - - constant_identifier_names - - curly_braces_in_flow_control_structures - - directives_ordering - - empty_catches - - empty_constructor_bodies - - file_names - # - flutter_style_todos (Flutter-development specific, not relevant here) - - implementation_imports - - join_return_with_assignment - - library_names - - library_prefixes - - lines_longer_than_80_chars - - non_constant_identifier_names - - null_closures - - omit_local_variable_types - # - one_member_abstracts (there are cases where a one-member abstract class makes sense, see moor's Insertable) - - only_throw_errors - - overridden_fields - - package_api_docs - # - package_prefixed_library_names (this isn't java) - # - parameter_assignments (we regularly use this to set default values) - - prefer_adjacent_string_concatenation - - prefer_asserts_in_initializer_lists - # - prefer_asserts_with_message (it's annoying to write messages for internal invariants) - - prefer_collection_literals - - prefer_conditional_assignment - - prefer_const_constructors - - prefer_const_constructors_in_immutables - - prefer_const_declarations - - prefer_const_literals_to_create_immutables - - prefer_constructors_over_static_methods - - prefer_contains - # - prefer_double_quotes (we prefer single quotes) - - prefer_equal_for_default_values - # - prefer_expression_function_bodies (for multiline expressions, this is ugly to format) - - prefer_final_fields - - prefer_final_in_for_each - - prefer_final_locals - - prefer_for_elements_to_map_fromIterable - - prefer_foreach - - prefer_function_declarations_over_variables - - prefer_generic_function_type_aliases - - prefer_if_elements_to_conditional_expressions - - prefer_if_null_operators - - prefer_initializing_formals - - prefer_inlined_adds - - prefer_int_literals - - prefer_interpolation_to_compose_strings - - prefer_is_empty - - prefer_is_not_empty - - prefer_is_not_operator - - prefer_iterable_whereType - # - prefer_mixin (todo we could consider enabling this) - - prefer_null_aware_operators - - prefer_single_quotes - - prefer_spread_collections - - prefer_typing_uninitialized_variables - - provide_deprecation_message - - public_member_api_docs - - recursive_getters - - slash_for_doc_comments - # - sort_child_properties_last (Flutter specific) - # - sort_constructors_first (we don't do this) - # - sort_unnamed_constructors_first - - type_annotate_public_apis - - type_init_formals - - unawaited_futures - - unnecessary_brace_in_string_interps - - unnecessary_const - # - unnecessary_final (we prefer final here) - - unnecessary_getters_setters - - unnecessary_lambdas - - unnecessary_new - - unnecessary_null_aware_assignments - - unnecessary_null_in_if_null_operators - - unnecessary_overrides - - unnecessary_parenthesis - - unnecessary_this - # - use_full_hex_values_for_flutter_colors (Flutter specific) - - use_function_type_syntax_for_parameters - - use_rethrow_when_possible - - use_setters_to_change_properties - - use_string_buffers - # - use_to_and_as_if_applicable (false positive on operators) - - void_checks - # PUB RULES - - package_names -# - sort_pub_dependencies (we prefer to group them by what they do) \ No newline at end of file diff --git a/moor_flutter/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/moor_flutter/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java deleted file mode 100644 index aff2f141..00000000 --- a/moor_flutter/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java +++ /dev/null @@ -1,25 +0,0 @@ -package io.flutter.plugins; - -import io.flutter.plugin.common.PluginRegistry; -import com.tekartik.sqflite.SqflitePlugin; - -/** - * Generated file. Do not edit. - */ -public final class GeneratedPluginRegistrant { - public static void registerWith(PluginRegistry registry) { - if (alreadyRegisteredWith(registry)) { - return; - } - SqflitePlugin.registerWith(registry.registrarFor("com.tekartik.sqflite.SqflitePlugin")); - } - - private static boolean alreadyRegisteredWith(PluginRegistry registry) { - final String key = GeneratedPluginRegistrant.class.getCanonicalName(); - if (registry.hasPlugin(key)) { - return true; - } - registry.registrarFor(key); - return false; - } -} diff --git a/moor_flutter/example/.gitignore b/moor_flutter/example/.gitignore deleted file mode 100644 index 47e0b4d6..00000000 --- a/moor_flutter/example/.gitignore +++ /dev/null @@ -1,71 +0,0 @@ -# Miscellaneous -*.class -*.lock -*.log -*.pyc -*.swp -.DS_Store -.atom/ -.buildlog/ -.history -.svn/ - -# IntelliJ related -*.iml -*.ipr -*.iws -.idea/ - -# Visual Studio Code related -.vscode/ - -# Flutter/Dart/Pub related -**/doc/api/ -.dart_tool/ -.flutter-plugins -.packages -.pub-cache/ -.pub/ -build/ - -# Android related -**/android/**/gradle-wrapper.jar -**/android/.gradle -**/android/captures/ -**/android/gradlew -**/android/gradlew.bat -**/android/local.properties -**/android/**/GeneratedPluginRegistrant.java - -# iOS/XCode related -**/ios/**/*.mode1v3 -**/ios/**/*.mode2v3 -**/ios/**/*.moved-aside -**/ios/**/*.pbxuser -**/ios/**/*.perspectivev3 -**/ios/**/*sync/ -**/ios/**/.sconsign.dblite -**/ios/**/.tags* -**/ios/**/.vagrant/ -**/ios/**/DerivedData/ -**/ios/**/Icon? -**/ios/**/Pods/ -**/ios/**/.symlinks/ -**/ios/**/profile -**/ios/**/xcuserdata -**/ios/.generated/ -**/ios/Flutter/App.framework -**/ios/Flutter/Flutter.framework -**/ios/Flutter/Generated.xcconfig -**/ios/Flutter/app.flx -**/ios/Flutter/app.zip -**/ios/Flutter/flutter_assets/ -**/ios/ServiceDefinitions.json -**/ios/Runner/GeneratedPluginRegistrant.* - -# Exceptions to above rules. -!**/ios/**/default.mode1v3 -!**/ios/**/default.mode2v3 -!**/ios/**/default.pbxuser -!**/ios/**/default.perspectivev3 -!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages diff --git a/moor_flutter/example/.metadata b/moor_flutter/example/.metadata deleted file mode 100644 index 460bc20b..00000000 --- a/moor_flutter/example/.metadata +++ /dev/null @@ -1,10 +0,0 @@ -# This file tracks properties of this Flutter project. -# Used by Flutter tool to assess capabilities and perform upgrades etc. -# -# This file should be version controlled and should not be manually edited. - -version: - revision: 5391447fae6209bb21a89e6a5a6583cac1af9b4b - channel: stable - -project_type: app diff --git a/moor_flutter/example/android/app/build.gradle b/moor_flutter/example/android/app/build.gradle deleted file mode 100644 index ad1ba37a..00000000 --- a/moor_flutter/example/android/app/build.gradle +++ /dev/null @@ -1,68 +0,0 @@ -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - -android { - compileSdkVersion 30 - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = '1.8' - } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - - defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "eu.simonbinder.moor_example.example" - minSdkVersion 16 - targetSdkVersion 30 - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig signingConfigs.debug - } - } -} - -flutter { - source '../..' -} - -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" -} diff --git a/moor_flutter/example/android/app/src/debug/AndroidManifest.xml b/moor_flutter/example/android/app/src/debug/AndroidManifest.xml deleted file mode 100644 index 38643255..00000000 --- a/moor_flutter/example/android/app/src/debug/AndroidManifest.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - diff --git a/moor_flutter/example/android/app/src/main/AndroidManifest.xml b/moor_flutter/example/android/app/src/main/AndroidManifest.xml deleted file mode 100644 index 1c658d0b..00000000 --- a/moor_flutter/example/android/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/moor_flutter/example/android/app/src/main/kotlin/eu/simonbinder/moor_example/example/MainActivity.kt b/moor_flutter/example/android/app/src/main/kotlin/eu/simonbinder/moor_example/example/MainActivity.kt deleted file mode 100644 index 83e65892..00000000 --- a/moor_flutter/example/android/app/src/main/kotlin/eu/simonbinder/moor_example/example/MainActivity.kt +++ /dev/null @@ -1,6 +0,0 @@ -package eu.simonbinder.moor_example.example - -import io.flutter.embedding.android.FlutterActivity - -class MainActivity: FlutterActivity() { -} diff --git a/moor_flutter/example/android/app/src/main/res/drawable-v21/launch_background.xml b/moor_flutter/example/android/app/src/main/res/drawable-v21/launch_background.xml deleted file mode 100644 index f74085f3..00000000 --- a/moor_flutter/example/android/app/src/main/res/drawable-v21/launch_background.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - diff --git a/moor_flutter/example/android/app/src/main/res/drawable/launch_background.xml b/moor_flutter/example/android/app/src/main/res/drawable/launch_background.xml deleted file mode 100644 index 304732f8..00000000 --- a/moor_flutter/example/android/app/src/main/res/drawable/launch_background.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - diff --git a/moor_flutter/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/moor_flutter/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index db77bb4b..00000000 Binary files a/moor_flutter/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/moor_flutter/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/moor_flutter/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index 17987b79..00000000 Binary files a/moor_flutter/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/moor_flutter/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/moor_flutter/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index 09d43914..00000000 Binary files a/moor_flutter/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/moor_flutter/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/moor_flutter/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index d5f1c8d3..00000000 Binary files a/moor_flutter/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/moor_flutter/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/moor_flutter/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index 4d6372ee..00000000 Binary files a/moor_flutter/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/moor_flutter/example/android/app/src/main/res/values-night/styles.xml b/moor_flutter/example/android/app/src/main/res/values-night/styles.xml deleted file mode 100644 index 449a9f93..00000000 --- a/moor_flutter/example/android/app/src/main/res/values-night/styles.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - diff --git a/moor_flutter/example/android/app/src/main/res/values/styles.xml b/moor_flutter/example/android/app/src/main/res/values/styles.xml deleted file mode 100644 index d74aa35c..00000000 --- a/moor_flutter/example/android/app/src/main/res/values/styles.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - diff --git a/moor_flutter/example/android/app/src/profile/AndroidManifest.xml b/moor_flutter/example/android/app/src/profile/AndroidManifest.xml deleted file mode 100644 index 38643255..00000000 --- a/moor_flutter/example/android/app/src/profile/AndroidManifest.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - diff --git a/moor_flutter/example/android/build.gradle b/moor_flutter/example/android/build.gradle deleted file mode 100644 index ed45c658..00000000 --- a/moor_flutter/example/android/build.gradle +++ /dev/null @@ -1,29 +0,0 @@ -buildscript { - ext.kotlin_version = '1.3.50' - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:4.1.0' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - -allprojects { - repositories { - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" - project.evaluationDependsOn(':app') -} - -task clean(type: Delete) { - delete rootProject.buildDir -} diff --git a/moor_flutter/example/android/gradle.properties b/moor_flutter/example/android/gradle.properties deleted file mode 100644 index 94adc3a3..00000000 --- a/moor_flutter/example/android/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -org.gradle.jvmargs=-Xmx1536M -android.useAndroidX=true -android.enableJetifier=true diff --git a/moor_flutter/example/android/gradle/wrapper/gradle-wrapper.properties b/moor_flutter/example/android/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 595fb867..00000000 --- a/moor_flutter/example/android/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Fri Jun 23 08:50:38 CEST 2017 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip diff --git a/moor_flutter/example/android/settings.gradle b/moor_flutter/example/android/settings.gradle deleted file mode 100644 index 44e62bcf..00000000 --- a/moor_flutter/example/android/settings.gradle +++ /dev/null @@ -1,11 +0,0 @@ -include ':app' - -def localPropertiesFile = new File(rootProject.projectDir, "local.properties") -def properties = new Properties() - -assert localPropertiesFile.exists() -localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } - -def flutterSdkPath = properties.getProperty("flutter.sdk") -assert flutterSdkPath != null, "flutter.sdk not set in local.properties" -apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" diff --git a/moor_flutter/example/build.yaml b/moor_flutter/example/build.yaml deleted file mode 100644 index 41580a28..00000000 --- a/moor_flutter/example/build.yaml +++ /dev/null @@ -1,6 +0,0 @@ -targets: - $default: - builders: - moor_generator: - options: - compact_query_methods: true \ No newline at end of file diff --git a/moor_flutter/example/ios/Flutter/AppFrameworkInfo.plist b/moor_flutter/example/ios/Flutter/AppFrameworkInfo.plist deleted file mode 100644 index 9367d483..00000000 --- a/moor_flutter/example/ios/Flutter/AppFrameworkInfo.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - App - CFBundleIdentifier - io.flutter.flutter.app - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - App - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1.0 - MinimumOSVersion - 8.0 - - diff --git a/moor_flutter/example/ios/Flutter/Debug.xcconfig b/moor_flutter/example/ios/Flutter/Debug.xcconfig deleted file mode 100644 index 592ceee8..00000000 --- a/moor_flutter/example/ios/Flutter/Debug.xcconfig +++ /dev/null @@ -1 +0,0 @@ -#include "Generated.xcconfig" diff --git a/moor_flutter/example/ios/Flutter/Release.xcconfig b/moor_flutter/example/ios/Flutter/Release.xcconfig deleted file mode 100644 index 592ceee8..00000000 --- a/moor_flutter/example/ios/Flutter/Release.xcconfig +++ /dev/null @@ -1 +0,0 @@ -#include "Generated.xcconfig" diff --git a/moor_flutter/example/ios/Runner.xcodeproj/project.pbxproj b/moor_flutter/example/ios/Runner.xcodeproj/project.pbxproj deleted file mode 100644 index 374bf0e0..00000000 --- a/moor_flutter/example/ios/Runner.xcodeproj/project.pbxproj +++ /dev/null @@ -1,518 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; - 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; }; - 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; - 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; - 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; - 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; - 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; - 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; - 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; - 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 9705A1C41CF9048500538489 /* Embed Frameworks */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, - 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, - ); - name = "Embed Frameworks"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; - 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; - 2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; }; - 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; - 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; - 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; - 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; - 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; - 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; - 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; - 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 97C146EB1CF9000F007C117D /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, - 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 9740EEB11CF90186004384FC /* Flutter */ = { - isa = PBXGroup; - children = ( - 2D5378251FAA1A9400D5DBA9 /* flutter_assets */, - 3B80C3931E831B6300D905FE /* App.framework */, - 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, - 9740EEBA1CF902C7004384FC /* Flutter.framework */, - 9740EEB21CF90195004384FC /* Debug.xcconfig */, - 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, - 9740EEB31CF90195004384FC /* Generated.xcconfig */, - ); - name = Flutter; - sourceTree = ""; - }; - 97C146E51CF9000F007C117D = { - isa = PBXGroup; - children = ( - 9740EEB11CF90186004384FC /* Flutter */, - 97C146F01CF9000F007C117D /* Runner */, - 97C146EF1CF9000F007C117D /* Products */, - ); - sourceTree = ""; - }; - 97C146EF1CF9000F007C117D /* Products */ = { - isa = PBXGroup; - children = ( - 97C146EE1CF9000F007C117D /* Runner.app */, - ); - name = Products; - sourceTree = ""; - }; - 97C146F01CF9000F007C117D /* Runner */ = { - isa = PBXGroup; - children = ( - 97C146FA1CF9000F007C117D /* Main.storyboard */, - 97C146FD1CF9000F007C117D /* Assets.xcassets */, - 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, - 97C147021CF9000F007C117D /* Info.plist */, - 97C146F11CF9000F007C117D /* Supporting Files */, - 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, - 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, - 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, - 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, - ); - path = Runner; - sourceTree = ""; - }; - 97C146F11CF9000F007C117D /* Supporting Files */ = { - isa = PBXGroup; - children = ( - ); - name = "Supporting Files"; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 97C146ED1CF9000F007C117D /* Runner */ = { - isa = PBXNativeTarget; - buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; - buildPhases = ( - 9740EEB61CF901F6004384FC /* Run Script */, - 97C146EA1CF9000F007C117D /* Sources */, - 97C146EB1CF9000F007C117D /* Frameworks */, - 97C146EC1CF9000F007C117D /* Resources */, - 9705A1C41CF9048500538489 /* Embed Frameworks */, - 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Runner; - productName = Runner; - productReference = 97C146EE1CF9000F007C117D /* Runner.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 97C146E61CF9000F007C117D /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0910; - ORGANIZATIONNAME = "The Chromium Authors"; - TargetAttributes = { - 97C146ED1CF9000F007C117D = { - CreatedOnToolsVersion = 7.3.1; - LastSwiftMigration = 0910; - }; - }; - }; - buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 97C146E51CF9000F007C117D; - productRefGroup = 97C146EF1CF9000F007C117D /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 97C146ED1CF9000F007C117D /* Runner */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 97C146EC1CF9000F007C117D /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, - 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, - 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, - 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, - 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */, - 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Thin Binary"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; - }; - 9740EEB61CF901F6004384FC /* Run Script */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Run Script"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 97C146EA1CF9000F007C117D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, - 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - 97C146FA1CF9000F007C117D /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 97C146FB1CF9000F007C117D /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; - 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 97C147001CF9000F007C117D /* Base */, - ); - name = LaunchScreen.storyboard; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 249021D3217E4FDB00AE95B9 /* Profile */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Profile; - }; - 249021D4217E4FDB00AE95B9 /* Profile */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = S8QB4VV633; - ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - PRODUCT_BUNDLE_IDENTIFIER = eu.simonbinder.moor_example.moorExample; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Profile; - }; - 97C147031CF9000F007C117D /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 97C147041CF9000F007C117D /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 97C147061CF9000F007C117D /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - PRODUCT_BUNDLE_IDENTIFIER = eu.simonbinder.moor_example.moorExample; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_SWIFT3_OBJC_INFERENCE = On; - SWIFT_VERSION = 4.0; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Debug; - }; - 97C147071CF9000F007C117D /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - PRODUCT_BUNDLE_IDENTIFIER = eu.simonbinder.moor_example.moorExample; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; - SWIFT_SWIFT3_OBJC_INFERENCE = On; - SWIFT_VERSION = 4.0; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 97C147031CF9000F007C117D /* Debug */, - 97C147041CF9000F007C117D /* Release */, - 249021D3217E4FDB00AE95B9 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 97C147061CF9000F007C117D /* Debug */, - 97C147071CF9000F007C117D /* Release */, - 249021D4217E4FDB00AE95B9 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - - }; - rootObject = 97C146E61CF9000F007C117D /* Project object */; -} diff --git a/moor_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/moor_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 1d526a16..00000000 --- a/moor_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/moor_flutter/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/moor_flutter/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme deleted file mode 100644 index 786d6aad..00000000 --- a/moor_flutter/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/moor_flutter/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/moor_flutter/example/ios/Runner.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 1d526a16..00000000 --- a/moor_flutter/example/ios/Runner.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/moor_flutter/example/ios/Runner/AppDelegate.swift b/moor_flutter/example/ios/Runner/AppDelegate.swift deleted file mode 100644 index 71cc41e3..00000000 --- a/moor_flutter/example/ios/Runner/AppDelegate.swift +++ /dev/null @@ -1,13 +0,0 @@ -import UIKit -import Flutter - -@UIApplicationMain -@objc class AppDelegate: FlutterAppDelegate { - override func application( - _ application: UIApplication, - didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]? - ) -> Bool { - GeneratedPluginRegistrant.register(with: self) - return super.application(application, didFinishLaunchingWithOptions: launchOptions) - } -} diff --git a/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index d36b1fab..00000000 --- a/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,122 +0,0 @@ -{ - "images" : [ - { - "size" : "20x20", - "idiom" : "iphone", - "filename" : "Icon-App-20x20@2x.png", - "scale" : "2x" - }, - { - "size" : "20x20", - "idiom" : "iphone", - "filename" : "Icon-App-20x20@3x.png", - "scale" : "3x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "Icon-App-29x29@1x.png", - "scale" : "1x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "Icon-App-29x29@2x.png", - "scale" : "2x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "Icon-App-29x29@3x.png", - "scale" : "3x" - }, - { - "size" : "40x40", - "idiom" : "iphone", - "filename" : "Icon-App-40x40@2x.png", - "scale" : "2x" - }, - { - "size" : "40x40", - "idiom" : "iphone", - "filename" : "Icon-App-40x40@3x.png", - "scale" : "3x" - }, - { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "Icon-App-60x60@2x.png", - "scale" : "2x" - }, - { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "Icon-App-60x60@3x.png", - "scale" : "3x" - }, - { - "size" : "20x20", - "idiom" : "ipad", - "filename" : "Icon-App-20x20@1x.png", - "scale" : "1x" - }, - { - "size" : "20x20", - "idiom" : "ipad", - "filename" : "Icon-App-20x20@2x.png", - "scale" : "2x" - }, - { - "size" : "29x29", - "idiom" : "ipad", - "filename" : "Icon-App-29x29@1x.png", - "scale" : "1x" - }, - { - "size" : "29x29", - "idiom" : "ipad", - "filename" : "Icon-App-29x29@2x.png", - "scale" : "2x" - }, - { - "size" : "40x40", - "idiom" : "ipad", - "filename" : "Icon-App-40x40@1x.png", - "scale" : "1x" - }, - { - "size" : "40x40", - "idiom" : "ipad", - "filename" : "Icon-App-40x40@2x.png", - "scale" : "2x" - }, - { - "size" : "76x76", - "idiom" : "ipad", - "filename" : "Icon-App-76x76@1x.png", - "scale" : "1x" - }, - { - "size" : "76x76", - "idiom" : "ipad", - "filename" : "Icon-App-76x76@2x.png", - "scale" : "2x" - }, - { - "size" : "83.5x83.5", - "idiom" : "ipad", - "filename" : "Icon-App-83.5x83.5@2x.png", - "scale" : "2x" - }, - { - "size" : "1024x1024", - "idiom" : "ios-marketing", - "filename" : "Icon-App-1024x1024@1x.png", - "scale" : "1x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} diff --git a/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png deleted file mode 100644 index 3d43d11e..00000000 Binary files a/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png and /dev/null differ diff --git a/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png deleted file mode 100644 index 28c6bf03..00000000 Binary files a/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png and /dev/null differ diff --git a/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png deleted file mode 100644 index 2ccbfd96..00000000 Binary files a/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png and /dev/null differ diff --git a/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png deleted file mode 100644 index f091b6b0..00000000 Binary files a/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png and /dev/null differ diff --git a/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png deleted file mode 100644 index 4cde1211..00000000 Binary files a/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png and /dev/null differ diff --git a/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png deleted file mode 100644 index d0ef06e7..00000000 Binary files a/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png and /dev/null differ diff --git a/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png deleted file mode 100644 index dcdc2306..00000000 Binary files a/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png and /dev/null differ diff --git a/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png deleted file mode 100644 index 2ccbfd96..00000000 Binary files a/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png and /dev/null differ diff --git a/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png deleted file mode 100644 index c8f9ed8f..00000000 Binary files a/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png and /dev/null differ diff --git a/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png deleted file mode 100644 index a6d6b860..00000000 Binary files a/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png and /dev/null differ diff --git a/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png deleted file mode 100644 index a6d6b860..00000000 Binary files a/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png and /dev/null differ diff --git a/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png deleted file mode 100644 index 75b2d164..00000000 Binary files a/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png and /dev/null differ diff --git a/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png deleted file mode 100644 index c4df70d3..00000000 Binary files a/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png and /dev/null differ diff --git a/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png deleted file mode 100644 index 6a84f41e..00000000 Binary files a/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png and /dev/null differ diff --git a/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png deleted file mode 100644 index d0e1f585..00000000 Binary files a/moor_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png and /dev/null differ diff --git a/moor_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/moor_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json deleted file mode 100644 index 0bedcf2f..00000000 --- a/moor_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "LaunchImage.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "LaunchImage@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "LaunchImage@3x.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} diff --git a/moor_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/moor_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png deleted file mode 100644 index 9da19eac..00000000 Binary files a/moor_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png and /dev/null differ diff --git a/moor_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/moor_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png deleted file mode 100644 index 9da19eac..00000000 Binary files a/moor_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png and /dev/null differ diff --git a/moor_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/moor_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png deleted file mode 100644 index 9da19eac..00000000 Binary files a/moor_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png and /dev/null differ diff --git a/moor_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/moor_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md deleted file mode 100644 index 89c2725b..00000000 --- a/moor_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Launch Screen Assets - -You can customize the launch screen with your own desired assets by replacing the image files in this directory. - -You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/moor_flutter/example/ios/Runner/Base.lproj/LaunchScreen.storyboard b/moor_flutter/example/ios/Runner/Base.lproj/LaunchScreen.storyboard deleted file mode 100644 index f2e259c7..00000000 --- a/moor_flutter/example/ios/Runner/Base.lproj/LaunchScreen.storyboard +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/moor_flutter/example/ios/Runner/Base.lproj/Main.storyboard b/moor_flutter/example/ios/Runner/Base.lproj/Main.storyboard deleted file mode 100644 index f3c28516..00000000 --- a/moor_flutter/example/ios/Runner/Base.lproj/Main.storyboard +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/moor_flutter/example/ios/Runner/Info.plist b/moor_flutter/example/ios/Runner/Info.plist deleted file mode 100644 index e17d9d4e..00000000 --- a/moor_flutter/example/ios/Runner/Info.plist +++ /dev/null @@ -1,45 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - moor_example - CFBundlePackageType - APPL - CFBundleShortVersionString - $(FLUTTER_BUILD_NAME) - CFBundleSignature - ???? - CFBundleVersion - $(FLUTTER_BUILD_NUMBER) - LSRequiresIPhoneOS - - UILaunchStoryboardName - LaunchScreen - UIMainStoryboardFile - Main - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UIViewControllerBasedStatusBarAppearance - - - diff --git a/moor_flutter/example/ios/Runner/Runner-Bridging-Header.h b/moor_flutter/example/ios/Runner/Runner-Bridging-Header.h deleted file mode 100644 index 7335fdf9..00000000 --- a/moor_flutter/example/ios/Runner/Runner-Bridging-Header.h +++ /dev/null @@ -1 +0,0 @@ -#import "GeneratedPluginRegistrant.h" \ No newline at end of file diff --git a/moor_flutter/example/lib/bloc.dart b/moor_flutter/example/lib/bloc.dart deleted file mode 100644 index f748970e..00000000 --- a/moor_flutter/example/lib/bloc.dart +++ /dev/null @@ -1,91 +0,0 @@ -import 'package:moor_example/database/database.dart'; -import 'package:moor_flutter/moor_flutter.dart'; -import 'package:rxdart/rxdart.dart'; - -/// Class that keeps information about a category and whether it's selected at -/// the moment. -class CategoryWithActiveInfo { - CategoryWithCount categoryWithCount; - bool isActive; - - CategoryWithActiveInfo(this.categoryWithCount, this.isActive); -} - -class TodoAppBloc { - final Database db; - - // the category that is selected at the moment. null means that we show all - // entries - final BehaviorSubject _activeCategory = - BehaviorSubject.seeded(null); - - late final Stream> _currentEntries; - - /// A stream of entries that should be displayed on the home screen. - Stream> get homeScreenEntries => _currentEntries; - - final BehaviorSubject> _allCategories = - BehaviorSubject(); - Stream> get categories => _allCategories; - - TodoAppBloc() : db = Database() { - // listen for the category to change. Then display all entries that are in - // the current category on the home screen. - _currentEntries = _activeCategory.switchMap(db.watchEntriesInCategory); - - // also watch all categories so that they can be displayed in the navigation - // drawer. - Rx.combineLatest2, Category?, - List>( - db.categoriesWithCount(), - _activeCategory, - (allCategories, selected) { - return allCategories.map((category) { - final isActive = selected?.id == category.category?.id; - - return CategoryWithActiveInfo(category, isActive); - }).toList(); - }, - ).listen(_allCategories.add); - } - - void showCategory(Category? category) { - _activeCategory.add(category); - } - - Future addCategory(String description) async { - final id = await db.createCategory(description); - - showCategory(Category(id: id, description: description)); - } - - void createEntry(String content) { - db.createEntry(TodosCompanion( - content: Value(content), - category: Value(_activeCategory.value?.id), - )); - } - - void updateEntry(TodoEntry entry) { - db.updateEntry(entry); - } - - void deleteEntry(TodoEntry entry) { - db.deleteEntry(entry); - } - - void deleteCategory(Category category) { - // if the category being deleted is the one selected, reset that state by - // showing the entries who aren't in any category - if (_activeCategory.value?.id == category.id) { - showCategory(null); - } - - db.deleteCategory(category); - } - - void close() { - db.close(); - _allCategories.close(); - } -} diff --git a/moor_flutter/example/lib/database/database.dart b/moor_flutter/example/lib/database/database.dart deleted file mode 100644 index d6abe209..00000000 --- a/moor_flutter/example/lib/database/database.dart +++ /dev/null @@ -1,160 +0,0 @@ -import 'dart:async'; -import 'package:moor_flutter/moor_flutter.dart'; - -part 'database.g.dart'; - -@DataClassName('TodoEntry') -class Todos extends Table { - IntColumn get id => integer().autoIncrement()(); - - TextColumn get content => text()(); - - DateTimeColumn get targetDate => dateTime().nullable()(); - - IntColumn get category => integer() - .nullable() - .customConstraint('NULLABLE REFERENCES categories(id)')(); -} - -@DataClassName('Category') -class Categories extends Table { - IntColumn get id => integer().autoIncrement()(); - - TextColumn get description => text().named('desc')(); -} - -class CategoryWithCount { - CategoryWithCount(this.category, this.count); - - // can be null, in which case we count how many entries don't have a category - final Category? category; - final int count; // amount of entries in this category -} - -class EntryWithCategory { - EntryWithCategory(this.entry, this.category); - - final TodoEntry entry; - final Category? category; -} - -@UseMoor( - tables: [Todos, Categories], - queries: { - '_resetCategory': 'UPDATE todos SET category = NULL WHERE category = ?', - '_categoriesWithCount': ''' - SELECT - c.id, - c.desc, - (SELECT COUNT(*) FROM todos WHERE category = c.id) AS amount - FROM categories c - UNION ALL - SELECT null, null, (SELECT COUNT(*) FROM todos WHERE category IS NULL) - ''', - }, -) -class Database extends _$Database { - Database() - : super(FlutterQueryExecutor.inDatabaseFolder( - path: 'db.sqlite', logStatements: true)); - - @override - int get schemaVersion => 2; - - @override - MigrationStrategy get migration { - return MigrationStrategy( - onCreate: (Migrator m) { - return m.createAll(); - }, - onUpgrade: (Migrator m, int from, int to) async { - if (from == 1) { - await m.addColumn(todos, todos.targetDate); - } - }, - beforeOpen: (details) async { - if (details.wasCreated) { - // create default categories and entries - final workId = await into(categories) - .insert(const CategoriesCompanion(description: Value('Work'))); - - await into(todos).insert(TodosCompanion( - content: const Value('A first todo entry'), - targetDate: Value(DateTime.now()), - )); - - await into(todos).insert( - TodosCompanion( - content: const Value('Rework persistence code'), - category: Value(workId), - targetDate: Value( - DateTime.now().add(const Duration(days: 4)), - ), - ), - ); - } - }, - ); - } - - Stream> categoriesWithCount() { - // the _categoriesWithCount method has been generated automatically based - // on the query declared in the @UseMoor annotation - return _categoriesWithCount().map((row) { - final hasId = row.id != null; - final category = - hasId ? Category(id: row.id!, description: row.desc!) : null; - - return CategoryWithCount(category, row.amount); - }).watch(); - } - - /// Watches all entries in the given [category]. If the category is null, all - /// entries will be shown instead. - Stream> watchEntriesInCategory(Category? category) { - final query = select(todos).join( - [leftOuterJoin(categories, categories.id.equalsExp(todos.category))]); - - if (category != null) { - query.where(categories.id.equals(category.id)); - } else { - query.where(categories.id.isNull()); - } - - return query.watch().map((rows) { - // read both the entry and the associated category for each row - return rows.map((row) { - return EntryWithCategory( - row.readTable(todos), - row.readTableOrNull(categories), - ); - }).toList(); - }); - } - - Future createEntry(TodosCompanion entry) { - return into(todos).insert(entry); - } - - /// Updates the row in the database represents this entry by writing the - /// updated data. - Future updateEntry(TodoEntry entry) { - return update(todos).replace(entry); - } - - Future deleteEntry(TodoEntry entry) { - return delete(todos).delete(entry); - } - - Future createCategory(String description) { - return into(categories) - .insert(CategoriesCompanion(description: Value(description))); - } - - Future deleteCategory(Category category) { - return transaction(() async { - await _resetCategory(category.id); - await delete(categories).delete(category); - }); - } -} diff --git a/moor_flutter/example/lib/database/database.g.dart b/moor_flutter/example/lib/database/database.g.dart deleted file mode 100644 index a9ab01e9..00000000 --- a/moor_flutter/example/lib/database/database.g.dart +++ /dev/null @@ -1,474 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'database.dart'; - -// ************************************************************************** -// MoorGenerator -// ************************************************************************** - -// ignore_for_file: unnecessary_brace_in_string_interps, unnecessary_this -class TodoEntry extends DataClass implements Insertable { - final int id; - final String content; - final DateTime? targetDate; - final int? category; - TodoEntry( - {required this.id, - required this.content, - this.targetDate, - this.category}); - factory TodoEntry.fromData(Map data, GeneratedDatabase db, - {String? prefix}) { - final effectivePrefix = prefix ?? ''; - return TodoEntry( - id: const IntType() - .mapFromDatabaseResponse(data['${effectivePrefix}id'])!, - content: const StringType() - .mapFromDatabaseResponse(data['${effectivePrefix}content'])!, - targetDate: const DateTimeType() - .mapFromDatabaseResponse(data['${effectivePrefix}target_date']), - category: const IntType() - .mapFromDatabaseResponse(data['${effectivePrefix}category']), - ); - } - @override - Map toColumns(bool nullToAbsent) { - final map = {}; - map['id'] = Variable(id); - map['content'] = Variable(content); - if (!nullToAbsent || targetDate != null) { - map['target_date'] = Variable(targetDate); - } - if (!nullToAbsent || category != null) { - map['category'] = Variable(category); - } - return map; - } - - TodosCompanion toCompanion(bool nullToAbsent) { - return TodosCompanion( - id: Value(id), - content: Value(content), - targetDate: targetDate == null && nullToAbsent - ? const Value.absent() - : Value(targetDate), - category: category == null && nullToAbsent - ? const Value.absent() - : Value(category), - ); - } - - factory TodoEntry.fromJson(Map json, - {ValueSerializer? serializer}) { - serializer ??= moorRuntimeOptions.defaultSerializer; - return TodoEntry( - id: serializer.fromJson(json['id']), - content: serializer.fromJson(json['content']), - targetDate: serializer.fromJson(json['targetDate']), - category: serializer.fromJson(json['category']), - ); - } - @override - Map toJson({ValueSerializer? serializer}) { - serializer ??= moorRuntimeOptions.defaultSerializer; - return { - 'id': serializer.toJson(id), - 'content': serializer.toJson(content), - 'targetDate': serializer.toJson(targetDate), - 'category': serializer.toJson(category), - }; - } - - TodoEntry copyWith( - {int? id, String? content, DateTime? targetDate, int? category}) => - TodoEntry( - id: id ?? this.id, - content: content ?? this.content, - targetDate: targetDate ?? this.targetDate, - category: category ?? this.category, - ); - @override - String toString() { - return (StringBuffer('TodoEntry(') - ..write('id: $id, ') - ..write('content: $content, ') - ..write('targetDate: $targetDate, ') - ..write('category: $category') - ..write(')')) - .toString(); - } - - @override - int get hashCode => Object.hash(id, content, targetDate, category); - @override - bool operator ==(Object other) => - identical(this, other) || - (other is TodoEntry && - other.id == this.id && - other.content == this.content && - other.targetDate == this.targetDate && - other.category == this.category); -} - -class TodosCompanion extends UpdateCompanion { - final Value id; - final Value content; - final Value targetDate; - final Value category; - const TodosCompanion({ - this.id = const Value.absent(), - this.content = const Value.absent(), - this.targetDate = const Value.absent(), - this.category = const Value.absent(), - }); - TodosCompanion.insert({ - this.id = const Value.absent(), - required String content, - this.targetDate = const Value.absent(), - this.category = const Value.absent(), - }) : content = Value(content); - static Insertable custom({ - Expression? id, - Expression? content, - Expression? targetDate, - Expression? category, - }) { - return RawValuesInsertable({ - if (id != null) 'id': id, - if (content != null) 'content': content, - if (targetDate != null) 'target_date': targetDate, - if (category != null) 'category': category, - }); - } - - TodosCompanion copyWith( - {Value? id, - Value? content, - Value? targetDate, - Value? category}) { - return TodosCompanion( - id: id ?? this.id, - content: content ?? this.content, - targetDate: targetDate ?? this.targetDate, - category: category ?? this.category, - ); - } - - @override - Map toColumns(bool nullToAbsent) { - final map = {}; - if (id.present) { - map['id'] = Variable(id.value); - } - if (content.present) { - map['content'] = Variable(content.value); - } - if (targetDate.present) { - map['target_date'] = Variable(targetDate.value); - } - if (category.present) { - map['category'] = Variable(category.value); - } - return map; - } - - @override - String toString() { - return (StringBuffer('TodosCompanion(') - ..write('id: $id, ') - ..write('content: $content, ') - ..write('targetDate: $targetDate, ') - ..write('category: $category') - ..write(')')) - .toString(); - } -} - -class $TodosTable extends Todos with TableInfo<$TodosTable, TodoEntry> { - final GeneratedDatabase _db; - final String? _alias; - $TodosTable(this._db, [this._alias]); - final VerificationMeta _idMeta = const VerificationMeta('id'); - late final GeneratedColumn id = GeneratedColumn( - 'id', aliasedName, false, - typeName: 'INTEGER', - requiredDuringInsert: false, - defaultConstraints: 'PRIMARY KEY AUTOINCREMENT'); - final VerificationMeta _contentMeta = const VerificationMeta('content'); - late final GeneratedColumn content = GeneratedColumn( - 'content', aliasedName, false, - typeName: 'TEXT', requiredDuringInsert: true); - final VerificationMeta _targetDateMeta = const VerificationMeta('targetDate'); - late final GeneratedColumn targetDate = GeneratedColumn( - 'target_date', aliasedName, true, - typeName: 'INTEGER', requiredDuringInsert: false); - final VerificationMeta _categoryMeta = const VerificationMeta('category'); - late final GeneratedColumn category = GeneratedColumn( - 'category', aliasedName, true, - typeName: 'INTEGER', - requiredDuringInsert: false, - $customConstraints: 'NULLABLE REFERENCES categories(id)'); - @override - List get $columns => [id, content, targetDate, category]; - @override - String get aliasedName => _alias ?? 'todos'; - @override - String get actualTableName => 'todos'; - @override - VerificationContext validateIntegrity(Insertable instance, - {bool isInserting = false}) { - final context = VerificationContext(); - final data = instance.toColumns(true); - if (data.containsKey('id')) { - context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); - } - if (data.containsKey('content')) { - context.handle(_contentMeta, - content.isAcceptableOrUnknown(data['content']!, _contentMeta)); - } else if (isInserting) { - context.missing(_contentMeta); - } - if (data.containsKey('target_date')) { - context.handle( - _targetDateMeta, - targetDate.isAcceptableOrUnknown( - data['target_date']!, _targetDateMeta)); - } - if (data.containsKey('category')) { - context.handle(_categoryMeta, - category.isAcceptableOrUnknown(data['category']!, _categoryMeta)); - } - return context; - } - - @override - Set get $primaryKey => {id}; - @override - TodoEntry map(Map data, {String? tablePrefix}) { - return TodoEntry.fromData(data, _db, - prefix: tablePrefix != null ? '$tablePrefix.' : null); - } - - @override - $TodosTable createAlias(String alias) { - return $TodosTable(_db, alias); - } -} - -class Category extends DataClass implements Insertable { - final int id; - final String description; - Category({required this.id, required this.description}); - factory Category.fromData(Map data, GeneratedDatabase db, - {String? prefix}) { - final effectivePrefix = prefix ?? ''; - return Category( - id: const IntType() - .mapFromDatabaseResponse(data['${effectivePrefix}id'])!, - description: const StringType() - .mapFromDatabaseResponse(data['${effectivePrefix}desc'])!, - ); - } - @override - Map toColumns(bool nullToAbsent) { - final map = {}; - map['id'] = Variable(id); - map['desc'] = Variable(description); - return map; - } - - CategoriesCompanion toCompanion(bool nullToAbsent) { - return CategoriesCompanion( - id: Value(id), - description: Value(description), - ); - } - - factory Category.fromJson(Map json, - {ValueSerializer? serializer}) { - serializer ??= moorRuntimeOptions.defaultSerializer; - return Category( - id: serializer.fromJson(json['id']), - description: serializer.fromJson(json['description']), - ); - } - @override - Map toJson({ValueSerializer? serializer}) { - serializer ??= moorRuntimeOptions.defaultSerializer; - return { - 'id': serializer.toJson(id), - 'description': serializer.toJson(description), - }; - } - - Category copyWith({int? id, String? description}) => Category( - id: id ?? this.id, - description: description ?? this.description, - ); - @override - String toString() { - return (StringBuffer('Category(') - ..write('id: $id, ') - ..write('description: $description') - ..write(')')) - .toString(); - } - - @override - int get hashCode => Object.hash(id, description); - @override - bool operator ==(Object other) => - identical(this, other) || - (other is Category && - other.id == this.id && - other.description == this.description); -} - -class CategoriesCompanion extends UpdateCompanion { - final Value id; - final Value description; - const CategoriesCompanion({ - this.id = const Value.absent(), - this.description = const Value.absent(), - }); - CategoriesCompanion.insert({ - this.id = const Value.absent(), - required String description, - }) : description = Value(description); - static Insertable custom({ - Expression? id, - Expression? description, - }) { - return RawValuesInsertable({ - if (id != null) 'id': id, - if (description != null) 'desc': description, - }); - } - - CategoriesCompanion copyWith({Value? id, Value? description}) { - return CategoriesCompanion( - id: id ?? this.id, - description: description ?? this.description, - ); - } - - @override - Map toColumns(bool nullToAbsent) { - final map = {}; - if (id.present) { - map['id'] = Variable(id.value); - } - if (description.present) { - map['desc'] = Variable(description.value); - } - return map; - } - - @override - String toString() { - return (StringBuffer('CategoriesCompanion(') - ..write('id: $id, ') - ..write('description: $description') - ..write(')')) - .toString(); - } -} - -class $CategoriesTable extends Categories - with TableInfo<$CategoriesTable, Category> { - final GeneratedDatabase _db; - final String? _alias; - $CategoriesTable(this._db, [this._alias]); - final VerificationMeta _idMeta = const VerificationMeta('id'); - late final GeneratedColumn id = GeneratedColumn( - 'id', aliasedName, false, - typeName: 'INTEGER', - requiredDuringInsert: false, - defaultConstraints: 'PRIMARY KEY AUTOINCREMENT'); - final VerificationMeta _descriptionMeta = - const VerificationMeta('description'); - late final GeneratedColumn description = GeneratedColumn( - 'desc', aliasedName, false, - typeName: 'TEXT', requiredDuringInsert: true); - @override - List get $columns => [id, description]; - @override - String get aliasedName => _alias ?? 'categories'; - @override - String get actualTableName => 'categories'; - @override - VerificationContext validateIntegrity(Insertable instance, - {bool isInserting = false}) { - final context = VerificationContext(); - final data = instance.toColumns(true); - if (data.containsKey('id')) { - context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); - } - if (data.containsKey('desc')) { - context.handle(_descriptionMeta, - description.isAcceptableOrUnknown(data['desc']!, _descriptionMeta)); - } else if (isInserting) { - context.missing(_descriptionMeta); - } - return context; - } - - @override - Set get $primaryKey => {id}; - @override - Category map(Map data, {String? tablePrefix}) { - return Category.fromData(data, _db, - prefix: tablePrefix != null ? '$tablePrefix.' : null); - } - - @override - $CategoriesTable createAlias(String alias) { - return $CategoriesTable(_db, alias); - } -} - -abstract class _$Database extends GeneratedDatabase { - _$Database(QueryExecutor e) : super(SqlTypeSystem.defaultInstance, e); - late final $TodosTable todos = $TodosTable(this); - late final $CategoriesTable categories = $CategoriesTable(this); - Future _resetCategory(int? var1) { - return customUpdate( - 'UPDATE todos SET category = NULL WHERE category = ?', - variables: [Variable(var1)], - updates: {todos}, - updateKind: UpdateKind.update, - ); - } - - Selectable _categoriesWithCount() { - return customSelect( - 'SELECT\n c.id,\n c.desc,\n (SELECT COUNT(*) FROM todos WHERE category = c.id) AS amount\n FROM categories c\n UNION ALL\n SELECT null, null, (SELECT COUNT(*) FROM todos WHERE category IS NULL)', - variables: [], - readsFrom: { - categories, - todos, - }).map((QueryRow row) { - return CategoriesWithCountResult( - id: row.read('id'), - desc: row.read('desc'), - amount: row.read('amount'), - ); - }); - } - - @override - Iterable get allTables => allSchemaEntities.whereType(); - @override - List get allSchemaEntities => [todos, categories]; -} - -class CategoriesWithCountResult { - final int? id; - final String? desc; - final int amount; - CategoriesWithCountResult({ - this.id, - this.desc, - required this.amount, - }); -} diff --git a/moor_flutter/example/lib/main.dart b/moor_flutter/example/lib/main.dart deleted file mode 100644 index dbf584e5..00000000 --- a/moor_flutter/example/lib/main.dart +++ /dev/null @@ -1,24 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:moor_example/bloc.dart'; -import 'package:provider/provider.dart'; -import 'widgets/homescreen.dart'; - -void main() => runApp(MyApp()); - -class MyApp extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Provider( - create: (_) => TodoAppBloc(), - dispose: (_, bloc) => bloc.close(), - child: MaterialApp( - title: 'moor Demo', - theme: ThemeData( - primarySwatch: Colors.orange, - typography: Typography.material2018(), - ), - home: HomeScreen(), - ), - ); - } -} diff --git a/moor_flutter/example/lib/widgets/add_category_dialog.dart b/moor_flutter/example/lib/widgets/add_category_dialog.dart deleted file mode 100644 index fa72146b..00000000 --- a/moor_flutter/example/lib/widgets/add_category_dialog.dart +++ /dev/null @@ -1,62 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:moor_example/bloc.dart'; -import 'package:provider/provider.dart'; - -class AddCategoryDialog extends StatefulWidget { - @override - _AddCategoryDialogState createState() => _AddCategoryDialogState(); -} - -class _AddCategoryDialogState extends State { - final TextEditingController _controller = TextEditingController(); - - @override - Widget build(BuildContext context) { - return Dialog( - child: Padding( - padding: const EdgeInsets.all(8), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Padding( - padding: const EdgeInsets.all(8), - child: Text( - 'Add a category', - style: Theme.of(context).textTheme.headline6, - ), - ), - TextField( - controller: _controller, - autofocus: true, - decoration: const InputDecoration( - labelText: 'Name of the category', - ), - onSubmitted: (_) => _addEntry(), - ), - ButtonBar( - children: [ - TextButton( - child: const Text('Add'), - style: ButtonStyle( - foregroundColor: MaterialStateProperty.all( - Theme.of(context).colorScheme.secondary, - ), - ), - onPressed: _addEntry, - ), - ], - ), - ], - ), - ), - ); - } - - void _addEntry() { - if (_controller.text.isNotEmpty) { - Provider.of(context, listen: false) - .addCategory(_controller.text); - Navigator.of(context).pop(); - } - } -} diff --git a/moor_flutter/example/lib/widgets/categories_drawer.dart b/moor_flutter/example/lib/widgets/categories_drawer.dart deleted file mode 100644 index d8740627..00000000 --- a/moor_flutter/example/lib/widgets/categories_drawer.dart +++ /dev/null @@ -1,160 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:moor_example/bloc.dart'; -import 'package:moor_example/widgets/add_category_dialog.dart'; -import 'package:provider/provider.dart'; - -class CategoriesDrawer extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Drawer( - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - DrawerHeader( - child: Text( - 'Todo-List Demo with moor', - style: Theme.of(context) - .textTheme - .subtitle1 - ?.copyWith(color: Colors.white), - ), - decoration: const BoxDecoration(color: Colors.orange), - ), - Flexible( - child: StreamBuilder>( - stream: Provider.of(context).categories, - builder: (context, snapshot) { - final categories = snapshot.data ?? []; - - return ListView.builder( - itemBuilder: (context, index) { - return _CategoryDrawerEntry(entry: categories[index]); - }, - itemCount: categories.length, - ); - }, - ), - ), - const Spacer(), - Row( - children: [ - TextButton( - child: const Text('Add category'), - style: ButtonStyle( - foregroundColor: MaterialStateProperty.all( - Theme.of(context).colorScheme.secondary, - ), - ), - onPressed: () { - showDialog( - context: context, builder: (_) => AddCategoryDialog()); - }, - ), - ], - ), - ], - ), - ); - } -} - -class _CategoryDrawerEntry extends StatelessWidget { - final CategoryWithActiveInfo entry; - - const _CategoryDrawerEntry({Key? key, required this.entry}) : super(key: key); - - @override - Widget build(BuildContext context) { - final category = entry.categoryWithCount.category; - String title; - if (category == null) { - title = 'No category'; - } else { - title = category.description; - } - - final isActive = entry.isActive; - final bloc = Provider.of(context); - - final rowContent = [ - Text( - title, - style: TextStyle( - fontWeight: FontWeight.bold, - color: - isActive ? Theme.of(context).colorScheme.secondary : Colors.black, - ), - ), - Padding( - padding: const EdgeInsets.all(8), - child: Text('${entry.categoryWithCount.count} entries'), - ), - ]; - - // also show a delete button if the category can be deleted - if (category != null) { - rowContent.addAll([ - const Spacer(), - IconButton( - icon: const Icon(Icons.delete_outline), - color: Colors.red, - onPressed: () async { - final confirmed = await showDialog( - context: context, - builder: (context) { - return AlertDialog( - title: const Text('Delete'), - content: Text('Really delete category $title?'), - actions: [ - TextButton( - child: const Text('Cancel'), - onPressed: () { - Navigator.pop(context, false); - }, - ), - TextButton( - child: const Text('Delete'), - style: ButtonStyle( - foregroundColor: MaterialStateProperty.all(Colors.red), - ), - onPressed: () { - Navigator.pop(context, true); - }, - ), - ], - ); - }, - ); - - if (confirmed == true) { - // can be null when the dialog is dismissed - bloc.deleteCategory(category); - } - }, - ), - ]); - } - - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 8), - child: Material( - color: isActive - ? Colors.orangeAccent.withOpacity(0.3) - : Colors.transparent, - borderRadius: BorderRadius.circular(8), - child: InkWell( - onTap: () { - bloc.showCategory(entry.categoryWithCount.category); - Navigator.pop(context); // close the navigation drawer - }, - child: Padding( - padding: const EdgeInsets.all(8), - child: Row( - children: rowContent, - ), - ), - ), - ), - ); - } -} diff --git a/moor_flutter/example/lib/widgets/homescreen.dart b/moor_flutter/example/lib/widgets/homescreen.dart deleted file mode 100644 index 2dfa91d7..00000000 --- a/moor_flutter/example/lib/widgets/homescreen.dart +++ /dev/null @@ -1,96 +0,0 @@ -import 'package:flutter/material.dart' hide Column; -import 'package:flutter/widgets.dart' as f show Column; -import 'package:moor_example/bloc.dart'; -import 'package:moor_example/database/database.dart'; -import 'package:moor_example/widgets/categories_drawer.dart'; -import 'package:moor_example/widgets/todo_card.dart'; -import 'package:provider/provider.dart'; - -// ignore_for_file: prefer_const_constructors - -class HomeScreen extends StatefulWidget { - @override - HomeScreenState createState() { - return HomeScreenState(); - } -} - -/// Shows a list of todos and displays a text input to add another one -class HomeScreenState extends State { - // we only use this to reset the input field at the bottom when a entry has - // been added - final TextEditingController controller = TextEditingController(); - - TodoAppBloc get bloc => Provider.of(context, listen: false); - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: Text('Todo list'), - ), - drawer: CategoriesDrawer(), - body: StreamBuilder>( - stream: bloc.homeScreenEntries, - builder: (context, snapshot) { - print(snapshot); - - if (!snapshot.hasData) { - return const Align( - alignment: Alignment.center, - child: CircularProgressIndicator(), - ); - } - - final activeTodos = snapshot.data!; - - return ListView.builder( - itemCount: activeTodos.length, - itemBuilder: (context, index) { - return TodoCard(activeTodos[index].entry); - }, - ); - }, - ), - bottomSheet: Material( - elevation: 12, - child: SafeArea( - child: Padding( - padding: const EdgeInsets.all(8), - child: f.Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text('What needs to be done?'), - Row( - children: [ - Expanded( - child: TextField( - controller: controller, - onSubmitted: (_) => _createTodoEntry(), - ), - ), - IconButton( - icon: Icon(Icons.send), - color: Theme.of(context).colorScheme.secondary, - onPressed: _createTodoEntry, - ), - ], - ), - ], - ), - ), - ), - ), - ); - } - - void _createTodoEntry() { - if (controller.text.isNotEmpty) { - // We write the entry here. Notice how we don't have to call setState() - // or anything - moor will take care of updating the list automatically. - bloc.createEntry(controller.text); - controller.clear(); - } - } -} diff --git a/moor_flutter/example/lib/widgets/todo_card.dart b/moor_flutter/example/lib/widgets/todo_card.dart deleted file mode 100644 index 6c0a21d7..00000000 --- a/moor_flutter/example/lib/widgets/todo_card.dart +++ /dev/null @@ -1,79 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:intl/intl.dart'; -import 'package:moor_example/bloc.dart'; -import 'package:moor_example/database/database.dart'; -import 'package:moor_example/widgets/todo_edit_dialog.dart'; -import 'package:provider/provider.dart'; - -final DateFormat _format = DateFormat.yMMMd(); - -/// Card that displays an entry and an icon button to delete that entry -class TodoCard extends StatelessWidget { - final TodoEntry entry; - - TodoCard(this.entry) : super(key: ObjectKey(entry.id)); - - @override - Widget build(BuildContext context) { - Widget dueDate; - if (entry.targetDate == null) { - dueDate = GestureDetector( - onTap: () { - // BlocProvider.provideBloc(context).db.testTransaction(entry); - }, - child: const Text( - 'No due date set', - style: TextStyle(color: Colors.grey, fontSize: 12), - ), - ); - } else { - dueDate = Text( - _format.format(entry.targetDate!), - style: const TextStyle(fontSize: 12), - ); - } - - return Card( - child: Padding( - padding: const EdgeInsets.all(8), - child: Row( - mainAxisSize: MainAxisSize.max, - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Text(entry.content), - dueDate, - ], - ), - ), - IconButton( - icon: const Icon(Icons.edit), - color: Colors.blue, - onPressed: () { - showDialog( - context: context, - barrierDismissible: false, - builder: (ctx) => TodoEditDialog(entry: entry), - ); - }, - ), - IconButton( - icon: const Icon(Icons.delete), - color: Colors.red, - onPressed: () { - // We delete the entry here. Again, notice how we don't have to - // call setState() or inform the parent widget. Moor will take - // care of updating the underlying data automatically - Provider.of(context, listen: false) - .deleteEntry(entry); - }, - ) - ], - ), - ), - ); - } -} diff --git a/moor_flutter/example/lib/widgets/todo_edit_dialog.dart b/moor_flutter/example/lib/widgets/todo_edit_dialog.dart deleted file mode 100644 index 13aab415..00000000 --- a/moor_flutter/example/lib/widgets/todo_edit_dialog.dart +++ /dev/null @@ -1,110 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:intl/intl.dart'; -import 'package:moor_example/bloc.dart'; -import 'package:moor_example/database/database.dart'; -import 'package:provider/provider.dart'; - -final _dateFormat = DateFormat.yMMMd(); - -class TodoEditDialog extends StatefulWidget { - final TodoEntry entry; - - const TodoEditDialog({Key? key, required this.entry}) : super(key: key); - - @override - _TodoEditDialogState createState() => _TodoEditDialogState(); -} - -class _TodoEditDialogState extends State { - final TextEditingController textController = TextEditingController(); - DateTime? _dueDate; - - @override - void initState() { - textController.text = widget.entry.content; - _dueDate = widget.entry.targetDate; - super.initState(); - } - - @override - void dispose() { - textController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - var formattedDate = 'No date set'; - if (_dueDate != null) { - formattedDate = _dateFormat.format(_dueDate!); - } - - return AlertDialog( - title: const Text('Edit entry'), - content: Column( - mainAxisSize: MainAxisSize.min, - children: [ - TextField( - controller: textController, - decoration: const InputDecoration( - hintText: 'What needs to be done?', - helperText: 'Content of entry', - ), - ), - Row( - children: [ - Text(formattedDate), - const Spacer(), - IconButton( - icon: const Icon(Icons.calendar_today), - onPressed: () async { - final now = DateTime.now(); - final initialDate = _dueDate ?? now; - final firstDate = - initialDate.isBefore(now) ? initialDate : now; - - final selectedDate = await showDatePicker( - context: context, - initialDate: initialDate, - firstDate: firstDate, - lastDate: DateTime(3000), - ); - - setState(() { - if (selectedDate != null) _dueDate = selectedDate; - }); - }, - ), - ], - ), - ], - ), - actions: [ - TextButton( - child: const Text('Cancel'), - style: ButtonStyle( - textStyle: MaterialStateProperty.all( - const TextStyle(color: Colors.black), - ), - ), - onPressed: () { - Navigator.pop(context); - }, - ), - TextButton( - child: const Text('Save'), - onPressed: () { - final updatedContent = textController.text; - final entry = widget.entry.copyWith( - content: updatedContent.isNotEmpty ? updatedContent : null, - targetDate: _dueDate, - ); - - Provider.of(context, listen: false).updateEntry(entry); - Navigator.pop(context); - }, - ), - ], - ); - } -} diff --git a/moor_flutter/example/pubspec.yaml b/moor_flutter/example/pubspec.yaml deleted file mode 100644 index d7fe33e1..00000000 --- a/moor_flutter/example/pubspec.yaml +++ /dev/null @@ -1,39 +0,0 @@ -name: moor_example -description: A todo list application that uses moor to store data -publish_to: none - -version: 1.0.0+1 - -environment: - sdk: ">=2.12.0 <3.0.0" - -dependencies: - flutter: - sdk: flutter - provider: ^6.0.0 - intl: ^0.17.0 - rxdart: ^0.27.0 - moor_flutter: ^4.0.0 - -dev_dependencies: - build_runner: - moor_generator: ^4.0.0 - flutter_test: - sdk: flutter - -dependency_overrides: - drift: - path: ../../drift - drift_dev: - path: ../../drift_dev - moor_flutter: - path: .. - moor_generator: - path: ../../moor_generator - moor: - path: ../../moor - sqlparser: - path: ../../sqlparser - -flutter: - uses-material-design: true diff --git a/moor_flutter/example/test/widget_test.dart b/moor_flutter/example/test/widget_test.dart deleted file mode 100644 index 53842a73..00000000 --- a/moor_flutter/example/test/widget_test.dart +++ /dev/null @@ -1,30 +0,0 @@ -// This is a basic Flutter widget test. -// -// To perform an interaction with a widget in your test, use the WidgetTester -// utility that Flutter provides. For example, you can send tap and scroll -// gestures. You can also use WidgetTester to find child widgets in the widget -// tree, read text, and verify that the values of widget properties are correct. - -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; - -import 'package:moor_example/main.dart'; - -void main() { - testWidgets('Counter increments smoke test', (WidgetTester tester) async { - // Build our app and trigger a frame. - await tester.pumpWidget(MyApp()); - - // Verify that our counter starts at 0. - expect(find.text('0'), findsOneWidget); - expect(find.text('1'), findsNothing); - - // Tap the '+' icon and trigger a frame. - await tester.tap(find.byIcon(Icons.add)); - await tester.pump(); - - // Verify that our counter has incremented. - expect(find.text('0'), findsNothing); - expect(find.text('1'), findsOneWidget); - }); -} diff --git a/moor_flutter/pubspec.lock b/moor_flutter/pubspec.lock deleted file mode 100644 index 47ae2c05..00000000 --- a/moor_flutter/pubspec.lock +++ /dev/null @@ -1,210 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - async: - dependency: transitive - description: - name: async - url: "https://pub.dartlang.org" - source: hosted - version: "2.8.2" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0" - characters: - dependency: transitive - description: - name: characters - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.1" - clock: - dependency: transitive - description: - name: clock - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" - collection: - dependency: transitive - description: - name: collection - url: "https://pub.dartlang.org" - source: hosted - version: "1.15.0" - convert: - dependency: transitive - description: - name: convert - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.0" - fake_async: - dependency: transitive - description: - name: fake_async - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" - ffi: - dependency: transitive - description: - name: ffi - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.0-nullsafety.1" - flutter: - dependency: "direct main" - description: flutter - source: sdk - version: "0.0.0" - flutter_test: - dependency: "direct dev" - description: flutter - source: sdk - version: "0.0.0" - matcher: - dependency: transitive - description: - name: matcher - url: "https://pub.dartlang.org" - source: hosted - version: "0.12.11" - material_color_utilities: - dependency: transitive - description: - name: material_color_utilities - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.3" - meta: - dependency: transitive - description: - name: meta - url: "https://pub.dartlang.org" - source: hosted - version: "1.7.0" - moor: - dependency: "direct main" - description: - name: moor - url: "https://pub.dartlang.org" - source: hosted - version: "4.2.1" - path: - dependency: "direct main" - description: - name: path - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.0" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.dartlang.org" - source: hosted - version: "1.11.0" - sky_engine: - dependency: transitive - description: flutter - source: sdk - version: "0.0.99" - source_span: - dependency: transitive - description: - name: source_span - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.1" - sqflite: - dependency: "direct main" - description: - name: sqflite - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.0+3" - sqflite_common: - dependency: transitive - description: - name: sqflite_common - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.0+2" - sqlite3: - dependency: transitive - description: - name: sqlite3 - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.9-nullsafety.0" - stack_trace: - dependency: transitive - description: - name: stack_trace - url: "https://pub.dartlang.org" - source: hosted - version: "1.10.0" - stream_channel: - dependency: transitive - description: - name: stream_channel - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0" - string_scanner: - dependency: transitive - description: - name: string_scanner - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" - synchronized: - dependency: transitive - description: - name: synchronized - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.0" - term_glyph: - dependency: transitive - description: - name: term_glyph - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" - test_api: - dependency: transitive - description: - name: test_api - url: "https://pub.dartlang.org" - source: hosted - version: "0.4.8" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0" - vector_math: - dependency: transitive - description: - name: vector_math - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.1" -sdks: - dart: ">=2.14.0 <3.0.0" - flutter: ">=1.24.0-10" diff --git a/moor_flutter/pubspec.yaml b/moor_flutter/pubspec.yaml deleted file mode 100644 index 973c6037..00000000 --- a/moor_flutter/pubspec.yaml +++ /dev/null @@ -1,61 +0,0 @@ -name: moor_flutter -description: Flutter implementation of moor, a safe and reactive persistence library for Dart applications -version: 4.1.0 -repository: https://github.com/simolus3/drift -homepage: https://drift.simonbinder.eu/ -issue_tracker: https://github.com/simolus3/drift/issues - -environment: - sdk: '>=2.12.0 <3.0.0' - -dependencies: - moor: ^4.0.0 - sqflite: ^2.0.0+3 - path: ^1.8.0 - flutter: - sdk: flutter - -dev_dependencies: - flutter_test: - sdk: flutter - -#dependency_overrides: -# moor: -# path: ../moor - -# For information on the generic Dart part of this file, see the -# following page: https://www.dartlang.org/tools/pub/pubspec - -# The following section is specific to Flutter. -flutter: - - # To add assets to your package, add an assets section, like this: - # assets: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg - # - # For details regarding assets in packages, see - # https://flutter.io/assets-and-images/#from-packages - # - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.io/assets-and-images/#resolution-aware. - - # To add custom fonts to your package, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts in packages, see - # https://flutter.io/custom-fonts/#from-packages diff --git a/moor_generator/.gitignore b/moor_generator/.gitignore deleted file mode 100644 index b5033877..00000000 --- a/moor_generator/.gitignore +++ /dev/null @@ -1,109 +0,0 @@ - -# Created by https://www.gitignore.io/api/dart,intellij -# Edit at https://www.gitignore.io/?templates=dart,intellij - -### Dart ### -# See https://www.dartlang.org/guides/libraries/private-files - -# Files and directories created by pub -.dart_tool/ -.packages -# If you're building an application, you may want to check-in your pubspec.lock -pubspec.lock - -# Directory created by dartdoc -# If you don't generate documentation locally you can remove this line. -doc/api/ - -# Avoid committing generated Javascript files: -*.dart.js -*.info.json # Produced by the --dump-info flag. -*.js # When generated by dart2js. Don't specify *.js if your - # project includes source files written in JavaScript. -*.js_ -*.js.deps -*.js.map - -android/ -ios/ - -### Intellij ### -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm -# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 - -# User-specific stuff -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/**/usage.statistics.xml -.idea/**/dictionaries -.idea/**/shelf - -# Generated files -.idea/**/contentModel.xml - -# Sensitive or high-churn files -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml -.idea/**/dbnavigator.xml - -# Gradle -.idea/**/gradle.xml -.idea/**/libraries - -# Gradle and Maven with auto-import -# When using Gradle or Maven with auto-import, you should exclude module files, -# since they will be recreated, and may cause churn. Uncomment if using -# auto-import. -# .idea/modules.xml -# .idea/*.iml -# .idea/modules - -# CMake -cmake-build-*/ - -# Mongo Explorer plugin -.idea/**/mongoSettings.xml - -# File-based project format -*.iws - -# IntelliJ -out/ - -# mpeltonen/sbt-idea plugin -.idea_modules/ - -# JIRA plugin -atlassian-ide-plugin.xml - -# Cursive Clojure plugin -.idea/replstate.xml - -# Crashlytics plugin (for Android Studio and IntelliJ) -com_crashlytics_export_strings.xml -crashlytics.properties -crashlytics-build.properties -fabric.properties - -# Editor-based Rest Client -.idea/httpRequests - -# Android studio 3.1+ serialized cache file -.idea/caches/build_file_checksums.ser - -### Intellij Patch ### -# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 - -# *.iml -# modules.xml -# .idea/misc.xml -# *.ipr - -# Sonarlint plugin -.idea/sonarlint - -# End of https://www.gitignore.io/api/dart,intellij diff --git a/moor_generator/CHANGELOG.md b/moor_generator/CHANGELOG.md deleted file mode 100644 index 0819e198..00000000 --- a/moor_generator/CHANGELOG.md +++ /dev/null @@ -1,205 +0,0 @@ -## 4.6.0 - -Moor has been renamed to `drift`. This package will continue to be supported until the next major release (5.0.0), -no immediate action is needed. - -At the next breaking release, moor will be discontinued in favor of the `drift` package. -Please consider migrating to `drift` at a suitable opportunity. -Automated migration tooling exists! See https://drift.simonbinder.eu/name for details. - -Version 4.6.0+1 adds information about the name change to the README. - -## 4.5.1 - -- Fix generating parameters when `named_parameters_always_required` is enabled. - -## 4.5.0 - -- Migrate builder implementation to null-safety - -## 4.4.1 - -- Fix analyzer plugin -- Always generate indexed variables with the `new_sql_code_generation` option - -## 4.4.0 - -- Support the `scoped_dart_components` build option -- Improve nullability analysis for SQL result sets -- Generate data classes for views - -## 4.3.2 - -- Support the latest analyzer version - -## 4.3.1 - -- Fix code generation for custom data classes - -## 4.3.0 - -- Generate non-nullable nested result classes when possible -- Support Dart placeholders for insert statements - -## 4.2.2 - -- Support latest `build_config` -- Fix generated code for queries using a Dart placeholder before an array variable - -## 4.2.1 - -- Fix generated code for nullable columns in moor files - -## 4.2.0 - -- Migrate `package:moor_generator/api/migrations.dart` to null-safety -- Support for newer sqlite features in compiled queries - -## 4.1.0 - -- Stabilized support for generating null-safe code -- Initial support for views in moor files. Big thanks to [Hossein Yousefi](https://github.com/HosseinYousefi)! - -## 4.0.0-dev - -- Remove the `legacy_type_inference` option -- Support moor 4 -- Add the `new_sql_code_generation` option to generate compiled SQL queries - (from moor files and annotations) based on the parsed AST. Please consider enabling this option and reporting issues! - It will eventually become the default. - -## 3.4.0 - -- Add experimental apis for schema verification -- Support version `0.40.x` of the `analyzer` package -- Experimental: Generate NNBD code for input libraries that have opted-in. - -## 3.3.1 - -- Fixes a bug when importing a Dart table both through `tables` and `includes` - -## 3.3.0 - -- New `apply_converters_on_variables` build option - -## 3.2.0 - -- Support custom result class names for queries. -- Fix minimum `analyzer: ^0.39.5` version requirement - -## 3.1.0 - -- Respect foreign key constraints when calculating the stream update graph - -## 3.0.0 - -Generate code for moor 3.0. This most notably includes custom companions and nested result sets. See moor's changelog -for all the new features. - -## 2.4.0 - -- Support type converters in moor files. You can import the necessary Dart file with a regular `import` - statement and then use `MAPPED BY ``MyTypeConverter`` ` in a column definition. - -## 2.3.1 - -- CLI/IDE: Fix path resolution on Windows - -## 2.3.0 - -- Support explicit type arguments for queries in moor files. In - `foo(:bar AS TEXT, :baz AS INT): SELECT :bar, :baz;`, the column type can now be inferred. Previously, the query would - fail because of an unknown type. -- Support `CREATE TRIGGER` and `CREATE INDEX` statements in moor files -- Optional new type inference algorithm -- CLI tool to analyze moor projects - -## 2.2.0 - -- Experimental new CLI tool (`pub run moor_generator`). Not useful at the moment -- Support inheritance when defining daos ([#285](https://github.com/simolus3/drift/issues/285)) -- Improve robustness and error messages, many bug fixes - -## 2.1.1 - -- Fix a crash when using common table expressions in custom statements -- Don't use a moor specific caching graph across build steps - -## 2.1.0 - -- Accept inheritance in table definitions (e.g. if an abstract class declared as `IntColumn get foo => integer()()`, - tables inheriting from that class will also have a `foo` column) -- New `use_data_class_name_for_companions` option that will make the name of the companion based on the data class - name (uses table name by default). -- New `use_column_name_as_json_key_when_defined_in_moor_file` option to use the column name instead of the Dart getter - name as json key for columns declared in moor files - -## 2.0.1 - -- Escape `\r` characters in generated Dart literals -- Fix for [an analyzer bug on constant expressions](https://dartbug.com/38658) in generated code -- Small adaptions in generated code for moor version 2.0.1 - -## 2.0.0 - -- Rewritten generator with looser coupling to the build package -- Implementation of an SQL IDE as analyzer plugin -- Support `sqlparser` 0.3.0 and updated grammar for `moor` files - -## 1.7.1 - -- Drop support for analyzer versions `<0.36.4`. They weren't supported in version 1.7.0 either, but the `pubspec.yaml` - did not specify this correctly. -- Support for moor version 1.7.1, which contains a fix for integer columns declared as primary key - -## 1.7.0 - -- Support type converters that were introduced in moor 1.7 -- Support parsing and generating code for `.moor` files ( - see [docs](https://drift.simonbinder.eu/docs/using-sql/custom_tables/)). - -## 1.6.0+2 - -- Generate code to expand array variables - -_The +1 release has no changes to 1.6.0, there were issues while uploading to pub. +2 fixes delivers on the promise of -supporting the analyze 0.37_ - -## 1.5.0 - -- Parse custom queries and write generated mapping code. -- Refactorings and minor improvements in the generator - -For more details on the new features, check out changelog of the -[moor](https://pub.dev/packages/moor#-changelog-tab-) package. - -## 1.4.0 - -- Added the `RealColumn`, which stores floating point values -- Better configuration for the serializer with the `JsonKey` annotation and the ability to use a - custom `ValueSerializer` - -## 1.3.0 - -- Moor now supports table joins - - Added table aliases -- Default values for columns: Just use the `withDefault` method when declaring a column - - added expressions that resolve to the current date or time -- Fixed a crash that would occur if the first operation was a transaction -- Better support for custom expressions as part of a regular query -- Faster hashcode implementation in generated data classes - -## 1.2.0 - -- Blob data type -- Generated classes now use lazy getters instead of recalculating fields on each access -- Custom Constraints -- Data classes can be converted from and to json - -## 1.1.0 - -- The generated data classes now implement `toString()` - -## 1.0.0 - -- Initial version of the Moor generator diff --git a/moor_generator/LICENSE b/moor_generator/LICENSE deleted file mode 100644 index e4b21941..00000000 --- a/moor_generator/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2019 Simon Binder - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/moor_generator/README.md b/moor_generator/README.md deleted file mode 100644 index c7820b96..00000000 --- a/moor_generator/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# moor Generator - -__Important notice__: Moor has been renamed to Drift. -This package will continue to be supported for a while, but we encourage users to migrate to `drift`. -Automated tooling to help you make the switch is available! For more information, see [the documentation](https://drift.simonbinder.eu/name/). -Thanks yor your understanding! - -This library contains the generator that turns your `Table` classes from moor -into database code. - -Please see the homepage of [moor](https://drift.simonbinder.eu/) for details on how to use this package. \ No newline at end of file diff --git a/moor_generator/analysis_options.yaml b/moor_generator/analysis_options.yaml deleted file mode 100644 index 56d9ed1f..00000000 --- a/moor_generator/analysis_options.yaml +++ /dev/null @@ -1 +0,0 @@ -#include: ../analysis_options.yaml \ No newline at end of file diff --git a/moor_generator/bin/moor_generator.dart b/moor_generator/bin/moor_generator.dart deleted file mode 100644 index 6ae44aae..00000000 --- a/moor_generator/bin/moor_generator.dart +++ /dev/null @@ -1,6 +0,0 @@ -//@dart=2.9 -import 'package:drift_dev/src/cli/cli.dart' as cli; - -Future main(List args) { - return cli.run(args); -} diff --git a/moor_generator/build.yaml b/moor_generator/build.yaml deleted file mode 100644 index 3dd4d684..00000000 --- a/moor_generator/build.yaml +++ /dev/null @@ -1,42 +0,0 @@ -# Short description for each builder - -# - preparing_builder: Infers the type of inline Dart expressions in moor files. -# We create a `input.temp.dart` file containing the expressions so that they -# can be resolved. -# - moor_generator: The regular SharedPartBuilder for @UseMoor and @UseDao -# annotations -# - moor_generator_not_shared: Like moor_generator, but as a PartBuilder instead of -# a SharedPartBuilder. This builder is disabled by default, but users may choose -# to use it so that generated classes can be used by other builders. -# - moor_cleanup: Deletes the `.temp.dart` files generated by the `preparing_builder`. - -builders: - preparing_builder: - import: "package:moor_generator/integrations/build.dart" - builder_factories: ["preparingBuilder"] - build_extensions: {".moor": [".temp.dart", ".dart_in_drift"]} - build_to: cache - auto_apply: dependents - applies_builders: ["moor_generator|moor_cleanup"] - - moor_generator: - import: "package:moor_generator/integrations/build.dart" - builder_factories: ["moorBuilder"] - build_extensions: {".dart": [".moor.g.part"]} - auto_apply: dependents - build_to: cache - required_inputs: [".dart_in_drift"] - applies_builders: ["source_gen|combining_builder"] - - moor_generator_not_shared: - import: "package:moor_generator/integrations/build.dart" - builder_factories: ["moorBuilderNotShared"] - build_extensions: {".dart": [".moor.dart"]} - build_to: source - auto_apply: none - required_inputs: [".dart_in_drift"] - -post_process_builders: - moor_cleanup: - import: "package:moor_generator/integrations/build.dart" - builder_factory: "moorCleanup" \ No newline at end of file diff --git a/moor_generator/dart_test.yaml b/moor_generator/dart_test.yaml deleted file mode 100644 index aed72c64..00000000 --- a/moor_generator/dart_test.yaml +++ /dev/null @@ -1,4 +0,0 @@ -tags: - # Tests that spawn a Dart analyzer - analyzer: - timeout: 4x # the analyzer can be slow \ No newline at end of file diff --git a/moor_generator/lib/api/migrations.dart b/moor_generator/lib/api/migrations.dart deleted file mode 100644 index 257678f0..00000000 --- a/moor_generator/lib/api/migrations.dart +++ /dev/null @@ -1 +0,0 @@ -export 'package:drift_dev/api/migrations.dart'; diff --git a/moor_generator/lib/integrations/build.dart b/moor_generator/lib/integrations/build.dart deleted file mode 100644 index 0ff7c468..00000000 --- a/moor_generator/lib/integrations/build.dart +++ /dev/null @@ -1,16 +0,0 @@ -// ignore_for_file: implementation_imports -import 'package:build/build.dart'; -import 'package:drift_dev/src/backends/build/drift_builder.dart'; -import 'package:drift_dev/src/backends/build/preprocess_builder.dart'; - -Builder moorBuilder(BuilderOptions options) => - DriftSharedPartBuilder(options, isForNewDriftPackage: false); - -Builder moorBuilderNotShared(BuilderOptions options) => - DriftPartBuilder(options, isForNewDriftPackage: false); - -Builder preparingBuilder(BuilderOptions options) => PreprocessBuilder(); - -PostProcessBuilder moorCleanup(BuilderOptions options) { - return const FileDeletingBuilder(['.temp.dart']); -} diff --git a/moor_generator/lib/integrations/plugin.dart b/moor_generator/lib/integrations/plugin.dart deleted file mode 100644 index eda95c76..00000000 --- a/moor_generator/lib/integrations/plugin.dart +++ /dev/null @@ -1,2 +0,0 @@ -//@dart=2.9 -export 'package:drift_dev/integrations/plugin.dart'; diff --git a/moor_generator/lib/moor_generator.dart b/moor_generator/lib/moor_generator.dart deleted file mode 100644 index 55303abb..00000000 --- a/moor_generator/lib/moor_generator.dart +++ /dev/null @@ -1 +0,0 @@ -export 'package:drift_dev/moor_generator.dart'; diff --git a/moor_generator/lib/writer.dart b/moor_generator/lib/writer.dart deleted file mode 100644 index 8d5de53c..00000000 --- a/moor_generator/lib/writer.dart +++ /dev/null @@ -1 +0,0 @@ -export 'package:drift_dev/writer.dart'; diff --git a/moor_generator/mono_pkg.yaml b/moor_generator/mono_pkg.yaml deleted file mode 100644 index dedad115..00000000 --- a/moor_generator/mono_pkg.yaml +++ /dev/null @@ -1,9 +0,0 @@ -dart: - - stable - -stages: - - analyze: - - dartanalyzer: --fatal-infos --fatal-warnings lib/ test/ - - dartfmt - - unit_test: - - test diff --git a/moor_generator/pubspec.yaml b/moor_generator/pubspec.yaml deleted file mode 100644 index 483dcaa4..00000000 --- a/moor_generator/pubspec.yaml +++ /dev/null @@ -1,29 +0,0 @@ -name: moor_generator -description: Moor has been renamed to Drift. -version: 4.6.1 -repository: https://github.com/simolus3/drift -homepage: https://drift.simonbinder.eu/ -issue_tracker: https://github.com/simolus3/drift/issues - -environment: - sdk: '>=2.12.0 <3.0.0' - -dependencies: - build: ^2.1.0 - drift_dev: ^1.0.0 - # When users depend on the latest moor_generator, they should also get the latest moor for - # the migration to work - moor: ^4.6.0 - -executables: - moor_generator: - -dependency_overrides: - drift: - path: ../drift - drift_dev: - path: ../drift_dev - sqlparser: - path: ../sqlparser - moor: - path: ../moor