mirror of https://github.com/AMT-Cheif/drift.git
Link new cross-platform example in docs
This commit is contained in:
parent
aa09540946
commit
6a47e32afc
|
@ -41,7 +41,7 @@ provide helpful and descriptive lints.
|
|||
- __⚡ Fast__: Even though drift lets you write powerful queries, it can keep
|
||||
up with the performance of key-value stores like shared preferences and Hive. Drift is the only major persistence library with builtin threading support, allowing you to run database code across isolates with zero additional effort.
|
||||
- __Reactive__: Turn any sql query into an auto-updating stream! This includes complex queries across many tables
|
||||
- __⚙️ Cross-Platform support__: Drift works on Android, iOS, macOS, Windows, Linux and the web. [This template](https://github.com/rodydavis/moor_shared) is a Flutter todo app that works on all platforms
|
||||
- __⚙️ Cross-Platform support__: Drift works on Android, iOS, macOS, Windows, Linux and the web. [This template](https://github.com/simolus3/drift/tree/develop/examples/app) is a Flutter todo app that works on all platforms.
|
||||
- __🗡️ Battle tested and production ready__: Drift is stable and well tested with a wide range of unit and integration tests. It powers production Flutter apps.
|
||||
|
||||
With drift, persistence on Flutter is fun!
|
||||
|
|
|
@ -10,6 +10,7 @@ template: layouts/docs/list
|
|||
We have an [example in the repo](https://github.com/simolus3/drift/tree/master/moor_flutter/example), it's a simple todo list app,
|
||||
written with drift. [Rody Davis](https://github.com/rodydavis) has built a cleaner version of the example that works on all
|
||||
Flutter platforms - including Web and Desktop! You can check it out [here](https://github.com/rodydavis/moor_shared).
|
||||
An updated version of this example is also present in drift's [repository](https://github.com/simolus3/drift/tree/develop/examples/app).
|
||||
[Abdelrahman Mostafa Elmarakby](https://github.com/abdelrahmanelmarakby) wrote an animated version of the todo app available [here](https://github.com/abdelrahmanelmarakby/todo_with_moor_and_animation).
|
||||
|
||||
The [HackerNews reader app](https://github.com/filiph/hn_app) from the [Boring Flutter Show](https://www.youtube.com/playlist?list=PLjxrf2q8roU3ahJVrSgAnPjzkpGmL9Czl) also uses moor to keep a list of favorite articles.
|
||||
|
|
|
@ -12,6 +12,8 @@ aliases:
|
|||
_Note:_ If you prefer a tutorial video, Reso Coder has made a detailed video explaining
|
||||
how to get started. You can watch it [here](https://youtu.be/zpWsedYMczM).
|
||||
|
||||
A complete cross-platform Flutter app using drift is also available [here](https://github.com/simolus3/drift/tree/develop/examples/app).
|
||||
|
||||
## Adding the dependency
|
||||
First, lets add drift to your project's `pubspec.yaml`.
|
||||
At the moment, the current version of `drift` is [![Drift version](https://img.shields.io/pub/v/drift.svg)](https://pub.dev/packages/drift)
|
||||
|
|
|
@ -9,6 +9,8 @@ template: layouts/docs/single
|
|||
The regular [getting started guide]({{ "index.md" | pageUrl }}) explains how to get started with drift by
|
||||
declaring both tables and queries in Dart. This version will focus on how to use drift with SQL instead.
|
||||
|
||||
A complete cross-platform Flutter app using drift is also available [here](https://github.com/simolus3/drift/tree/develop/examples/app).
|
||||
|
||||
## Adding the dependency
|
||||
First, lets add drift to your project's `pubspec.yaml`.
|
||||
At the moment, the current version of `drift` is [![Drift version](https://img.shields.io/pub/v/drift.svg)](https://pub.dev/packages/drift)
|
||||
|
|
|
@ -111,7 +111,7 @@ export 'unsupported.dart'
|
|||
if (dart.library.html) 'web.dart';
|
||||
```
|
||||
|
||||
A ready example of this construct can also be found [here](https://github.com/rodydavis/moor_shared/blob/master/lib/src/database/database/unsupported.dart).
|
||||
A ready example of this construct can also be found [here](https://github.com/simolus3/drift/blob/develop/examples/app/lib/database/connection/connection.dart).
|
||||
|
||||
## Debugging
|
||||
You can see all queries sent from drift to the underlying database engine by enabling the `logStatements`
|
||||
|
|
|
@ -28,7 +28,7 @@ This table list all supported drift implementations and on which platforms they
|
|||
| `WasmDatabase` from `package:drift/web.dart` | Web | Potentially faster than a `WebDatabase`, but still experimental and not yet production ready. See [this]({{ 'Other engines/web.md#drift-wasm' | pageUrl }}) for details. |
|
||||
|
||||
To support all platforms in a shared codebase, you only need to change how you open your database, all other usages can stay the same.
|
||||
[This repository](https://github.com/rodydavis/moor_shared) gives an example on how to do that with conditional imports.
|
||||
[This repository](https://github.com/simolus3/drift/tree/develop/examples/app) gives an example on how to do that with conditional imports.
|
||||
|
||||
## Mobile (Android and iOS)
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ provide helpful and descriptive lints.
|
|||
- __⚡ Fast__: Even though drift lets you write powerful queries, it can keep
|
||||
up with the performance of key-value stores. Drift is the only major persistence library with builtin threading support, allowing you to run database code across isolates with zero additional effort.
|
||||
- __Reactive__: Turn any sql query into an auto-updating stream! This includes complex queries across many tables
|
||||
- __⚙️ Cross-Platform support__: Drift works on Android, iOS, macOS, Windows, Linux and the web. [This template](https://github.com/rodydavis/moor_shared) is a Flutter todo app that works on all platforms
|
||||
- __⚙️ Cross-Platform support__: Drift works on Android, iOS, macOS, Windows, Linux and the web. [This template](https://github.com/simolus3/drift/tree/develop/examples/app) is a Flutter todo app that works on all platforms
|
||||
- __🗡️ Battle tested and production ready__: Drift is stable and well tested with a wide range of unit and integration tests. It powers production Flutter apps.
|
||||
|
||||
drift moor, persistence on Flutter is fun!
|
||||
|
|
|
@ -202,6 +202,8 @@ class $CategoriesTable extends Categories
|
|||
@override
|
||||
Set<GeneratedColumn> get $primaryKey => {id};
|
||||
@override
|
||||
List<Set<GeneratedColumn>> get uniqueKeys => [];
|
||||
@override
|
||||
Category map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||
return Category.fromData(data,
|
||||
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
||||
|
@ -461,6 +463,8 @@ class $TodoEntriesTable extends TodoEntries
|
|||
@override
|
||||
Set<GeneratedColumn> get $primaryKey => {id};
|
||||
@override
|
||||
List<Set<GeneratedColumn>> get uniqueKeys => [];
|
||||
@override
|
||||
TodoEntry map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||
return TodoEntry.fromData(data,
|
||||
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
||||
|
@ -609,6 +613,8 @@ class TextEntries extends Table
|
|||
@override
|
||||
Set<GeneratedColumn> get $primaryKey => <GeneratedColumn>{};
|
||||
@override
|
||||
List<Set<GeneratedColumn>> get uniqueKeys => [];
|
||||
@override
|
||||
TextEntrie map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||
return TextEntrie.fromData(data,
|
||||
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
||||
|
|
|
@ -29,8 +29,6 @@
|
|||
<!-- Favicon -->
|
||||
<link rel="icon" type="image/png" href="favicon.png"/>
|
||||
|
||||
<script defer src="sql-wasm.js"></script>
|
||||
|
||||
<title>app</title>
|
||||
<link rel="manifest" href="manifest.json">
|
||||
</head>
|
||||
|
|
Loading…
Reference in New Issue