PostgresConnector class
Represents a connector for PostgreSQL databases, implementing the
DatabaseConnector interface.
This class provides methods for opening, closing, querying, and managing
transactions within a PostgreSQL database using the provided configuration.
- Implemented types
Constructors
- PostgresConnector(PostgresConfig config)
-
Constructs a new
PostgresConnectorusing the providedPostgresConfig. Initializes the underlying connection using the details from the config.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
closeConnection(
) → Future< void> -
Closes the active connection to the PostgreSQL database.
override
-
commitTransaction(
) → Future< void> -
Commits the active transaction on the PostgreSQL database.
In the
package:postgres, committing a transaction is handled within the transaction itself. The .transaction() method on the connection automatically commits if no exceptions occur.override -
executeQuery(
String query, {List? positionalValues, Map< String, dynamic> ? namedValues}) → Future<QueryResult> -
Executes the provided SQL
queryon the PostgreSQL database. Returns aQueryResultcontaining rows and metadata. Throws anOasisExceptionif the query execution fails.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
openConnection(
) → Future< void> -
Opens a connection to the PostgreSQL database.
Throws an
OasisExceptionif the connection fails.override -
rollbackTransaction(
) → Future< void> -
Rolls back the active transaction on the PostgreSQL database.
In the
package:postgres, rollback happens automatically if an exception occurs in the transaction. This method might be left empty unless you have custom rollback logic.override -
startTransaction(
) → Future< void> -
Starts a transaction on the PostgreSQL database.
Throws an
OasisExceptionif starting the transaction fails.override -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited