DataStore class abstract

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.

Implementers

Constructors

DataStore.new(Map<Type, ClassInfo> classInfoMap)
DataStore superclass holds the classInfoMap, which is used to lookup static information about classes such as toJson/fromJson methods.
DataStore.of(AuthenticatedContext context)
Look up the DataStore for the current request context. The current implementation is a hack and just returns a singleton.
factory

Properties

classInfoMap Map<Type, ClassInfo>
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

classInfo<T>() ClassInfo<T>
The classInfoMap containing the ClassInfo for models which may be stored in the datastore.
close() Future<void>
Subclasses must implement this to close the datastore.
collection<T>() Collection<T>
Subclasses must implement this to return a collection for the given type. Collection is the main interace for querying and updating a given collection/table in the datastore.
init() Future<void>
Subclasses must implement this to initialize the datastore.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

instance DataStore
no setter

Static Methods

initSingleton(DataStore dataStore) Future<void>
Initialize the singleton DataStore. This should be called before using the DataStore typically in main(). e.g. await DataStore.initSingleton(DataStoreRemote()); shorebird generate will generate a server() which calls this.