Add PostgreSQL Support (#3)

Reviewed-on: #3
This commit was merged in pull request #3.
This commit is contained in:
2024-06-21 13:46:41 +00:00
parent 330e272187
commit 124426fa12
61 changed files with 2290 additions and 223 deletions

View File

@@ -33,4 +33,28 @@ class Count
{
return self::all($tableName) . ' WHERE ' . Query::whereByFields($fields, $match);
}
/**
* Query to count matching documents using a JSON containment query (PostgreSQL only)
*
* @param string $tableName The name of the table in which documents should be counted
* @return string The query to count documents using a JSON containment query
* @throws DocumentException If the database mode is not PostgreSQL
*/
public static function byContains(string $tableName): string
{
return self::all($tableName) . ' WHERE ' . Query::whereDataContains();
}
/**
* Query to count matching documents using a JSON Path match (PostgreSQL only)
*
* @param string $tableName The name of the table in which documents should be counted
* @return string The query to count documents using a JSON Path match
* @throws DocumentException If the database mode is not PostgreSQL
*/
public static function byJsonPath(string $tableName): string
{
return self::all($tableName) . ' WHERE ' . Query::whereJsonPathMatches();
}
}