Add Scala Json wrapper

This commit is contained in:
2025-03-29 17:08:12 -04:00
parent 4e6cfa35a7
commit 53dd31b913
4 changed files with 470 additions and 25 deletions

View File

@@ -26,7 +26,7 @@ object Json {
Custom.jsonArray(FindQuery.all(tableName) + (orderBy?.let(::orderBy) ?: ""), listOf(), conn, Results::jsonFromData)
/**
* Retrieve all documents in the given table
* Retrieve all documents in the given table (creates connection)
*
* @param tableName The table from which documents should be retrieved
* @param orderBy Fields by which the query should be ordered (optional, defaults to no ordering)
@@ -72,7 +72,7 @@ object Json {
)
/**
* Retrieve a document by its ID
* Retrieve a document by its ID (creates connection)
*
* @param tableName The table from which the document should be retrieved
* @param docId The ID of the document to retrieve
@@ -114,7 +114,7 @@ object Json {
}
/**
* Retrieve documents using a field comparison, ordering results by the given fields
* Retrieve documents using a field comparison, ordering results by the given fields (creates connection)
*
* @param tableName The table from which documents should be retrieved
* @param fields The fields which should be compared
@@ -177,7 +177,8 @@ object Json {
)
/**
* Retrieve documents using a JSON containment query, ordering results by the given fields (PostgreSQL only)
* Retrieve documents using a JSON containment query, ordering results by the given fields (PostgreSQL only; creates
* connection)
*
* @param tableName The table from which documents should be retrieved
* @param criteria The object for which JSON containment should be checked
@@ -226,7 +227,8 @@ object Json {
)
/**
* Retrieve documents using a JSON Path match query, ordering results by the given fields (PostgreSQL only)
* Retrieve documents using a JSON Path match query, ordering results by the given fields (PostgreSQL only; creates
* connection)
*
* @param tableName The table from which documents should be retrieved
* @param path The JSON path comparison to match
@@ -284,7 +286,7 @@ object Json {
}
/**
* Retrieve the first document using a field comparison and optional ordering fields
* Retrieve the first document using a field comparison and optional ordering fields (creates connection)
*
* @param tableName The table from which documents should be retrieved
* @param fields The fields which should be compared
@@ -361,7 +363,8 @@ object Json {
firstByContains(tableName, criteria, null, conn)
/**
* Retrieve the first document using a JSON containment query and optional ordering fields (PostgreSQL only)
* Retrieve the first document using a JSON containment query and optional ordering fields (PostgreSQL only; creates
* connection)
*
* @param tableName The table from which documents should be retrieved
* @param criteria The object for which JSON containment should be checked
@@ -410,7 +413,8 @@ object Json {
firstByJsonPath(tableName, path, null, conn)
/**
* Retrieve the first document using a JSON Path match query and optional ordering fields (PostgreSQL only)
* Retrieve the first document using a JSON Path match query and optional ordering fields (PostgreSQL only; creates
* connection)
*
* @param tableName The table from which documents should be retrieved
* @param path The JSON path comparison to match