access library

Classes

Connection
A connection to a PostgreSQL database.
DBAccess
The database access transaction. It is designed to used with access.
Not<T>
Used in the whereValues to indicate a negative condition.
Row
Row allows field values to be retrieved as if they were getters.

Constants

notNull → const Not<Null>
Used in the whereValues to represent a not-null condition.
pgCheckViolation → const String
pgDuplicateTable → const String
pgFailedInTransaction → const String
pgForeignKeyViolation → const String
pgIntegrityConstraintViolation → const String
pgInvalidRegex → const String
pgNoData → const String
pgNotNullViolation → const String
pgOutOfMemory → const String
pgProgramLimitExceeded → const String
pgSuccessfulCompletion → const String
pgUndefinedObject → const String
pgUndefinedTable → const String
pgUniqueViolation → const String
pgWarning → const String

Properties

accessCount int
Returns the number of accesses being executing.
no setter

Functions

access<T>(FutureOr<T> command(DBAccess access)) Future<T>
Executes a command within a transaction.
configure(Pool pool, {Duration? slowSqlThreshold, void onSlowSql(Map<String, dynamic> dataset, Duration timeSpent, String sql, dynamic values)?, FutureOr onPreSlowSql(Connection conn, Map<String, dynamic> dataset, String message)?, void onQuery(String sql, dynamic values)?, void onExecute(String sql, dynamic values)?, String getErrorMessage(String sql, dynamic values)?, bool shallLogError(DBAccess access, String sql, Object ex)?}) → Pool?
Configures the access library.
firstColumns(Iterable<Row> rows) List
Collects the first column of Row into a list.
isForeignKeyViolation(dynamic ex) bool
Whether it is PostgresqlException about the violation of foreign keys.
isNotNullViolation(dynamic ex) bool
Whether it is PostgresqlException about the violation of foreign keys.
isUniqueViolation(dynamic ex) bool
Whether it is PostgresqlException about the violation of uniqueness. It is useful with select-for-update
isViolation(dynamic ex, String code) bool
Whether it is PostgresqlException about the violation of the given code.
not<T>(T value) Not<T>
Used in the whereValues of DBAccess.loadBy, DBAccess.queryBy, and sqlWhereBy to indicate a field shall not be the given value, so-called negative condition.
sqlColumns(Iterable<String>? fields, [String? shortcut]) String
Converts a list of fields to a SQL fragment separated by comma.
sqlWhereBy(Map<String, dynamic> whereValues, [String? append]) String
Returns the where criteria (without where) by anding whereValues.

Exceptions / Errors

PostgresqlException