DSL References
DSL stands for Domain Specific Language. In Flow, the DSL is a set of small functions that wrap object construction so pipelines read top-to-bottom. See the examples for usage in context.
EXTRACTOR
/**
* Create a PostgreSQL cursor extractor using server-side cursors for memory-efficient extraction.
*
* Uses DECLARE CURSOR + FETCH to stream data without loading entire result set into memory.
* This is the only way to achieve true low memory extraction with PHP's ext-pgsql.
*
* Note: Requires a transaction context (auto-started if not in one).
*
* @param Client $client PostgreSQL client
* @param Sql|string $query SQL query to execute (wrapped in DECLARE CURSOR)
* @param list<mixed> $parameters Values bound by position to $1, $2, ... placeholders; wrap with {@see \Flow\PostgreSql\DSL\typed()} to force a specific PostgreSQL type
*/
from_pgsql_cursor(Client $client, Sql|string $query, array $parameters) : PostgreSqlCursorExtractor /**
* Create a PostgreSQL extractor using keyset (cursor-based) pagination.
*
* More efficient than LIMIT/OFFSET for large datasets - uses indexed WHERE conditions
* instead of skipping rows.
*
* @param Client $client PostgreSQL client
* @param Sql|string $query SQL query to execute (must have ORDER BY matching keyset columns)
* @param KeySet $keySet Columns to use for keyset pagination
* @param list<mixed> $parameters Values bound by position to $1, $2, ... placeholders; wrap with {@see \Flow\PostgreSql\DSL\typed()} to force a specific PostgreSQL type
*/
from_pgsql_key_set(Client $client, Sql|string $query, KeySet $keySet, array $parameters) : PostgreSqlKeySetExtractor /**
* Create a PostgreSQL extractor using LIMIT/OFFSET pagination.
*
* Suitable for smaller datasets. For large datasets, consider using keyset pagination
* (from_pgsql_key_set) which is more efficient.
*
* @param Client $client PostgreSQL client
* @param Sql|string $query SQL query to execute (must have ORDER BY clause)
* @param list<mixed> $parameters Values bound by position to $1, $2, ... placeholders; wrap with {@see \Flow\PostgreSql\DSL\typed()} to force a specific PostgreSQL type
*/
from_pgsql_limit_offset(Client $client, Sql|string $query, array $parameters) : PostgreSqlLimitOffsetExtractor HELPER
/**
* Create delete options for PostgreSQL loader.
*
* @param list<string> $primaryKeys Columns to use in WHERE clause for matching rows
*/
pgsql_delete_options(array $primaryKeys) : DeleteOptions /**
* Create insert options for PostgreSQL loader.
*
* @param bool $skipConflicts If true, use ON CONFLICT DO NOTHING
* @param list<string> $conflictColumns Column names for ON CONFLICT (columns)
* @param null|string $conflictConstraint Constraint name for ON CONFLICT ON CONSTRAINT
* @param list<string> $updateColumns Columns to update on conflict (empty = all non-key columns)
*/
pgsql_insert_options(bool $skipConflicts, array $conflictColumns, ?string $conflictConstraint, array $updateColumns) : InsertOptions pgsql_pagination_key_asc(string $column) : Key pgsql_pagination_key_desc(string $column) : Key pgsql_pagination_key_set(Key $keys) : KeySet pgsql_schema_sort_by_type(?EntryTypesMap $typesMap) : TypeStrategy /**
* Convert a PostgreSQL table definition into a Flow Schema.
*/
pgsql_table_to_flow_schema(Table $table, ?EntryTypesMap $typesMap) : Schema /**
* Create update options for PostgreSQL loader.
*
* @param list<string> $primaryKeys Columns to use in WHERE clause for matching rows
*/
pgsql_update_options(array $primaryKeys) : UpdateOptions /**
* Convert a Flow Schema into a PostgreSQL table definition.
*
* @param string $databaseSchema PostgreSQL schema (namespace) the table belongs to
* @param ?TableOptions $options table-level options the Flow Schema cannot express (e.g. UNLOGGED)
*/
to_pgsql_schema_table(Schema $schema, string $tableName, string $databaseSchema, ?EntryTypesMap $typesMap, ?TableOptions $options) : Table LOADER
to_pgsql_table(Client $client, string $table) : PostgreSqlLoader /**
* Execute multiple loaders within PostgreSQL transactions.
*
* Each batch of rows is loaded in its own transaction; rows a wrapped Transformation delivers when
* the loader is closed (blocking operations drain there) are committed in one final transaction.
* If any loader fails, the open transaction is rolled back.
* All wrapped loaders must use the same Client instance as the wrapper - a loader holding its own
* Client escapes the transaction.
*/
to_pgsql_transaction(Client $client, Loader $loaders) : TransactionalPostgreSqlLoader