electrify function
Future<ElectricClientRaw>
electrify({
- required String dbName,
- required Database db,
- required DBSchema dbDescription,
- required ElectricConfig config,
- ElectrifyOptions? opts,
Electrify a Database
from the sqlite3
package.
WARNING: This is a very raw and low level driver.
It's recommended to use the Drift electrification instead, as it will handle multiple Electric features
automatically for you, like type mappings and query reactivity.
With this electrification you will need to take care of those yourself with
the TypeConverters and with the Notifier from the ElectricClient.
Implementation
Future<ElectricClientRaw> electrify({
required String dbName,
required Database db,
required DBSchema dbDescription,
required ElectricConfig config,
ElectrifyOptions? opts,
}) async {
final adapter = opts?.adapter ?? SqliteAdapter(db);
final socketFactory = opts?.socketFactory ?? getDefaultSocketFactory();
final namespace = await electrify_lib.electrifyBase(
dbName: dbName,
dbDescription: dbDescription,
config: ElectricConfigWithDialect.from(
config: config,
dialect: Dialect.sqlite,
),
adapter: adapter,
socketFactory: socketFactory,
opts: ElectrifyBaseOptions(
migrator: opts?.migrator,
notifier: opts?.notifier,
registry: opts?.registry,
),
);
return namespace;
}