Add PostgreSQL Support (#3)
Reviewed-on: #3
This commit was merged in pull request #3.
This commit is contained in:
@@ -16,7 +16,7 @@ class Delete
|
||||
*/
|
||||
public static function byId(string $tableName, mixed $docId): void
|
||||
{
|
||||
Custom::nonQuery(Query\Delete::byId($tableName), Parameters::id($docId));
|
||||
Custom::nonQuery(Query\Delete::byId($tableName, $docId), Parameters::id($docId));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -33,4 +33,28 @@ class Delete
|
||||
Custom::nonQuery(Query\Delete::byFields($tableName, $namedFields, $match),
|
||||
Parameters::addFields($namedFields, []));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete documents matching a JSON containment query (`@>`; PostgreSQL only)
|
||||
*
|
||||
* @param string $tableName The table from which documents should be deleted
|
||||
* @param array|object $criteria The JSON containment query values
|
||||
* @throws DocumentException If the database mode is not PostgreSQL, or if an error occurs
|
||||
*/
|
||||
public static function byContains(string $tableName, array|object $criteria): void
|
||||
{
|
||||
Custom::nonQuery(Query\Delete::byContains($tableName), Parameters::json(':criteria', $criteria));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete documents matching a JSON Path match query (`@?`; PostgreSQL only)
|
||||
*
|
||||
* @param string $tableName The table from which documents should be deleted
|
||||
* @param string $path The JSON Path match string
|
||||
* @throws DocumentException If the database mode is not PostgreSQL, or if an error occurs
|
||||
*/
|
||||
public static function byJsonPath(string $tableName, string $path): void
|
||||
{
|
||||
Custom::nonQuery(Query\Delete::byJsonPath($tableName), [':path' => $path]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user