dox_postgres_native 3.0.0-alpha.3
dox_postgres_native: ^3.0.0-alpha.3 copied to clipboard
Fast native Postgres client for Dart, the default Postgres driver of the Dox ORM. Rust (tokio-postgres) owns the connections, your code stays in Dart.
dox_postgres_native #
A fast Postgres client for Dart. It is the default Postgres driver of the Dox ORM. Rust (tokio-postgres) owns the connections. Your code stays in Dart.
Values come back with the same Dart types as with the postgres package,
and errors are the same ServerException classes.
import 'package:dox_postgres_native/dox_postgres_native.dart';
void main() async {
PgNativePool pool = PgNativePool.open(
host: 'localhost',
user: 'postgres',
password: 'postgres',
database: 'postgres',
);
PgNativeResult result = await pool.query(
'SELECT id, name FROM users WHERE id = @id',
parameters: <String, dynamic>{'id': 1},
);
print(result.rows);
}
With the Dox ORM you do not add this package. dox_orm depends on it and
uses it by default. Set DOX_DB_DRIVER=dart to use the Dart driver.
- The build hook downloads a ready-built library when one exists for your
system. Else it builds it with
cargo(install Rust with rustup). - Use
dart run,dart testordart build cli.dart compile exedoes not run build hooks. - Not yet: SSL.
More: Native Postgres driver.