database_sql library
Support for doing something awesome.
More dartdocs go here.
Classes
- AggregateHandler
- A base class to handle aggregate call.
-
AggregatorFunction<
A, R> - A class represent Aggregator Function handler.
- Changes
- Result is the result of a INSERT/DELETE/UPDATE query's execution.
- Database
- A connection to a database.
-
DatabaseFunction<
A, R> - Database Function metadata
-
Driver<
D> - Database driver, each database is required to implement this interface in order to user database interface api.
- ReadStatement
- A statement use for SELECT query or query data in general
- Row
- A default Object represent row database.
- RowReader
- A class provide a method to read data from select query.
-
Rows<
T> - Rows is the result of a SELECT query's execution.
- SQLValue
- A class define a method to convert the dart class into SQL supported value.
- Statement
- Query prepare statement.
- Transaction
- Default transaction class
- ValueReader
- A class provide a method to read value SQL Value or Column from select query.
- WriteStatement
- A statement use for write query such as INSERT, DELETE, UPDATE ...etc.
Extensions
- DatabaseTransaction on Database
- Transaction block style
-
FutureStatement
on Future<
Statement> - Utility to helper to get read/write statement
- SafeDatabaseQuery on Database
- provide ability to ensure the result from query api will be closed even when an exception occurred.
- SafeTransaction on Transaction
- provide ability to ensure the result from query api will be closed even when an exception occurred.
Functions
-
defaultArgumentConverter(
int index, ValueReader reader) → dynamic - Default argument converter, it use when there is not argument converter provided to function.
-
isDriverRegistered(
String driverName) → bool - Return true if driver has been registered otherwise false.
-
open(
String driverName, Object dataSource) → Database - Open a connection to database without pool connection management.
-
protect(
String driverName, Object dataSource, {required Future< void> block(Database)}) → Future<void> -
Open a connection to the database and automatically close it when the
block
callback execution done. -
registerDriver(
String driverName, Driver driver) → void - register a new database driver.
Typedefs
- ArgumentConverter = dynamic Function(int index, ValueReader reader)
- A function to allow the callback to be able to read appropriate data type of value for dart function argument.
-
FunctionResultConverter<
T> = dynamic Function(T) - A function to convert value return by dart function to a compatible data type.
-
FunctionResultHandler<
A, R> = void Function(A, R?) - A function that handle write response back to database engine.
-
RowCreator<
T> = T Function(RowReader reader) - A function which responsible to create Row database from select query.
-
TransactionCreator<
T> = T Function(Database db) - provide custom function to create custom transaction.