Initial Development #1

Merged
danieljsummers merged 88 commits from v1-rc into main 2025-04-16 01:29:20 +00:00
2 changed files with 455 additions and 2 deletions
Showing only changes of commit ae39a585fc - Show all commits

View File

@ -3,6 +3,7 @@ package solutions.bitbadger.documents.scala
import solutions.bitbadger.documents.{Field, FieldMatch} import solutions.bitbadger.documents.{Field, FieldMatch}
import solutions.bitbadger.documents.java.Json as CoreJson import solutions.bitbadger.documents.java.Json as CoreJson
import java.io.PrintWriter
import java.sql.Connection import java.sql.Connection
import _root_.scala.jdk.CollectionConverters.* import _root_.scala.jdk.CollectionConverters.*
@ -21,7 +22,7 @@ object Json:
CoreJson.all(tableName, orderBy.asJava, conn) CoreJson.all(tableName, orderBy.asJava, conn)
/** /**
* Retrieve all documents in the given table, ordering results by the optional given fields * Retrieve all documents in the given table
* *
* @param tableName The table from which documents should be retrieved * @param tableName The table from which documents should be retrieved
* @param conn The connection over which documents should be retrieved * @param conn The connection over which documents should be retrieved
@ -32,7 +33,7 @@ object Json:
CoreJson.all(tableName, conn) CoreJson.all(tableName, conn)
/** /**
* Retrieve all documents in the given table (creates connection) * Retrieve all documents in the given table, ordering results by the optional given fields (creates connection)
* *
* @param tableName The table from which documents should be retrieved * @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) * @param orderBy Fields by which the query should be ordered (optional, defaults to no ordering)
@ -42,6 +43,41 @@ object Json:
def all(tableName: String, orderBy: Seq[Field[?]] = Nil): String = def all(tableName: String, orderBy: Seq[Field[?]] = Nil): String =
CoreJson.all(tableName, orderBy.asJava) CoreJson.all(tableName, orderBy.asJava)
/**
* Write all documents in the given table to the given `PrintWriter`, ordering results by the optional given fields
*
* @param tableName The table from which documents should be retrieved
* @param writer The `PrintWriter` to which the results should be written
* @param orderBy Fields by which the query should be ordered (optional, defaults to no ordering)
* @param conn The connection over which documents should be retrieved
* @throws DocumentException If query execution fails
*/
def writeAll(tableName: String, writer: PrintWriter, orderBy: Seq[Field[?]], conn: Connection): Unit =
CoreJson.writeAll(tableName, writer, orderBy.asJava, conn)
/**
* Write all documents in the given table to the given `PrintWriter`
*
* @param tableName The table from which documents should be retrieved
* @param writer The `PrintWriter` to which the results should be written
* @param conn The connection over which documents should be retrieved
* @throws DocumentException If query execution fails
*/
def writeAll(tableName: String, writer: PrintWriter, conn: Connection): Unit =
CoreJson.writeAll(tableName, writer, conn)
/**
* Write all documents in the given table to the given `PrintWriter`, ordering results by the optional given fields
* (creates connection)
*
* @param tableName The table from which documents should be retrieved
* @param writer The `PrintWriter` to which the results should be written
* @param orderBy Fields by which the query should be ordered (optional, defaults to no ordering)
* @throws DocumentException If query execution fails
*/
def writeAll(tableName: String, writer: PrintWriter, orderBy: Seq[Field[?]]): Unit =
CoreJson.writeAll(tableName, writer, orderBy.asJava)
/** /**
* Retrieve a document by its ID * Retrieve a document by its ID
* *
@ -65,6 +101,29 @@ object Json:
def byId[Key](tableName: String, docId: Key): String = def byId[Key](tableName: String, docId: Key): String =
CoreJson.byId(tableName, docId) CoreJson.byId(tableName, docId)
/**
* Write a document to the given `PrintWriter` by its ID
*
* @param tableName The table from which the document should be retrieved
* @param writer The `PrintWriter` to which the results should be written
* @param docId The ID of the document to retrieve
* @param conn The connection over which documents should be retrieved
* @throws DocumentException If no dialect has been configured
*/
def writeById[Key](tableName: String, writer: PrintWriter, docId: Key, conn: Connection): Unit =
CoreJson.writeById(tableName, writer, docId, conn)
/**
* Write a document to the given `PrintWriter` by its ID (creates connection)
*
* @param tableName The table from which the document should be retrieved
* @param writer The `PrintWriter` to which the results should be written
* @param docId The ID of the document to retrieve
* @throws DocumentException If no dialect has been configured
*/
def writeById[Key](tableName: String, writer: PrintWriter, docId: Key): Unit =
CoreJson.writeById(tableName, writer, docId)
/** /**
* Retrieve documents using a field comparison, ordering results by the given fields * Retrieve documents using a field comparison, ordering results by the given fields
* *
@ -120,6 +179,64 @@ object Json:
orderBy: Seq[Field[?]] = Nil): String = orderBy: Seq[Field[?]] = Nil): String =
CoreJson.byFields(tableName, fields.asJava, howMatched.orNull, orderBy.asJava) CoreJson.byFields(tableName, fields.asJava, howMatched.orNull, orderBy.asJava)
/**
* Write documents to the given `PrintWriter` using a field comparison, ordering results by the given fields
*
* @param tableName The table from which documents should be retrieved
* @param writer The `PrintWriter` to which the results should be written
* @param fields The fields which should be compared
* @param howMatched How the fields should be matched
* @param orderBy Fields by which the query should be ordered (optional, defaults to no ordering)
* @param conn The connection over which documents should be retrieved
* @throws DocumentException If no dialect has been configured, or if parameters are invalid
*/
def writeByFields(tableName: String, writer: PrintWriter, fields: Seq[Field[?]], howMatched: Option[FieldMatch],
orderBy: Seq[Field[?]], conn: Connection): Unit =
CoreJson.writeByFields(tableName, writer, fields.asJava, howMatched.orNull, orderBy.asJava, conn)
/**
* Write documents to the given `PrintWriter` using a field comparison
*
* @param tableName The table from which documents should be retrieved
* @param writer The `PrintWriter` to which the results should be written
* @param fields The fields which should be compared
* @param howMatched How the fields should be matched
* @param conn The connection over which documents should be retrieved
* @throws DocumentException If no dialect has been configured, or if parameters are invalid
*/
def writeByFields(tableName: String, writer: PrintWriter, fields: Seq[Field[?]], howMatched: Option[FieldMatch],
conn: Connection): Unit =
CoreJson.writeByFields(tableName, writer, fields.asJava, howMatched.orNull, conn)
/**
* Write documents to the given `PrintWriter` using a field comparison, ordering results by the given fields
*
* @param tableName The table from which documents should be retrieved
* @param writer The `PrintWriter` to which the results should be written
* @param fields The fields which should be compared
* @param orderBy Fields by which the query should be ordered (optional, defaults to no ordering)
* @param conn The connection over which documents should be retrieved
* @throws DocumentException If no dialect has been configured, or if parameters are invalid
*/
def writeByFields(tableName: String, writer: PrintWriter, fields: Seq[Field[?]], orderBy: Seq[Field[?]],
conn: Connection): Unit =
CoreJson.writeByFields(tableName, writer, fields.asJava, null, orderBy.asJava, conn)
/**
* Write documents to the given `PrintWriter` using a field comparison, ordering results by the given fields (creates
* connection)
*
* @param tableName The table from which documents should be retrieved
* @param writer The `PrintWriter` to which the results should be written
* @param fields The fields which should be compared
* @param howMatched How the fields should be matched
* @param orderBy Fields by which the query should be ordered (optional, defaults to no ordering)
* @throws DocumentException If no dialect has been configured, or if parameters are invalid
*/
def writeByFields(tableName: String, writer: PrintWriter, fields: Seq[Field[?]],
howMatched: Option[FieldMatch] = None, orderBy: Seq[Field[?]] = Nil): Unit =
CoreJson.writeByFields(tableName, writer, fields.asJava, howMatched.orNull, orderBy.asJava)
/** /**
* 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)
* *
@ -158,6 +275,46 @@ object Json:
def byContains[A](tableName: String, criteria: A, orderBy: Seq[Field[?]] = Nil): String = def byContains[A](tableName: String, criteria: A, orderBy: Seq[Field[?]] = Nil): String =
CoreJson.byContains(tableName, criteria, orderBy.asJava) CoreJson.byContains(tableName, criteria, orderBy.asJava)
/**
* Write documents to the given `PrintWriter` using a JSON containment query, ordering results by the given fields
* (PostgreSQL only)
*
* @param tableName The table from which documents should be retrieved
* @param writer The `PrintWriter` to which the results should be written
* @param criteria The object for which JSON containment should be checked
* @param orderBy Fields by which the query should be ordered (optional, defaults to no ordering)
* @param conn The connection over which documents should be retrieved
* @throws DocumentException If called on a SQLite connection
*/
def writeByContains[A](tableName: String, writer: PrintWriter, criteria: A, orderBy: Seq[Field[?]],
conn: Connection): Unit =
CoreJson.writeByContains(tableName, writer, criteria, orderBy.asJava, conn)
/**
* Write documents to the given `PrintWriter` using a JSON containment query (PostgreSQL only)
*
* @param tableName The table from which documents should be retrieved
* @param writer The `PrintWriter` to which the results should be written
* @param criteria The object for which JSON containment should be checked
* @param conn The connection over which documents should be retrieved
* @throws DocumentException If called on a SQLite connection
*/
def writeByContains[A](tableName: String, writer: PrintWriter, criteria: A, conn: Connection): Unit =
CoreJson.writeByContains(tableName, writer, criteria, conn)
/**
* Write documents to the given `PrintWriter` 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 writer The `PrintWriter` to which the results should be written
* @param criteria The object for which JSON containment should be checked
* @param orderBy Fields by which the query should be ordered (optional, defaults to no ordering)
* @throws DocumentException If called on a SQLite connection
*/
def writeByContains[A](tableName: String, writer: PrintWriter, criteria: A, orderBy: Seq[Field[?]] = Nil): Unit =
CoreJson.writeByContains(tableName, writer, criteria, orderBy.asJava)
/** /**
* 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)
* *
@ -196,6 +353,46 @@ object Json:
def byJsonPath(tableName: String, path: String, orderBy: Seq[Field[?]] = Nil): String = def byJsonPath(tableName: String, path: String, orderBy: Seq[Field[?]] = Nil): String =
CoreJson.byJsonPath(tableName, path, orderBy.asJava) CoreJson.byJsonPath(tableName, path, orderBy.asJava)
/**
* Write documents to the given `PrintWriter` using a JSON Path match query, ordering results by the given fields
* (PostgreSQL only)
*
* @param tableName The table from which documents should be retrieved
* @param writer The `PrintWriter` to which the results should be written
* @param path The JSON path comparison to match
* @param orderBy Fields by which the query should be ordered (optional, defaults to no ordering)
* @param conn The connection over which documents should be retrieved
* @throws DocumentException If called on a SQLite connection
*/
def writeByJsonPath(tableName: String, writer: PrintWriter, path: String, orderBy: Seq[Field[?]],
conn: Connection): Unit =
CoreJson.writeByJsonPath(tableName, writer, path, orderBy.asJava, conn)
/**
* Write documents to the given `PrintWriter` using a JSON Path match query (PostgreSQL only)
*
* @param tableName The table from which documents should be retrieved
* @param writer The `PrintWriter` to which the results should be written
* @param path The JSON path comparison to match
* @param conn The connection over which documents should be retrieved
* @throws DocumentException If called on a SQLite connection
*/
def writeByJsonPath(tableName: String, writer: PrintWriter, path: String, conn: Connection): Unit =
CoreJson.writeByJsonPath(tableName, writer, path, conn)
/**
* Write documents to the given `PrintWriter` 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 writer The `PrintWriter` to which the results should be written
* @param path The JSON path comparison to match
* @param orderBy Fields by which the query should be ordered (optional, defaults to no ordering)
* @throws DocumentException If called on a SQLite connection
*/
def writeByJsonPath(tableName: String, writer: PrintWriter, path: String, orderBy: Seq[Field[?]] = Nil): Unit =
CoreJson.writeByJsonPath(tableName, writer, path, orderBy.asJava)
/** /**
* Retrieve the first document using a field comparison and ordering fields * Retrieve the first document using a field comparison and ordering fields
* *
@ -264,6 +461,76 @@ object Json:
orderBy: Seq[Field[?]] = Nil): String = orderBy: Seq[Field[?]] = Nil): String =
CoreJson.firstByFields(tableName, fields.asJava, howMatched.orNull, orderBy.asJava) CoreJson.firstByFields(tableName, fields.asJava, howMatched.orNull, orderBy.asJava)
/**
* Write the first document to the given `PrintWriter` using a field comparison and ordering fields
*
* @param tableName The table from which documents should be retrieved
* @param writer The `PrintWriter` to which the results should be written
* @param fields The fields which should be compared
* @param howMatched How the fields should be matched (optional, defaults to `FieldMatch.ALL`)
* @param orderBy Fields by which the query should be ordered (optional, defaults to no ordering)
* @param conn The connection over which documents should be retrieved
* @throws DocumentException If no dialect has been configured, or if parameters are invalid
*/
def writeFirstByFields(tableName: String, writer: PrintWriter, fields: Seq[Field[?]], howMatched: Option[FieldMatch],
orderBy: Seq[Field[?]], conn: Connection): Unit =
CoreJson.writeFirstByFields(tableName, writer, fields.asJava, howMatched.orNull, orderBy.asJava, conn)
/**
* Write the first document to the given `PrintWriter` using a field comparison
*
* @param tableName The table from which documents should be retrieved
* @param writer The `PrintWriter` to which the results should be written
* @param fields The fields which should be compared
* @param howMatched How the fields should be matched (optional, defaults to `FieldMatch.ALL`)
* @param conn The connection over which documents should be retrieved
* @throws DocumentException If no dialect has been configured, or if parameters are invalid
*/
def writeFirstByFields(tableName: String, writer: PrintWriter, fields: Seq[Field[?]], howMatched: Option[FieldMatch],
conn: Connection): Unit =
CoreJson.writeFirstByFields(tableName, writer, fields.asJava, howMatched.orNull, conn)
/**
* Write the first document to the given `PrintWriter` using a field comparison and ordering fields
*
* @param tableName The table from which documents should be retrieved
* @param writer The `PrintWriter` to which the results should be written
* @param fields The fields which should be compared
* @param orderBy Fields by which the query should be ordered (optional, defaults to no ordering)
* @param conn The connection over which documents should be retrieved
* @throws DocumentException If no dialect has been configured, or if parameters are invalid
*/
def writeFirstByFields(tableName: String, writer: PrintWriter, fields: Seq[Field[?]], orderBy: Seq[Field[?]],
conn: Connection): Unit =
CoreJson.writeFirstByFields(tableName, writer, fields.asJava, null, orderBy.asJava, conn)
/**
* Write the first document to the given `PrintWriter` using a field comparison
*
* @param tableName The table from which documents should be retrieved
* @param writer The `PrintWriter` to which the results should be written
* @param fields The fields which should be compared
* @param conn The connection over which documents should be retrieved
* @throws DocumentException If no dialect has been configured, or if parameters are invalid
*/
def writeFirstByFields(tableName: String, writer: PrintWriter, fields: Seq[Field[?]], conn: Connection): Unit =
CoreJson.writeFirstByFields(tableName, writer, fields.asJava, null, conn)
/**
* Write the first document to the given `PrintWriter` using a field comparison and ordering fields (creates
* connection)
*
* @param tableName The table from which documents should be retrieved
* @param writer The `PrintWriter` to which the results should be written
* @param fields The fields which should be compared
* @param howMatched How the fields should be matched (optional, defaults to `FieldMatch.ALL`)
* @param orderBy Fields by which the query should be ordered (optional, defaults to no ordering)
* @throws DocumentException If no dialect has been configured, or if parameters are invalid
*/
def writeFirstByFields(tableName: String, writer: PrintWriter, fields: Seq[Field[?]],
howMatched: Option[FieldMatch] = None, orderBy: Seq[Field[?]] = Nil): Unit =
CoreJson.writeFirstByFields(tableName, writer, fields.asJava, howMatched.orNull, orderBy.asJava)
/** /**
* Retrieve the first document using a JSON containment query and ordering fields (PostgreSQL only) * Retrieve the first document using a JSON containment query and ordering fields (PostgreSQL only)
* *
@ -302,6 +569,46 @@ object Json:
def firstByContains[A](tableName: String, criteria: A, orderBy: Seq[Field[?]] = Nil): String = def firstByContains[A](tableName: String, criteria: A, orderBy: Seq[Field[?]] = Nil): String =
CoreJson.firstByContains(tableName, criteria, orderBy.asJava) CoreJson.firstByContains(tableName, criteria, orderBy.asJava)
/**
* Write the first document to the given `PrintWriter` using a JSON containment query and ordering fields (PostgreSQL
* only)
*
* @param tableName The table from which documents should be retrieved
* @param writer The `PrintWriter` to which the results should be written
* @param criteria The object for which JSON containment should be checked
* @param orderBy Fields by which the query should be ordered (optional, defaults to no ordering)
* @param conn The connection over which documents should be retrieved
* @throws DocumentException If called on a SQLite connection
*/
def writeFirstByContains[A](tableName: String, writer: PrintWriter, criteria: A, orderBy: Seq[Field[?]],
conn: Connection): Unit =
CoreJson.writeFirstByContains(tableName, writer, criteria, orderBy.asJava, conn)
/**
* Write the first document to the given `PrintWriter` using a JSON containment query (PostgreSQL only)
*
* @param tableName The table from which documents should be retrieved
* @param writer The `PrintWriter` to which the results should be written
* @param criteria The object for which JSON containment should be checked
* @param conn The connection over which documents should be retrieved
* @throws DocumentException If called on a SQLite connection
*/
def writeFirstByContains[A](tableName: String, writer: PrintWriter, criteria: A, conn: Connection): Unit =
CoreJson.writeFirstByContains(tableName, writer, criteria, conn)
/**
* Write the first document to the given `PrintWriter` using a JSON containment query and ordering fields (PostgreSQL
* only; creates connection)
*
* @param tableName The table from which documents should be retrieved
* @param writer The `PrintWriter` to which the results should be written
* @param criteria The object for which JSON containment should be checked
* @param orderBy Fields by which the query should be ordered (optional, defaults to no ordering)
* @throws DocumentException If called on a SQLite connection
*/
def writeFirstByContains[A](tableName: String, writer: PrintWriter, criteria: A, orderBy: Seq[Field[?]] = Nil): Unit =
CoreJson.writeFirstByContains(tableName, writer, criteria, orderBy.asJava)
/** /**
* Retrieve the first document using a JSON Path match query and ordering fields (PostgreSQL only) * Retrieve the first document using a JSON Path match query and ordering fields (PostgreSQL only)
* *
@ -339,3 +646,43 @@ object Json:
*/ */
def firstByJsonPath(tableName: String, path: String, orderBy: Seq[Field[?]] = Nil): String = def firstByJsonPath(tableName: String, path: String, orderBy: Seq[Field[?]] = Nil): String =
CoreJson.firstByJsonPath(tableName, path, orderBy.asJava) CoreJson.firstByJsonPath(tableName, path, orderBy.asJava)
/**
* Write the first document to the given `PrintWriter` using a JSON Path match query and ordering fields (PostgreSQL
* only)
*
* @param tableName The table from which documents should be retrieved
* @param writer The `PrintWriter` to which the results should be written
* @param path The JSON path comparison to match
* @param orderBy Fields by which the query should be ordered (optional, defaults to no ordering)
* @param conn The connection over which documents should be retrieved
* @throws DocumentException If called on a SQLite connection
*/
def writeFirstByJsonPath(tableName: String, writer: PrintWriter, path: String, orderBy: Seq[Field[?]],
conn: Connection): Unit =
CoreJson.writeFirstByJsonPath(tableName, writer, path, orderBy.asJava, conn)
/**
* Write the first document to the given `PrintWriter` using a JSON Path match query (PostgreSQL only)
*
* @param tableName The table from which documents should be retrieved
* @param writer The `PrintWriter` to which the results should be written
* @param path The JSON path comparison to match
* @param conn The connection over which documents should be retrieved
* @throws DocumentException If called on a SQLite connection
*/
def writeFirstByJsonPath(tableName: String, writer: PrintWriter, path: String, conn: Connection): Unit =
CoreJson.writeFirstByJsonPath(tableName, writer, path, conn)
/**
* Write the first document to the given `PrintWriter` using a JSON Path match query and ordering fields (PostgreSQL
* only; creates connection)
*
* @param tableName The table from which documents should be retrieved
* @param writer The `PrintWriter` to which the results should be written
* @param path The JSON path comparison to match
* @param orderBy Fields by which the query should be ordered (optional, defaults to no ordering)
* @throws DocumentException If called on a SQLite connection
*/
def writeFirstByJsonPath(tableName: String, writer: PrintWriter, path: String, orderBy: Seq[Field[?]] = Nil): Unit =
CoreJson.writeFirstByJsonPath(tableName, writer, path, orderBy.asJava)

View File

@ -530,6 +530,112 @@ extension (conn: Connection)
def jsonFirstByJsonPath(tableName: String, path: String, orderBy: Seq[Field[?]] = Nil): String = def jsonFirstByJsonPath(tableName: String, path: String, orderBy: Seq[Field[?]] = Nil): String =
Json.firstByJsonPath(tableName, path, orderBy, conn) Json.firstByJsonPath(tableName, path, orderBy, conn)
// ~~~ DOCUMENT RETRIEVAL QUERIES (Write raw JSON to PrintWriter) ~~~
/**
* Write all documents in the given table to the given `PrintWriter`, ordering results by the optional given fields
*
* @param tableName The table from which documents should be retrieved
* @param writer The `PrintWriter` to which the results should be written
* @param orderBy Fields by which the query should be ordered (optional, defaults to no ordering)
* @throws DocumentException If no connection string has been set, or if query execution fails
*/
def writeJsonAll(tableName: String, writer: PrintWriter, orderBy: Seq[Field[?]] = Nil): Unit =
Json.writeAll(tableName, writer, orderBy, conn)
/**
* Write a document to the given `PrintWriter` by its ID
*
* @param tableName The table from which the document should be retrieved
* @param writer The `PrintWriter` to which the results should be written
* @param docId The ID of the document to retrieve
* @throws DocumentException If no connection string has been set
*/
def writeJsonById[Key](tableName: String, writer: PrintWriter, docId: Key): Unit =
Json.writeById(tableName, writer, docId, conn)
/**
* Write documents to the given `PrintWriter` using a field comparison, ordering results by the given fields
*
* @param tableName The table from which documents should be retrieved
* @param writer The `PrintWriter` to which the results should be written
* @param fields The fields which should be compared
* @param howMatched How the fields should be matched
* @param orderBy Fields by which the query should be ordered (optional, defaults to no ordering)
* @throws DocumentException If no connection string has been set, or if parameters are invalid
*/
def writeJsonByFields(tableName: String, writer: PrintWriter, fields: Seq[Field[?]],
howMatched: Option[FieldMatch] = None, orderBy: Seq[Field[?]] = Nil): Unit =
Json.writeByFields(tableName, writer, fields, howMatched, orderBy, conn)
/**
* Write documents to the given `PrintWriter` using a JSON containment query, ordering results by the given fields
* (PostgreSQL only)
*
* @param tableName The table from which documents should be retrieved
* @param writer The `PrintWriter` to which the results should be written
* @param criteria The object for which JSON containment should be checked
* @param orderBy Fields by which the query should be ordered (optional, defaults to no ordering)
* @throws DocumentException If no connection string has been set, or if called on a SQLite connection
*/
def writeJsonByContains[A](tableName: String, writer: PrintWriter, criteria: A, orderBy: Seq[Field[?]] = Nil): Unit =
Json.writeByContains(tableName, writer, criteria, orderBy, conn)
/**
* Write documents to the given `PrintWriter` using a JSON Path match query, ordering results by the given fields
* (PostgreSQL only)
*
* @param tableName The table from which documents should be retrieved
* @param writer The `PrintWriter` to which the results should be written
* @param path The JSON path comparison to match
* @param orderBy Fields by which the query should be ordered (optional, defaults to no ordering)
* @throws DocumentException If no connection string has been set, or if called on a SQLite connection
*/
def writeJsonByJsonPath(tableName: String, writer: PrintWriter, path: String, orderBy: Seq[Field[?]] = Nil): Unit =
Json.writeByJsonPath(tableName, writer, path, orderBy, conn)
/**
* Write the first document to the given `PrintWriter` using a field comparison and ordering fields
*
* @param tableName The table from which documents should be retrieved
* @param writer The `PrintWriter` to which the results should be written
* @param fields The fields which should be compared
* @param howMatched How the fields should be matched (optional, defaults to `FieldMatch.ALL`)
* @param orderBy Fields by which the query should be ordered (optional, defaults to no ordering)
* @throws DocumentException If no connection string has been set, or if parameters are invalid
*/
def writeJsonFirstByFields(tableName: String, writer: PrintWriter, fields: Seq[Field[?]],
howMatched: Option[FieldMatch] = None, orderBy: Seq[Field[?]] = Nil): Unit =
Json.writeFirstByFields(tableName, writer, fields, howMatched, orderBy, conn)
/**
* Write the first document to the given `PrintWriter` using a JSON containment query and ordering fields (PostgreSQL
* only)
*
* @param tableName The table from which documents should be retrieved
* @param writer The `PrintWriter` to which the results should be written
* @param criteria The object for which JSON containment should be checked
* @param orderBy Fields by which the query should be ordered (optional, defaults to no ordering)
* @throws DocumentException If no connection string has been set, or if called on a SQLite connection
*/
def writeJsonFirstByContains[A](tableName: String, writer: PrintWriter, criteria: A,
orderBy: Seq[Field[?]] = Nil): Unit =
Json.writeFirstByContains(tableName, writer, criteria, orderBy, conn)
/**
* Write the first document to the given `PrintWriter` using a JSON Path match query and ordering fields (PostgreSQL
* only)
*
* @param tableName The table from which documents should be retrieved
* @param writer The `PrintWriter` to which the results should be written
* @param path The JSON path comparison to match
* @param orderBy Fields by which the query should be ordered (optional, defaults to no ordering)
* @throws DocumentException If no connection string has been set, or if called on a SQLite connection
*/
def writeJsonFirstByJsonPath(tableName: String, writer: PrintWriter, path: String,
orderBy: Seq[Field[?]] = Nil): Unit =
Json.writeFirstByJsonPath(tableName, writer, path, orderBy, conn)
// ~~~ DOCUMENT PATCH (PARTIAL UPDATE) QUERIES ~~~ // ~~~ DOCUMENT PATCH (PARTIAL UPDATE) QUERIES ~~~
/** /**