create static method
Creates and returns an instance of DartApiDB based on the provided config.
Automatically selects the appropriate database driver based on DbType.
After instantiation, the database connection is established by calling connect().
Throws UnsupportedError if the provided DbType is not supported.
Implementation
static Future<DartApiDB> create(DbConfig config) async {
final DartApiDB db;
switch (config.type) {
case DbType.postgres:
db = PostgresDatabase(config);
case DbType.mysql:
db = MySqlDatabase(config);
case DbType.sqlite:
db = SqliteDatabase(config);
}
await db.connect();
return db;
}