datastore library

This file contains the abstract interfaces for the datastore. Libraries defining Endpoints likely wish to include this library to acccess the DataStore interface.

Classes

ClassInfo<T>
Used to lookup type information for a given class. One will be generated for each class annotated with Transportable or Storable.
Collection<T>
Abstract baseclass for Collections of a specific type. DataStore subclasses must implement this to return a Collection which knows how to query and update a given collection/table in the datastore corresponding to a type.
DataStore
Abstract interface to the datastore. This is currently used as a singleton, and should be initialized with a concrete implementation. e.g. await DataStore.initSingleton(DataStoreRemote()); LocalDataStore is used when storing locally in a file. RemoteDataStore is used when connecting to a remote database.
DataStoreLocal
An implementation of DataStore that uses Sembast as a local database. Sembast is simple, but production ready for small/simple workloads. This flavor of the Datastore can also be used on-device or in the browser. See https://pub.dev/packages/sembast
DataStoreRemote
An implementation of DataStore that uses MongoDb.
EqSelector
Selector for testing a field for a specific value.
GteSelector
Selector for testing a field for a value greater than or equal to.
IdSelector
Selector for looking up by id.
LimitSelector
Selector for limiting the number of results.
LteSelector
Selector for testing a field for a value less than or equal to.
ObjectId
ObjectIdConverter
Annotation for json_serializable to generate a fromJson and toJson method for ObjectId Should be removed once Storable is implemented.
Selector
Baseclass for all selectors. Never instantiated directly. Selectors are never built directly, but instead through SelectorBuilder.
SelectorBuilder
The main interface through which Selectors are built. This is modeled after mongo_dart_query, however unlike mongo_dart_query this is immutable. Typically used via the global where variable. e.g. where.eq('name', 'Bob').gt('age', 18).limit(10)
SortBySelector
Selector for sorting results.

Constants

where → const SelectorBuilder
Used for building queries for the datastore. e.g. where.eq('name', 'Bob').gt('age', 18).limit(10)

Functions

lookupClassInfo<T>(Map<Type, ClassInfo> classInfoMap) ClassInfo<T>
This is needed to perform the cast from ClassInfo