DatabaseConnection class

A database connection managed by drift. Contains three components:

  • a SqlTypeSystem, which is responsible to map between Dart types and values understood by the database engine.
  • a QueryExecutor, which runs sql commands
  • a StreamQueryStore, which dispatches table changes to listening queries, on which the auto-updating queries are based.

Constructors

DatabaseConnection(SqlTypeSystem typeSystem, QueryExecutor executor, StreamQueryStore streamQueries)
Constructs a raw database connection from the three components.
DatabaseConnection.delayed(FutureOr<DatabaseConnection> connection)
Database connection that is instantly available, but delegates work to a connection only available through a Future.
factory
DatabaseConnection.fromExecutor(QueryExecutor executor)
Constructs a DatabaseConnection from the QueryExecutor by using the default type system and a new StreamQueryStore.

Properties

executor QueryExecutor
The executor to use when queries are executed.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
streamQueries → StreamQueryStore
Manages active streams from select statements.
final
typeSystem SqlTypeSystem
The type system to use with this database. The type system is responsible for mapping Dart objects into sql expressions and vice-versa.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
withExecutor(QueryExecutor executor) DatabaseConnection
Returns a database connection that is identical to this one, except that it uses the provided executor.

Operators

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