Skip to main content

angel3_sembast 10.0.0 copy "angel3_sembast: ^10.0.0" to clipboard
angel3_sembast: ^10.0.0 copied to clipboard

A plugin service that persist data to Sembast for Angel3 framework.

Sembast Persistent Service for Angel3 #

Pub Version (including pre-releases) Null Safety Discord License

A plugin service that persist data to Sembast for Angel3 framework.

Installation #

Add the following to your pubspec.yaml:

dependencies:
  angel3_sembast: ^10.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:

/path/to/service?foo=bar

The above will query the database to find records where 'foo' equals 'bar'. A record must match every field of the query, and id matches the key of the record.

Sort with $sort: a field name sorts by it in ascending order, and a map of field names to 1 (ascending) or -1 (descending) sorts by each of them:

/path/to/service?$sort=name
await service.index({r'$sort': {'name': -1}});

Removing all records (with allowRemoveAll, or on the server side) removes only those that match the query, if there is one.

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

var queried = await service.index({
  'query': Finder(filter: Filter.equals('foo', 'bar')),
});

See the tests for more usage examples.

Migrating from 9.x to 10.0.0 #

The breaking changes of each release are listed in the CHANGELOG. Those of 10.0.0 that may need changes in an app:

  • Queries: a record matches a query only if it matches every field of it, where matching any field was enough.
  • $sort: -1 sorts in descending order and 1 in ascending order, where they were the other way round. Swap them in your queries.
  • Removing all records removes only those that match the query, if there is one.
  • findOne throws a 404 AngelHttpException when no record matches, where it returned {}.
  • modify and update of an id with no record throw a 404 AngelHttpException, where they created the record. Use create to add one.
  • Ids: the id of the data given to create, modify and update is not stored, as it is the key of the record; id in a query matches the key.
  • Requires angel3_framework 10.
0
likes
160
points
535
downloads

Documentation

API reference

Publisher

verified publisherdukefirehawk.com

Weekly Downloads

A plugin service that persist data to Sembast for Angel3 framework.

Homepage
Repository (GitHub)
View/report issues
Contributing

License

BSD-3-Clause (license)

Dependencies

angel3_framework, sembast

More

Packages that depend on angel3_sembast