mirror of https://github.com/AMT-Cheif/drift.git
Move platforms into own section
This commit is contained in:
parent
ba20f80303
commit
ae2b1b4ddf
|
@ -174,7 +174,7 @@ We currently support the following extensions:
|
||||||
Enabling this option is safe when using a `NativeDatabase` with `sqlite3_flutter_libs`,
|
Enabling this option is safe when using a `NativeDatabase` with `sqlite3_flutter_libs`,
|
||||||
which compiles sqlite3 with the R*Tree extension enabled.
|
which compiles sqlite3 with the R*Tree extension enabled.
|
||||||
- `moor_ffi`: Enables support for functions that are only available when using a `NativeDatabase`. This contains `pow`, `sqrt` and a variety
|
- `moor_ffi`: Enables support for functions that are only available when using a `NativeDatabase`. This contains `pow`, `sqrt` and a variety
|
||||||
of trigonometric functions. Details on those functions are available [here]({{ "../Other engines/vm.md#moor-only-functions" | pageUrl }}).
|
of trigonometric functions. Details on those functions are available [here]({{ "../Platforms/vm.md#moor-only-functions" | pageUrl }}).
|
||||||
- `math`: Assumes that sqlite3 was compiled with [math functions](https://www.sqlite.org/lang_mathfunc.html).
|
- `math`: Assumes that sqlite3 was compiled with [math functions](https://www.sqlite.org/lang_mathfunc.html).
|
||||||
This module is largely incompatible with the `moor_ffi` module.
|
This module is largely incompatible with the `moor_ffi` module.
|
||||||
- `spellfix1`: Assumes that the [spellfix1](https://www.sqlite.org/spellfix1.html)
|
- `spellfix1`: Assumes that the [spellfix1](https://www.sqlite.org/spellfix1.html)
|
||||||
|
|
|
@ -202,7 +202,7 @@ with the `separator` argument on `groupConcat`.
|
||||||
|
|
||||||
When using a `NativeDatabase`, a basic set of trigonometric functions will be available.
|
When using a `NativeDatabase`, a basic set of trigonometric functions will be available.
|
||||||
It also defines the `REGEXP` function, which allows you to use `a REGEXP b` in sql queries.
|
It also defines the `REGEXP` function, which allows you to use `a REGEXP b` in sql queries.
|
||||||
For more information, see the [list of functions]({{ "../Other engines/vm.md#moor-only-functions" | pageUrl }}) here.
|
For more information, see the [list of functions]({{ "../Platforms/vm.md#moor-only-functions" | pageUrl }}) here.
|
||||||
|
|
||||||
## Subqueries
|
## Subqueries
|
||||||
|
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
---
|
|
||||||
data:
|
|
||||||
title: "Writing queries"
|
|
||||||
linkTitle: "Writing queries"
|
|
||||||
description: Learn how to write database queries in pure Dart with drift
|
|
||||||
weight: 100
|
|
||||||
aliases:
|
|
||||||
- /queries/
|
|
||||||
template: layouts/docs/single
|
|
||||||
---
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
---
|
|
||||||
data:
|
|
||||||
title: "Other engines"
|
|
||||||
description: "Use drift on the web or other platforms"
|
|
||||||
weight: 100
|
|
||||||
template: layouts/docs/list
|
|
||||||
---
|
|
|
@ -78,7 +78,7 @@ On iOS and macOS, no additional setup is necessary - simply depend on `sqlcipher
|
||||||
|
|
||||||
On Windows and Linux, you currently have to include a version of SQLCipher manually when you distribute
|
On Windows and Linux, you currently have to include a version of SQLCipher manually when you distribute
|
||||||
your app.
|
your app.
|
||||||
For more information on this, you can use the documentation [here]({{ '../platforms.md#bundling-sqlite-with-your-app' | pageUrl }}).
|
For more information on this, you can use the documentation [here]({{ '../Platforms/index.md#bundling-sqlite-with-your-app' | pageUrl }}).
|
||||||
Instead of including `sqlite3.dll` or `libsqlite3.so`, you'd include the respective versions
|
Instead of including `sqlite3.dll` or `libsqlite3.so`, you'd include the respective versions
|
||||||
of SQLCipher.
|
of SQLCipher.
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
data:
|
data:
|
||||||
title: "Supported platforms"
|
title: "Supported platforms"
|
||||||
description: All platforms supported by drift, and how to use them
|
description: All platforms supported by drift, and how to use them
|
||||||
template: layouts/docs/single
|
template: layouts/docs/list
|
||||||
---
|
---
|
||||||
|
|
||||||
Being built on top of the sqlite3 database, drift can run on almost every Dart platform.
|
Being built on top of the sqlite3 database, drift can run on almost every Dart platform.
|
||||||
|
@ -14,7 +14,8 @@ To achieve platform independence, drift separates its core apis from a platform-
|
||||||
database implementation. The core apis are pure-Dart and run on all Dart platforms, even
|
database implementation. The core apis are pure-Dart and run on all Dart platforms, even
|
||||||
outside of Flutter. When writing drift apps, prefer to mainly use the apis in
|
outside of Flutter. When writing drift apps, prefer to mainly use the apis in
|
||||||
`package:drift/drift.dart` as they are guaranteed to work across all platforms.
|
`package:drift/drift.dart` as they are guaranteed to work across all platforms.
|
||||||
Depending on your platform, you can choose a different `QueryExecutor`.
|
Depending on your platform, you can choose a different `QueryExecutor` - the interface
|
||||||
|
binding the core drift library with native databases.
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
|
@ -23,8 +24,8 @@ This table list all supported drift implementations and on which platforms they
|
||||||
| Implementation | Supported platforms | Notes |
|
| Implementation | Supported platforms | Notes |
|
||||||
|----------------|---------------------|-------|
|
|----------------|---------------------|-------|
|
||||||
| `SqfliteQueryExecutor` from `package:drift_sqflite` | Android, iOS | Uses platform channels, Flutter only, no isolate support, doesn't support `flutter test`. Formerly known as `moor_flutter` |
|
| `SqfliteQueryExecutor` from `package:drift_sqflite` | Android, iOS | Uses platform channels, Flutter only, no isolate support, doesn't support `flutter test`. Formerly known as `moor_flutter` |
|
||||||
| `NativeDatabase` from `package:drift/native.dart` | Android, iOS, Windows, Linux, macOS | No further setup is required for Flutter users. For support outside of Flutter, or in `flutter test`, see the [desktop](#desktop) section below. Usage in a [isolate]({{ 'Advanced Features/isolates.md' | pageUrl }}) is recommended. Formerly known as `package:moor/ffi.dart`. |
|
| `NativeDatabase` from `package:drift/native.dart` | Android, iOS, Windows, Linux, macOS | No further setup is required for Flutter users. For support outside of Flutter, or in `flutter test`, see the [desktop](#desktop) section below. Usage in a [isolate]({{ '../Advanced Features/isolates.md' | pageUrl }}) is recommended. Formerly known as `package:moor/ffi.dart`. |
|
||||||
| `WasmDatabase` from `package:drift/wasm.dart` | Web | Works with or without Flutter. A bit of [additional setup]({{ 'Other engines/web.md' | pageUrl }}) is required. |
|
| `WasmDatabase` from `package:drift/wasm.dart` | Web | Works with or without Flutter. A bit of [additional setup]({{ 'web.md' | pageUrl }}) is required. |
|
||||||
| `WebDatabase` from `package:drift/web.dart` | Web | Deprecated in favor of `WasmDatabase`. |
|
| `WebDatabase` from `package:drift/web.dart` | Web | Deprecated in favor of `WasmDatabase`. |
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
@ -47,7 +48,7 @@ is maintaned and supported too.
|
||||||
### using `drift/native`
|
### using `drift/native`
|
||||||
|
|
||||||
The new `package:drift/native.dart` implementation uses `dart:ffi` to bind to sqlite3's native C apis.
|
The new `package:drift/native.dart` implementation uses `dart:ffi` to bind to sqlite3's native C apis.
|
||||||
This is the recommended approach for newer projects as described in the [getting started]({{ "setup.md" | pageUrl }}) guide.
|
This is the recommended approach for newer projects as described in the [getting started]({{ "../setup.md" | pageUrl }}) guide.
|
||||||
|
|
||||||
To ensure that your app ships with the latest sqlite3 version, also add a dependency to the `sqlite3_flutter_libs`
|
To ensure that your app ships with the latest sqlite3 version, also add a dependency to the `sqlite3_flutter_libs`
|
||||||
package when using `package:drift/native.dart`!
|
package when using `package:drift/native.dart`!
|
||||||
|
@ -73,12 +74,12 @@ However, there are some smaller issues on some devices that you should be aware
|
||||||
|
|
||||||
## Web
|
## Web
|
||||||
|
|
||||||
_Main article: [Web]({{ "Other engines/web.md" | pageUrl }})_
|
_Main article: [Web]({{ "web.md" | pageUrl }})_
|
||||||
|
|
||||||
For apps that run on the web, you can use drift's experimental web implementation, located
|
Drift runs on the web by compiling sqlite3 to a WebAssembly module. This database
|
||||||
in `package:drift/web.dart`.
|
can be accessed using a `WasmDatabase` in `package:drift/wasm.dart`.
|
||||||
As it binds to [sql.js](https://github.com/sql-js/sql.js), special setup is required. Please
|
For optimal support across different browsers, a worker script and some additional
|
||||||
read the main article for details.
|
setup is required. The main article explains how to set up drift to work on the web.
|
||||||
|
|
||||||
## Desktop
|
## Desktop
|
||||||
|
|
||||||
|
@ -142,7 +143,7 @@ lives next to your application:
|
||||||
{% include "blocks/snippet" snippets = snippets %}
|
{% include "blocks/snippet" snippets = snippets %}
|
||||||
|
|
||||||
Be sure to use drift _after_ you set the platform-specific overrides.
|
Be sure to use drift _after_ you set the platform-specific overrides.
|
||||||
When you use drift in [another isolate]({{ 'Advanced Features/isolates.md' | pageUrl }}),
|
When you use drift in [another isolate]({{ '../Advanced Features/isolates.md' | pageUrl }}),
|
||||||
you'll also need to apply the opening overrides on that background isolate.
|
you'll also need to apply the opening overrides on that background isolate.
|
||||||
You can call them in the isolate's entrypoint before using any drift apis.
|
You can call them in the isolate's entrypoint before using any drift apis.
|
||||||
|
|
|
@ -52,7 +52,7 @@ If you're wondering why so many packages are necessary, here's a quick overview
|
||||||
- `drift`: This is the core package defining the APIs you use to access drift databases.
|
- `drift`: This is the core package defining the APIs you use to access drift databases.
|
||||||
- `sqlite3_flutter_libs`: Ships the latest `sqlite3` version with your Android or iOS app. This is not required when you're _not_ using Flutter,
|
- `sqlite3_flutter_libs`: Ships the latest `sqlite3` version with your Android or iOS app. This is not required when you're _not_ using Flutter,
|
||||||
but then you need to take care of including `sqlite3` yourself.
|
but then you need to take care of including `sqlite3` yourself.
|
||||||
For an overview on other platforms, see [platforms]({{ 'platforms.md' | pageUrl }}).
|
For an overview on other platforms, see [platforms]({{ 'Platforms/index.md' | pageUrl }}).
|
||||||
Note that the `sqlite3_flutter_libs` package will include the native sqlite3 library for the following
|
Note that the `sqlite3_flutter_libs` package will include the native sqlite3 library for the following
|
||||||
architectures: `armv8`, `armv7`, `x86` and `x86_64`.
|
architectures: `armv8`, `armv7`, `x86` and `x86_64`.
|
||||||
Most Flutter apps don't run on 32-bit x86 devices without further setup, so you should
|
Most Flutter apps don't run on 32-bit x86 devices without further setup, so you should
|
||||||
|
|
|
@ -73,7 +73,7 @@ Drift has primary first-class support for Android, iOS, macOS, Linux Windows and
|
||||||
|
|
||||||
Other database libraries can easily be integrated into drift as well.
|
Other database libraries can easily be integrated into drift as well.
|
||||||
|
|
||||||
[All platforms]({{ "docs/platforms.md" | pageUrl }})
|
[All platforms]({{ "docs/Platforms/index.md" | pageUrl }})
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@ If you're wondering why so many packages are necessary, here's a quick overview
|
||||||
- `drift`: This is the core package defining the APIs you use to access drift databases.
|
- `drift`: This is the core package defining the APIs you use to access drift databases.
|
||||||
- `sqlite3_flutter_libs`: Ships the latest `sqlite3` version with your Android or iOS app. This is not required when you're _not_ using Flutter,
|
- `sqlite3_flutter_libs`: Ships the latest `sqlite3` version with your Android or iOS app. This is not required when you're _not_ using Flutter,
|
||||||
but then you need to take care of including `sqlite3` yourself.
|
but then you need to take care of including `sqlite3` yourself.
|
||||||
For an overview on other platforms, see [platforms]({{ '../platforms.md' | pageUrl }}).
|
|
||||||
Note that the `sqlite3_flutter_libs` package will include the native sqlite3 library for the following
|
Note that the `sqlite3_flutter_libs` package will include the native sqlite3 library for the following
|
||||||
architectures: `armv8`, `armv7`, `x86` and `x86_64`.
|
architectures: `armv8`, `armv7`, `x86` and `x86_64`.
|
||||||
Most Flutter apps don't run on 32-bit x86 devices without further setup, so you should
|
Most Flutter apps don't run on 32-bit x86 devices without further setup, so you should
|
||||||
|
|
Loading…
Reference in New Issue