aim_postgres 0.2.0
aim_postgres: ^0.2.0 copied to clipboard
A native PostgreSQL driver for Dart with full wire protocol implementation. Supports SSL/TLS, SCRAM-SHA-256 authentication, and parameterized queries.
0.2.0 #
Features #
- Connection pooling:
PostgresDatabase.connect()now manages a pool of connections. New named parametersmaxConnections(default 10),acquireTimeout(30s),idleTimeout(10min),maxLifetime(30min) andvalidationInterval(30s).PostgresDatabase.poolStatsexposes aPoolStatssnapshot.PoolTimeoutExceptionis thrown when no connection becomes available in time. - Queries on a single connection are now serialized, so concurrent queries inside one transaction no longer corrupt the protocol stream.
PostgresConnection.isBroken,isClosedandping().
Fixes #
- Concurrent
query()/execute()calls on onePostgresDatabasepreviously interleaved on a single socket. They now run on separate pooled connections.
Behaviour changes #
db.query()/db.execute()inside atransaction()callback now run on a separate pooled connection and are not part of the transaction; usetx.- Session state (
TEMPtables,SET,LISTEN, advisory locks) no longer persists across calls. UsemaxConnections: 1to keep the old single-connection behaviour. - A connection returned to the pool while inside a transaction (manual
BEGINviaexecute()) is discarded rather than reused. acquireTimeoutbounds each blocking step of acquiring a connection (validation, connect, wait).
0.1.1 #
See Release Notes
0.1.0 #
See Release Notes
0.0.1 #
Initial release of aim_postgres - A native PostgreSQL driver for Dart.
Features #
-
PostgreSQL Wire Protocol:
- Full implementation of PostgreSQL protocol version 3.0
- Simple Query Protocol for static SQL
- Extended Query Protocol for parameterized queries
- Message parsing for all common message types
-
SSL/TLS Support:
- Multiple SSL modes: disable, allow, prefer, require, verify-ca, verify-full
- CA certificate verification
- Hostname verification (verify-full mode)
-
Authentication:
- Cleartext password authentication
- MD5 password authentication
- SCRAM-SHA-256 authentication (PostgreSQL 10+)
-
Query Execution:
query()method for SELECT statementsexecute()method for INSERT/UPDATE/DELETE- Positional parameters (
$1,$2, ...) - Named parameters (
:name,:id, ...) - Automatic parameter conversion (int, double, String, bool, DateTime)
-
Transactions:
transaction()method with callback- Automatic COMMIT on success
- Automatic ROLLBACK on error
-
Notice Messages:
- Stream-based notice/warning message handling
- Access via
connection.noticeMessagestream
Supported #
- Dart SDK:
^3.10.0 - PostgreSQL: 9.5+ (SCRAM-SHA-256 requires PostgreSQL 10+)
What's Included #
PostgresDatabase- High-level database APIPostgresConnection- Low-level connection handlingPostgresTransaction- Transaction contextQueryResult- Query result containerQueryException- Query error handling- SSL mode enums and authentication type enums