DB class

Facade for the database system.

Provides quick access to database connections, query builders and transaction helpers via static methods, e.g. DB.table('users').

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

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

schema → SchemaBuilder
Gets the schema builder.
no setter

Static Methods

connection([String? name]) → DatabaseConnection
Gets the current connection.
delete(String query, [List bindings = const []]) → Future
Executes a delete statement.
insert(String query, [List bindings = const []]) → Future
Executes an insert statement.
select(String query, [List bindings = const []]) → Future
Executes a raw SQL query.
statement(String query, [List bindings = const []]) → Future
Executes a general statement.
table(String table) → QueryBuilderInterface
Begins a new query against a table.
transaction<T>(Future<T> callback(), {Duration retryDelay = const Duration(milliseconds: 100), Future<void> onSuccess(T result)?, Future<void> onFailure(dynamic error)?, Future<void> onFinally()?, String? isolationLevel}) → Future<T>
Runs a transaction.
update(String query, [List bindings = const []]) → Future
Executes an update statement.