mirror of https://github.com/AMT-Cheif/drift.git
Move examples into top-level folder
This commit is contained in:
parent
26c3dbfb48
commit
204fbad682
|
@ -200,7 +200,7 @@ targets:
|
|||
In all files that use generated drift code, you'll have to replace `part 'filename.g.dart'` with `part 'filename.drift.dart'`.
|
||||
If you use drift _and_ another builder in the same file, you'll need both `.g.dart` and `.drift.dart` as part-files.
|
||||
|
||||
A full example is available as part of [the drift repo](https://github.com/simolus3/drift/tree/develop/extras/with_built_value).
|
||||
A full example is available as part of [the drift repo](https://github.com/simolus3/drift/tree/develop/examples/with_built_value).
|
||||
|
||||
If you run into any problems with this approach, feel free to open an issue on drift.
|
||||
|
||||
|
|
|
@ -249,7 +249,7 @@ By using those test databases, drift can help you test migrations from and to an
|
|||
{% block "blocks/alert" title="Complex topic ahead" %}
|
||||
> Writing schema tests is an advanced topic that requires a fairly complex setup described here.
|
||||
If you get stuck along the way, don't hesitate to [open a discussion about it](https://github.com/simolus3/drift/discussions).
|
||||
Also, there's a working example [in the drift repository](https://github.com/simolus3/drift/tree/latest-release/extras/migrations_example).
|
||||
Also, there's a working example [in the drift repository](https://github.com/simolus3/drift/tree/latest-release/examples/migrations_example).
|
||||
{% endblock %}
|
||||
|
||||
### Setup
|
||||
|
|
|
@ -194,21 +194,21 @@ DatabaseConnection connectToWorker() {
|
|||
}
|
||||
```
|
||||
|
||||
You can pass that `DatabaseConnection` to your database by enabling the
|
||||
You can pass that `DatabaseConnection` to your database by enabling the
|
||||
`generate_connect_constructor` build option.
|
||||
For more information on the `DatabaseConnection` class, see the documentation on
|
||||
[isolates]({{ "../Advanced Features/isolates.md" | pageUrl }}).
|
||||
|
||||
A small, but working example is available under [extras/web_worker_example](https://github.com/simolus3/drift/tree/develop/extras/web_worker_example)
|
||||
A small, but working example is available under [examples/web_worker_example](https://github.com/simolus3/drift/tree/develop/examples/web_worker_example)
|
||||
in the drift repository.
|
||||
|
||||
### Flutter
|
||||
Flutter users will have to use a different approach to compile service workers.
|
||||
Flutter users will have to use a different approach to compile service workers.
|
||||
Flutter web doesn't compile `.dart` files in web folder and won't use `.js` files generated by
|
||||
`build_web_compilers` either. Instead, we'll use Dart's build system to manually compile the worker to a
|
||||
JavaScript file before using Flutter-specific tooling.
|
||||
|
||||
Example is available under [extras/flutter_web_worker_example](https://github.com/simolus3/drift/tree/develop/extras/flutter_web_worker_example)
|
||||
Example is available under [examples/flutter_web_worker_example](https://github.com/simolus3/drift/tree/develop/examples/flutter_web_worker_example)
|
||||
in the drift repository.
|
||||
|
||||
First, add [build_web_compilers](https://pub.dev/packages/build_web_compilers) to the project:
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
## Examples using drift
|
||||
|
||||
This collection of examples demonstrates how to use some advanced drift features.
|
||||
|
||||
- `flutter_web_worker_example`: Asynchronously run a drift database through a web worker with Fluter.
|
||||
- `migrations_example`: Example showing to how to generate test utilities to verify schema migration.
|
||||
- `web_worker_-_example`: Asynchronously run a drift database through a web worker, without Flutter.
|
||||
- `with_built_value`: Configure `build_runner` so that drift-generated classes can be used by `build_runner`.
|
|
@ -12,19 +12,19 @@ dart pub upgrade
|
|||
dart test || EXIT_CODE=$?
|
||||
popd
|
||||
|
||||
pushd extras/integration_tests/postgres
|
||||
pushd examples/integration_tests/postgres
|
||||
echo "Running integration tests with Postgres"
|
||||
dart pub upgrade
|
||||
dart test || EXIT_CODE=$?
|
||||
popd
|
||||
|
||||
pushd extras/with_built_value
|
||||
pushd examples/with_built_value
|
||||
echo "Running build runner in with_built_value"
|
||||
dart pub upgrade
|
||||
dart run build_runner build --delete-conflicting-outputs || EXIT_CODE=$?
|
||||
popd
|
||||
|
||||
pushd extras/migrations_example
|
||||
pushd examples/migrations_example
|
||||
echo "Testing migrations in migrations_example"
|
||||
dart pub upgrade
|
||||
dart test
|
||||
|
|
Loading…
Reference in New Issue