Skip to main content

dox_postgres_native 3.0.0-alpha.7 copy "dox_postgres_native: ^3.0.0-alpha.7" to clipboard
dox_postgres_native: ^3.0.0-alpha.7 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.

3.0.0-alpha.7 #

  • The package moved to its own repository: https://github.com/dartondox/dox-postgres-native. The ready-built libraries are on its releases (tag v<version>).

  • Breaking: isolates that open the same settings (and the same maxConnections) now share one pool in Rust, like dox_mysql_native. So maxConnections is for the whole process, not per isolate. Before, 8 isolates with the default of 10 could open 80 connections. Each open counts, and only the last close() closes the pool. The native ABI version is now 2.

  • The prepared statement cache of a connection drops the statement used longest ago when it is full (LRU, 512 statements). Before, it dropped all statements at once.

  • Fewer copies of the result bytes. Rust writes each result straight into the buffer of the next post. A batch of 64 KiB or more goes to Dart without a copy (external typed data).

  • Faster decode of uuid, numeric, date, json and jsonb, without the type registry of the postgres package. A negative numeric below 1 now has its leading zero: -0.5, not -.5 like the postgres package.

  • An int parameter is written as text straight into the request buffer, without a String. It still goes without a type, so the server picks it.

  • The column names are kept per SQL text, not only for the last result. Queries that take turns no longer decode their column names again.

  • Breaking: no more postgres package. This package now has its own @name parser, value encoder and errors. Dox has no Dart driver to fall back to.

  • Breaking: errors are PgException (with message) and PgServerException (with code, severity, detail, hint, schema, table, column, constraint). The ServerException classes of the postgres package are gone.

  • Breaking: parameter values are null, bool, int, double, String, DateTime, Duration, Uint8List (bytea), Map (json) and List (array). Another type throws ArgumentError. TypedValue is gone: use a cast in the SQL (@id::int8 or @id:int8).

  • Breaking: some result types changed. interval is a Duration (a month is 30 days), time is a String like 13:45:01.5, an infinite date or timestamp is 'infinity' or '-infinity', and a type it does not know is its binary bytes (Uint8List).

  • TLS with rustls. New sslMode option: disable (default), prefer, require or verify-full. verify-full checks the certificate and host name with the Mozilla roots and the roots of the system. The TLS settings are part of the pool sharing key.

  • New PgNativePool.fromUrl('postgres://user:pass@host:5432/db?sslmode=require').

  • An error without a server code now tells its cause, eg. error performing TLS handshake: invalid peer certificate: UnknownIssuer.

  • The native ABI version is now 3 (dpg_connect takes the certificate check flag).

3.0.0-alpha.6 #

  • Version bump only, to match the other packages.

3.0.0-alpha.5 #

  • The hook comment says how to fill the sha256 list from a release: dart run bin/native_hashes.dart <tag>. The list stays empty until the first release.
  • A host that starts with / is a Unix socket folder (eg. Cloud SQL /cloudsql/project:region:instance). A test checks it.

3.0.0-alpha.4 #

  • Less work per request. Rust copies a batch of requests once and keeps slices of it, instead of one copy of the SQL and of each parameter. A batch of plain queries uses one timeout timer, not one per query. Dart keeps waiting requests in a list, not a map.

3.0.0-alpha.3 #

  • Column names and types are decoded once per result shape. The next result with the same columns reuses them.
  • Breaking: this package no longer depends on dox_orm. PostgresNativeDriver moved into dox_orm, which now uses it as its default Postgres driver. This package keeps PgNativePool.
  • Fix: a request never got an answer in two cases. A value that Dart can not decode (eg. a timestamp out of the DateTime range) lost every other result of the same batch. A request sent to a transaction after its end (eg. a second rollback) was dropped. Both now fail with a clear error.
  • A request that gets no answer in 5 minutes fails with a timeout error (like queryTimeout of the postgres package). Connect timeout is 15 s. A transaction that Dart does not end in 5 minutes is rolled back, so its connection goes back to the pool.
  • tool/stress.dart: a stress test that finds requests that never finish.
  • Faster queries. Plain queries now share connections: tokio-postgres sends the queries of one connection together (pipelining). One tokio task runs each batch from Dart, not one task per query. The SQL bytes are cached, and binding named parameters builds no extra Set.

3.0.0-alpha.2 #

  • First release.
  • Native Postgres driver: Rust (tokio-postgres, deadpool-postgres) owns the connections. Your code stays in Dart.
  • PostgresNativeDriver for the Dox ORM. Same types and exceptions as the postgres package.
  • PgNativePool: queries, transactions, one pool for many isolates.
0
likes
0
points
3k
downloads

Publisher

verified publisherdartondox.dev

Weekly Downloads

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.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

code_assets, crypto, hooks

More

Packages that depend on dox_postgres_native