Fix some docs, make isOpen lookup faster

This commit is contained in:
Simon Binder 2019-08-17 18:25:56 +02:00
parent c1f6ee8723
commit b26baddd01
No known key found for this signature in database
GPG Key ID: 7891917E4147B8C0
9 changed files with 14 additions and 11 deletions

View File

@ -40,7 +40,5 @@ updates that span multiple versions, we should follow these steps
The `sqlparser` library can be published independently from moor.
### Building the documentation
We use [jekyll](https://jekyllrb.com/) to write documentation. With
[bundler](https://bundler.io/) installed, you can serve the documentation locally with
`bundler exec jekyll serve`. The generated documentation can be written into the
`docs/_site` folder with `bundler exec jekyll build`.
We use hugo and docsy to build the documentation. The [readme](docs/README.md) contains everything
you need to know go get started.

View File

@ -3,7 +3,8 @@ Contains the source code for the moor documentation, live at moor.simonbinder.eu
We use [Docsy](https://github.com/google/docsy), a Hugo theme for this website. You'll need the extended version of Hugo as described
[here](https://www.docsy.dev/docs/getting-started/).
To work on the documentation, first cd into this directory, then run `git submodule update --init --recursive` an `npm install`.
To work on the documentation, first cd into this directory, then run `git submodule update --init --recursive` and
`npm install`.
## Running the website locally
After the setup, it's just a simple

View File

@ -2,6 +2,8 @@
title: "Type converters"
description: >
Store more complex data in columns with type converters
aliases:
- /type_converters
---
Moor supports a variety of types out of the box, but sometimes you need to store more complex data.

View File

@ -30,7 +30,7 @@ class _SqfliteDelegate extends DatabaseDelegate with _SqfliteExecutor {
_SqfliteTransactionDelegate(this);
@override
Future<bool> get isOpen => Future.value(db != null);
bool get isOpen => db != null;
@override
Future<void> open([GeneratedDatabase db]) async {

View File

@ -60,7 +60,7 @@ class _MySqlDelegate extends DatabaseDelegate with _MySqlExecutor {
_MySqlDelegate(this._settings);
@override
Future<bool> get isOpen async => _connection != null;
bool get isOpen => _connection != null;
@override
Querier get _querier => _connection;

View File

@ -46,7 +46,8 @@ class UseMoor {
/// {@template moor_include_param}
/// Defines the `.moor` files to include when building the table structure for
/// this database.
/// this database. For details on how to integrate `.moor` files into your
/// Dart code, see [the documentation](https://moor.simonbinder.eu/docs/using-sql/custom_tables/).
///
/// Please note that this feature is experimental at the moment.
/// {@endtemplate}

View File

@ -1,3 +1,4 @@
import 'dart:async' show FutureOr;
import 'dart:typed_data' show Uint8List;
import 'package:moor/moor.dart';
import 'package:moor/src/runtime/components/component.dart';
@ -38,7 +39,7 @@ abstract class DatabaseDelegate implements QueryDelegate {
/// `false` when its not. The future may never complete with an error or with
/// null. It should return relatively quickly, as moor queries it before each
/// statement it sends to the database.
Future<bool> get isOpen;
FutureOr<bool> get isOpen;
/// Opens the database. Moor will only call this when [isOpen] has returned
/// false before. Further, moor will not attempt to open a database multiple

View File

@ -38,7 +38,7 @@ class _WebDelegate extends DatabaseDelegate {
DbVersionDelegate get versionDelegate => _WebVersionDelegate(name);
@override
Future<bool> get isOpen => Future.value(_db != null);
bool get isOpen => _db != null;
@override
Future<void> open([GeneratedDatabase db]) async {

View File

@ -46,7 +46,7 @@ class _SqfliteDelegate extends DatabaseDelegate with _SqfliteExecutor {
_SqfliteTransactionDelegate(this);
@override
Future<bool> get isOpen => Future.value(db != null);
bool get isOpen => db != null;
@override
Future<void> open([GeneratedDatabase db]) async {