Bump to 1.1.0
This commit is contained in:
parent
4f27da9d41
commit
39f48b3323
5 changed files with 24 additions and 9 deletions
|
@ -5,7 +5,6 @@
|
|||
<excludeFolder url="file://$MODULE_DIR$/.pub" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/packages" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
||||
</content>
|
||||
|
|
4
CHANGELOG.md
Normal file
4
CHANGELOG.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
# 1.1.0
|
||||
* Updated to framework v1.1.x
|
||||
* Use `package:file`
|
||||
* Allow a custom `store`
|
|
@ -18,6 +18,11 @@ While not necessarily *slow*, this package makes no promises about performance.
|
|||
```dart
|
||||
configureServer(Angel app) async {
|
||||
// Just like a normal service
|
||||
app.use('/api/todos', new JsonFileService(new File('todos_db.json')));
|
||||
app.use(
|
||||
'/api/todos',
|
||||
new JsonFileService(
|
||||
const LocalFileSystem().file('todos_db.json')
|
||||
),
|
||||
);
|
||||
}
|
||||
```
|
|
@ -1,7 +1,7 @@
|
|||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'package:angel_framework/angel_framework.dart';
|
||||
import 'package:file/file.dart';
|
||||
import 'package:pool/pool.dart';
|
||||
|
||||
/// Persists in-memory changes to a file on disk.
|
||||
|
@ -12,10 +12,11 @@ class JsonFileService extends Service {
|
|||
final File file;
|
||||
|
||||
JsonFileService(this.file,
|
||||
{bool allowRemoveAll: false, bool allowQuery: true}) {
|
||||
_store = new MapService(
|
||||
allowRemoveAll: allowRemoveAll == true,
|
||||
allowQuery: allowQuery != false);
|
||||
{bool allowRemoveAll: false, bool allowQuery: true, MapService store}) {
|
||||
_store = store ??
|
||||
new MapService(
|
||||
allowRemoveAll: allowRemoveAll == true,
|
||||
allowQuery: allowQuery != false);
|
||||
}
|
||||
|
||||
_load() async {
|
||||
|
@ -46,6 +47,11 @@ class JsonFileService extends Service {
|
|||
r.release();
|
||||
}
|
||||
|
||||
@override
|
||||
Future close() {
|
||||
return _store.close();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List> index([Map params]) async =>
|
||||
_load().then((_) => _store.index(params));
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
name: angel_file_service
|
||||
version: 1.0.0
|
||||
version: 1.1.0
|
||||
description: Angel service that persists data to a file on disk.
|
||||
author: Tobe O <thosakwe@gmail.com>
|
||||
homepage: https://github.com/angel-dart/file_service
|
||||
environment:
|
||||
sdk: ">=1.19.0"
|
||||
dependencies:
|
||||
angel_framework: ^1.0.0-dev
|
||||
angel_framework: ^1.1.0-alpha
|
||||
file: ^2.0.0
|
||||
pool: ^1.0.0
|
Loading…
Reference in a new issue