Protected_Protected_Protected_Protected_Protected_StaticPKEY_The string identifier for primary keys, mapped to 'id' by default.
Protected_Convert array into SQL expression
Array of strings or numbers
string
Protected_Resolves the canonical database path for a record, respecting standard collection structures and hierarchical subcollection configurations.
Optionaluid: stringProtected_Protected_Ensures that the database table for the given DataObject's collection exists. If the table does not exist, it automatically creates it. Additionally, ensures that any related join tables for ObjectProperty references are also created so that LEFT JOIN queries do not crash on non-existent tables.
The DataObject payload defining properties and collection.
A promise resolving when the table and relation tables exist.
Protected_Dynamically ensures that a table exists with the correct columns derived from properties. Deduplicates column definitions by lowercase name to prevent SQL parser errors (e.g. "column 'name' specified more than once") when child models override base properties.
The name of the table to verify/create.
The schema properties mapping to columns.
A promise resolving when the table is successfully created or verified.
Protected_Process data for compatibility
Protected_Protected_Processes raw data entries to convert relational reference objects into native database foreign key IDs
if the adapter has been configured with useNativeForeignKeys = true.
Protected_Resolves the table/collection name for a given model or relation reference. Accounts for mapping definitions, class constructors, or raw string types.
The relation constructor, class, or collection name string.
The resolved table/collection name.
Executes an aggregation operation (sum, avg, distinct, min, max, count) on a query. The default implementation fetches all matching records and performs in-memory aggregation. Specific database adapters should override this to perform native query aggregation.
The Query instance defining the collection and filters.
The aggregate operation.
Optionalproperty: stringThe name of the property to aggregate.
A promise resolving to the aggregated result.
Translates a DataObject creation request into an INSERT INTO SQL query.
Generates a UUID automatically if none is requested.
The DataObject payload.
Optional explicit UUID to use as primary key.
A promise resolving to the saved DataObject.
Handles object deletion. Converts to an UPDATE query setting status if soft-deleted,
or a DELETE FROM query if hardDelete is forced.
The DataObject to remove.
Force an absolute SQL DELETE regardless of softDelete configs.
A promise resolving to the processed DataObject.
Clears an entire table using a high-speed SQL TRUNCATE TABLE command.
The table name to truncate.
Ignored in Postgres as TRUNCATE handles all rows.
Removes a middleware from the pipeline by its class name.
The exact name of the middleware class to remove.
Disconnect the pool and close all idle connections.
Orchestrates the sequential execution of all attached middlewares for a given action.
The payload traversing the middlewares.
The context (READ, CREATE, UPDATE, DELETE).
Whether to run the before or after pipeline.
Optionalparams: MiddlewareParamsOptional parameters passed down to the middlewares.
A promise resolving to the potentially mutated DataObject.
Translates Quatrain's Query logic (Filters, Limits) into a complex SQL SELECT statement.
Supports ILIKE string searches, JSONB array traversals, and relational joins.
The template DataObject defining the table and mapping.
Active Filters limiting the result set.
Limit, batch size, and sorting configurations.
Optional parent context for scoping queries.
A promise resolving to hydrated objects and count metadata.
Generates the SQL CREATE TABLE and DROP TABLE statements required to initialize
a collection's storage in PostgreSQL, mapping Quatrain Property types to SQL Column types.
The table name.
The property dictionary of the model.
Up and Down migration SQL strings.
Generates the SQL ALTER TABLE statements to apply a schema delta (add/drop columns).
The table name.
The SchemaDelta tracking property additions/removals.
Arrays of Up and Down migration SQL statements.
Helper method to extract the destination collection name from a DataObject.
The DataObject evaluating the context.
The resolved collection string.
Retrieves a specific configuration parameter.
The parameter key to fetch.
The value associated with the key, or undefined.
Returns true if a given middleware is attached
boolean
Process Query instance and return result
Array
Executes an arbitrary raw SQL query against the Postgres database.
The SQL statement with optional $1, $2 parameterized placeholders.
Optionalparams: any[]The array of parameter values to inject into the query.
A promise resolving to the pg QueryResult.
Translates a read request into a SELECT * ... LEFT JOIN ... query.
Automatically handles joins for relational ObjectProperty fields.
The DataObject to populate, containing the UID to fetch.
A promise resolving to the populated DataObject.
Overrides or adds a backend configuration parameter dynamically.
The parameter key to modify.
The new value to assign.
Translates an update request into an UPDATE ... SET ... query.
Uses ignoreUnchanged to efficiently update only modified fields.
The DataObject containing modifications.
A promise resolving to the updated DataObject.
Backend adapter implementation for PostgreSQL databases. Translates Quatrain's DataObjects and Queries into raw SQL queries using the
pgclient. Supports relational schema mapping, JSONB arrays, and advanced filtering.https://en.wikipedia.org/wiki/List_of_SQL_reserved_words