angel_sembast 1.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 46

sembast #

Pub build status

package:sembast-powered CRUD services for the Angel framework.

Installation #

Add the following to your pubspec.yaml:

  angel_sembast: ^1.0.0

Usage #

This library exposes one main class: SembastService.

SembastService #

This class interacts with a Database and Store (from package:sembast) and serializes data to and from Maps.

Querying #

You can query these services as follows:


The above will query the database to find records where 'foo' equals 'bar'.

The former will sort result in ascending order of creation, and so will the latter.

List queried = await MyService.index({r"query": Finder(filter: new Filter(...))));

Of course, you can use package:sembast queries. Just pass it as query within params.

See the tests for more usage examples.

1.0.1 #

  • Fix flaw where clients could remove all records, even if allowRemoveAll were false.

1.0.0 #

  • First release.


import 'package:angel_framework/angel_framework.dart';
import 'package:angel_framework/http.dart';
import 'package:angel_sembast/angel_sembast.dart';
import 'package:logging/logging.dart';
import 'package:sembast/sembast_io.dart';

main() async {
  var app = new Angel();
  var db = await databaseFactoryIo.openDatabase('todos.db');

    ..logger = (new Logger('angel_sembast_example')..onRecord.listen(print))
    ..use('/api/todos', new SembastService(db, store: 'todos'))
    ..shutdownHooks.add((_) => db.close());

  var http = new AngelHttp(app);
  var server = await http.startServer('', 3000);
  var uri =
      new Uri(scheme: 'http', host: server.address.address, port: server.port);
  print('angel_sembast example listening at $uri');

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  angel_sembast: ^1.0.1

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:angel_sembast/angel_sembast.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Dec 9, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.1
  • pana: 0.12.21

Health suggestions

Fix lib/angel_sembast.dart. (-8.17 points)

Analysis of lib/angel_sembast.dart reported 17 hints, including:

line 24 col 14: Unnecessary new keyword.

line 39 col 20: Unnecessary new keyword.

line 46 col 24: Unnecessary new keyword.

line 48 col 24: Unnecessary new keyword.

line 60 col 28: Unnecessary new keyword.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (sembast).


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev <3.0.0
angel_framework ^2.0.0-alpha 2.1.0
sembast ^1.9.5 1.17.2+2 2.1.2
Transitive dependencies
angel_container 1.1.0
angel_model 1.0.3
angel_route 3.1.0+1
charcode 1.1.2
code_buffer 1.0.1
collection 1.14.12
combinator 1.1.0
convert 2.1.1
crypto 2.1.4
dart2_constant 1.0.2+dart2
file 5.1.0
http2 1.0.0
http_parser 3.1.3
http_server 0.9.8+3
intl 0.16.0
matcher 0.12.6
merge_map 1.0.2
meta 1.1.8
mime 0.9.6+3
mock_request 1.0.6
path 1.6.4
quiver 2.1.2+1
quiver_hashcode 2.0.0
recase 2.0.1
source_span 1.5.5
stack_trace 1.9.3
string_scanner 1.0.5
synchronized 2.1.1
term_glyph 1.1.0
tuple 1.0.3
typed_data 1.1.6
uuid 2.0.4
Dev dependencies
angel_http_exception ^1.0.0 1.1.0
logging any 0.11.3+2
pedantic ^1.0.0 1.9.0
test ^1.0.0