mirror of https://github.com/AMT-Cheif/drift.git
Update docs for 1.3
This commit is contained in:
parent
7a44224370
commit
ea776f8637
|
@ -12,7 +12,7 @@ dev_dependencies:
|
||||||
```
|
```
|
||||||
We're going to use the `moor_flutter` library to specify tables and access the database. The
|
We're going to use the `moor_flutter` library to specify tables and access the database. The
|
||||||
`moor_generator` library will take care of generating the necessary code so the
|
`moor_generator` library will take care of generating the necessary code so the
|
||||||
library knows how your table structure looks like.
|
library knows what your table structure looks like.
|
||||||
|
|
||||||
### Declaring tables
|
### Declaring tables
|
||||||
Using moor, you can model the structure of your tables with simple dart code:
|
Using moor, you can model the structure of your tables with simple dart code:
|
||||||
|
@ -52,11 +52,11 @@ class MyDatabase {
|
||||||
|
|
||||||
__⚠️ Note:__ The column definitions, the table name and the primary key must be known at
|
__⚠️ Note:__ The column definitions, the table name and the primary key must be known at
|
||||||
compile time. For column definitions and the primary key, the function must use the `=>`
|
compile time. For column definitions and the primary key, the function must use the `=>`
|
||||||
operator and can't contain anything more than what's included in this `readme` and the
|
operator and can't contain anything more than what's included in the documentation and the
|
||||||
examples. Otherwise, the generator won't be able to know what's going on.
|
examples. Otherwise, the generator won't be able to know what's going on.
|
||||||
|
|
||||||
### Generating the code
|
### Generating the code
|
||||||
Moor integrates with the dart `build` system, so you can generate all the code needed with
|
Moor integrates with Dart's `build` system, so you can generate all the code needed with
|
||||||
`flutter packages pub run build_runner build`. If you want to continously rebuild the generated code
|
`flutter packages pub run build_runner build`. If you want to continously rebuild the generated code
|
||||||
whever you change your code, run `flutter packages pub run build_runner watch` instead.
|
whever you change your code, run `flutter packages pub run build_runner watch` instead.
|
||||||
After running either command once, the moor generator will have created a class for your
|
After running either command once, the moor generator will have created a class for your
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
{% comment %} Changes from upstream here to include pub badge {% endcomment %}
|
{% comment %} Changes from upstream here to include pub badge {% endcomment %}
|
||||||
<ul class="list-style-none text-small mt-md-1 mb-md-1 pb-4 pb-md-0 js-aux-nav aux-nav">
|
<ul class="list-style-none text-small mt-md-1 mb-md-1 pb-4 pb-md-0 js-aux-nav aux-nav">
|
||||||
<li><a href="https://pub.dartlang.org/packages/moor_flutter"><img src="https://img.shields.io/pub/v/moor_flutter.svg" /></a></li>
|
<li><a href="https://pub.dartlang.org/packages/moor_flutter"><img src="https://img.shields.io/pub/v/moor_flutter.svg" /></a></li>
|
||||||
|
<li><a href="{{site.github_link}}"><img src="https://img.shields.io/badge/repo-24292E.svg?logo=github&style=flat"></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -102,6 +102,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.aux-nav li {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
.navigation-list-toggle {
|
.navigation-list-toggle {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: $sp-4;
|
right: $sp-4;
|
||||||
|
|
|
@ -29,30 +29,17 @@ now run your queries with fluent Dart code
|
||||||
|
|
||||||
## [Writing queries]({{"queries" | absolute_url }})
|
## [Writing queries]({{"queries" | absolute_url }})
|
||||||
|
|
||||||
|
## TODO-List
|
||||||
|
There are some sql features like `group by` statements which aren't natively supported by moor yet.
|
||||||
## TODO-List and current limitations
|
However, as moor supports [custom sql queries]({{"queries/custom" | absolute_url}}), there are easy
|
||||||
|
workarounds for most entries on this list. Custom queries work well together with the regular api,
|
||||||
|
as they integrate with stream queries and automatic result parsing.
|
||||||
### Limitations (at the moment)
|
### Limitations (at the moment)
|
||||||
Please note that a workaround for most on this list exists with custom statements.
|
|
||||||
|
|
||||||
- No `group by` or window functions
|
|
||||||
|
|
||||||
### Planned for the future
|
|
||||||
These aren't sorted by priority. If you have more ideas or want some features happening soon,
|
These aren't sorted by priority. If you have more ideas or want some features happening soon,
|
||||||
let me know by [creating an issue]({{site.github_link}}/issues/new)!
|
let me know by [creating an issue]({{site.github_link}}/issues/new)!
|
||||||
- Simple `COUNT(*)` operations (group operations will be much more complicated)
|
- No `group by`, count, or window functions
|
||||||
- Support Dart VM apps
|
- Support other platforms:
|
||||||
- References
|
- VM apps
|
||||||
- DSL API
|
- Web apps via `AlaSQL` or a different engine?
|
||||||
- Support in generator
|
- References (can be expressed via custom constraints, see issue [#14](https://github.com/simolus3/moor/issues/14))
|
||||||
- Validations
|
|
||||||
- Bulk inserts
|
|
||||||
- When inserts / updates fail due to invalid data, explain why that happened
|
- When inserts / updates fail due to invalid data, explain why that happened
|
||||||
### Interesting stuff that would be nice to have
|
|
||||||
Implementing this will very likely result in backwards-incompatible changes.
|
|
||||||
|
|
||||||
- Find a way to hide implementation details from users while still making them
|
|
||||||
accessible for the generated code
|
|
||||||
- `GROUP BY` grouping functions
|
|
||||||
- Support for different database engines
|
|
||||||
- Support webapps via `AlaSQL` or a different engine
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ dependencies:
|
||||||
build_runner: '>=1.1.0 <1.4.0'
|
build_runner: '>=1.1.0 <1.4.0'
|
||||||
build_config: ^0.3.1
|
build_config: ^0.3.1
|
||||||
moor: ^1.3.0
|
moor: ^1.3.0
|
||||||
|
meta: '>= 1.0.0 <2.0.0'
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
test: ^1.6.0
|
test: ^1.6.0
|
||||||
|
|
Loading…
Reference in New Issue