database library

Classes

AnyExpression<T>
A database expression that returns all rows where any of the related rows match the filtering criteria.
Column<T>
Abstract class representing a database Column. Subclassed by the different supported column types such as ColumnInt or ColumnString.
ColumnBigInt
A Column holding BigInt.
ColumnBit
A Column holding a Bit vector from pgvector.
ColumnBool
A Column holding an bool.
ColumnByteData
A Column holding ByteData.
ColumnComparable<T>
A Column whose values can be compared equal or unequal to other values. Attends full specification of default PG comparison operations: https://www.postgresql.org/docs/current/functions-comparison.html#FUNCTIONS-COMPARISON-OP-TABLE
ColumnCount
A Column holding a count of rows.
ColumnDateTime
A Column holding an DateTime. In the database it is stored as a timestamp without time zone.
ColumnDouble
A Column holding an double.
ColumnDuration
A Column holding Duration.
ColumnEnum<E extends Enum>
A Column holding an enum.
ColumnEnumExtended<E extends Enum>
Intended for internal use only
ColumnExpression<T>
Database expression for a column.
ColumnHalfVector
A Column holding a HalfVector from pgvector.
ColumnInt
A Column holding an int.
ColumnSerializable
A Column holding an SerializableModel. The entity will be stored in the database as a json column.
ColumnSparseVector
A Column holding a SparseVector from pgvector.
ColumnString
A Column holding an String.
ColumnUri
A Column holding Uri.
ColumnUuid
A Column holding UuidValue.
ColumnVector
A Column holding a Vector from pgvector.
ColumnVectorDistance<T>
A Column holding the result of a vector distance operation.
Constant
A constant Expression.
Database
Provides easy access to the database in relation to the current Session.
DatabaseAccessor
Interface for accessing the database.
DatabaseResult
Database result.
DatabaseResultRow
Database result row.
DatabaseResultSchema
Database result schema.
DatabaseResultSchemaColumn
Database result schema column.
DatabaseUtil
Provides utility functions for working with the Database.
EscapedExpression
A database expression that is escaped. This is used to escape values that are not expressions, such as strings and numbers.
EveryExpression<T>
A database expression that returns all rows where all of the related rows match the filtering criteria.
Expression<T>
A database Expression.
HnswIndexQueryOptions
Query options for the HNSW index.
Include
The base include class, should not be used directly.
IncludeList
Defines what tables to join when querying a table.
IncludeObject
Defines what tables to join when querying a table.
IvfflatIndexQueryOptions
Query options for the IVFFLAT index.
ManyRelation<T extends Table>
Many relation field between two tables.
MapRuntimeParameters
Runtime parameters that can be built from a map of options.
NoneExpression<T>
A database expression that returns all rows where none of the related rows match the filtering criteria.
NotExpression
A database expression to invert the result of another expression.
Order
Defines how to order a database column.
PgErrorCode
A class containing constants for PostgreSQL error codes.
QueryParameters
Provides parameters for direct database queries
QueryParametersNamed
Named parameters for direct database queries.
QueryParametersPositional
Positional parameters for direct database queries
RuntimeParameters
Base class for runtime parameters group to apply to the database.
RuntimeParametersBuilder
Builder class for runtime parameters that provides discoverable factory methods. This enables the callback pattern: setRuntimeParameters((params) => ...)
Savepoint
A savepoint in a transaction.
SearchPathsConfig
Search path configuration for database schema resolution.
Table<T_ID>
Represents a database table.
TableRow<T_ID>
Holds data corresponding to a row in the database. Concrete classes are typically generated. Instances of TableRow can also be serialized and either passed to clients or cached.
Transaction
Holds the state of a running database transaction.
TransactionSettings
Settings for a transaction.
TwoPartExpression
A database expression with two parts.
VectorDistanceExpression<T>
Vector distance expression for use with pgvector.
VectorIndexQueryOptions
Query options for vector indexes.

Enums

EnumSerialization
IsolationLevel
Isolation levels for transactions.
IterativeScan
Automatically scan more of the index until enough results are found.

Extensions

IdColumnIterable on Iterable
An extension on iterable for Id columns.
VectorDatabase on Database
Extension to add vector specific utilities to the database.

Functions

createRelationTable<T>({required String relationFieldName, required Column field, required Column foreignField, TableRelation? tableRelation, required T createTable(TableRelation foreignTableRelation)}) → T
Creates a new Table containing TableRelation with information about how the tables are joined.
equalsType<T_ID, Y>() bool
Checks if the type T is equal to type Y (nullable or non-nullable).

Typedefs

ColumnSelections<T extends Table> = List<Column> Function(T)
A function that returns a Column for a Table.
OrderByBuilder<T extends Table> = Column Function(T)
A function that returns a Column for a Table to be used with order by
OrderByListBuilder<T extends Table> = List<Order> Function(T)
A function that returns a list of Order for a Table to be used with order by list.
RuntimeParametersListBuilder = List<RuntimeParameters> Function(RuntimeParametersBuilder params)
A function that returns a list of RuntimeParameters for configuring database runtime parameters.
TransactionFunction<R> = Future<R> Function(Transaction transaction)
A function performing a transaction, passed to the transaction method.
WhereExpressionBuilder<T extends Table> = Expression Function(T)
A function that returns an Expression for a Table to be used with where clauses.

Exceptions / Errors

DatabaseDeleteRowException
Exception thrown when a delete row operation fails.
DatabaseException
Exception thrown when an error occurs in the database.
DatabaseInsertRowException
Exception thrown when an insert row operation fails.
DatabaseQueryException
Exception thrown when an exception occurs during a database query.
DatabaseUpdateRowException
Exception thrown when an update row operation fails.
RollbackToSavepointFailedException
Exception thrown when an attempt to rollback to a savepoint in response to clean up after another exception fails.