v4.1 #11

Merged
danieljsummers merged 22 commits from v4point1 into main 2025-04-19 19:50:17 +00:00
7 changed files with 2231 additions and 322 deletions
Showing only changes of commit 1dcc35d0f0 - Show all commits

View File

@ -38,7 +38,7 @@ module Extensions =
/// <param name="query">The query to retrieve the results</param> /// <param name="query">The query to retrieve the results</param>
/// <param name="parameters">Parameters to use for the query</param> /// <param name="parameters">Parameters to use for the query</param>
/// <param name="mapFunc">The mapping function between the document and the domain item</param> /// <param name="mapFunc">The mapping function between the document and the domain item</param>
/// <returns><tt>Some</tt> with the first matching result, or <tt>None</tt> if not found</returns> /// <returns><c>Some</c> with the first matching result, or <c>None</c> if not found</returns>
member conn.customSingle<'TDoc> query parameters (mapFunc: RowReader -> 'TDoc) = member conn.customSingle<'TDoc> query parameters (mapFunc: RowReader -> 'TDoc) =
Custom.single<'TDoc> query parameters mapFunc (Sql.existingConnection conn) Custom.single<'TDoc> query parameters mapFunc (Sql.existingConnection conn)
@ -102,7 +102,7 @@ module Extensions =
member conn.countAll tableName = member conn.countAll tableName =
Count.all tableName (Sql.existingConnection conn) Count.all tableName (Sql.existingConnection conn)
/// <summary>Count matching documents using JSON field comparisons (<tt>-&gt;&gt; =</tt>, etc.)</summary> /// <summary>Count matching documents using JSON field comparisons (<c>-&gt;&gt; =</c>, etc.)</summary>
/// <param name="tableName">The table in which documents should be counted (may include schema)</param> /// <param name="tableName">The table in which documents should be counted (may include schema)</param>
/// <param name="howMatched">Whether to match any or all of the field conditions</param> /// <param name="howMatched">Whether to match any or all of the field conditions</param>
/// <param name="fields">The field conditions to match</param> /// <param name="fields">The field conditions to match</param>
@ -110,14 +110,14 @@ module Extensions =
member conn.countByFields tableName howMatched fields = member conn.countByFields tableName howMatched fields =
Count.byFields tableName howMatched fields (Sql.existingConnection conn) Count.byFields tableName howMatched fields (Sql.existingConnection conn)
/// <summary>Count matching documents using a JSON containment query (<tt>@&gt;</tt>)</summary> /// <summary>Count matching documents using a JSON containment query (<c>@&gt;</c>)</summary>
/// <param name="tableName">The table in which documents should be counted (may include schema)</param> /// <param name="tableName">The table in which documents should be counted (may include schema)</param>
/// <param name="criteria">The document to match with the containment query</param> /// <param name="criteria">The document to match with the containment query</param>
/// <returns>The count of the documents in the table</returns> /// <returns>The count of the documents in the table</returns>
member conn.countByContains tableName criteria = member conn.countByContains tableName criteria =
Count.byContains tableName criteria (Sql.existingConnection conn) Count.byContains tableName criteria (Sql.existingConnection conn)
/// <summary>Count matching documents using a JSON Path match query (<tt>@?</tt>)</summary> /// <summary>Count matching documents using a JSON Path match query (<c>@?</c>)</summary>
/// <param name="tableName">The table in which documents should be counted (may include schema)</param> /// <param name="tableName">The table in which documents should be counted (may include schema)</param>
/// <param name="jsonPath">The JSON Path expression to be matched</param> /// <param name="jsonPath">The JSON Path expression to be matched</param>
/// <returns>The count of the documents in the table</returns> /// <returns>The count of the documents in the table</returns>
@ -131,7 +131,7 @@ module Extensions =
member conn.existsById tableName docId = member conn.existsById tableName docId =
Exists.byId tableName docId (Sql.existingConnection conn) Exists.byId tableName docId (Sql.existingConnection conn)
/// <summary>Determine if a document exists using JSON field comparisons (<tt>-&gt;&gt; =</tt>, etc.)</summary> /// <summary>Determine if a document exists using JSON field comparisons (<c>-&gt;&gt; =</c>, etc.)</summary>
/// <param name="tableName">The table in which existence should be checked (may include schema)</param> /// <param name="tableName">The table in which existence should be checked (may include schema)</param>
/// <param name="howMatched">Whether to match any or all of the field conditions</param> /// <param name="howMatched">Whether to match any or all of the field conditions</param>
/// <param name="fields">The field conditions to match</param> /// <param name="fields">The field conditions to match</param>
@ -139,14 +139,14 @@ module Extensions =
member conn.existsByFields tableName howMatched fields = member conn.existsByFields tableName howMatched fields =
Exists.byFields tableName howMatched fields (Sql.existingConnection conn) Exists.byFields tableName howMatched fields (Sql.existingConnection conn)
/// <summary>Determine if a document exists using a JSON containment query (<tt>@&gt;</tt>)</summary> /// <summary>Determine if a document exists using a JSON containment query (<c>@&gt;</c>)</summary>
/// <param name="tableName">The table in which existence should be checked (may include schema)</param> /// <param name="tableName">The table in which existence should be checked (may include schema)</param>
/// <param name="criteria">The document to match with the containment query</param> /// <param name="criteria">The document to match with the containment query</param>
/// <returns>True if any matching documents exist, false if not</returns> /// <returns>True if any matching documents exist, false if not</returns>
member conn.existsByContains tableName criteria = member conn.existsByContains tableName criteria =
Exists.byContains tableName criteria (Sql.existingConnection conn) Exists.byContains tableName criteria (Sql.existingConnection conn)
/// <summary>Determine if a document exists using a JSON Path match query (<tt>@?</tt>)</summary> /// <summary>Determine if a document exists using a JSON Path match query (<c>@?</c>)</summary>
/// <param name="tableName">The table in which existence should be checked (may include schema)</param> /// <param name="tableName">The table in which existence should be checked (may include schema)</param>
/// <param name="jsonPath">The JSON Path expression to be matched</param> /// <param name="jsonPath">The JSON Path expression to be matched</param>
/// <returns>True if any matching documents exist, false if not</returns> /// <returns>True if any matching documents exist, false if not</returns>
@ -169,11 +169,11 @@ module Extensions =
/// <summary>Retrieve a document by its ID</summary> /// <summary>Retrieve a document by its ID</summary>
/// <param name="tableName">The table from which a document should be retrieved (may include schema)</param> /// <param name="tableName">The table from which a document should be retrieved (may include schema)</param>
/// <param name="docId">The ID of the document to retrieve</param> /// <param name="docId">The ID of the document to retrieve</param>
/// <returns><tt>Some</tt> with the document if found, <tt>None</tt> otherwise</returns> /// <returns><c>Some</c> with the document if found, <c>None</c> otherwise</returns>
member conn.findById<'TKey, 'TDoc> tableName docId = member conn.findById<'TKey, 'TDoc> tableName docId =
Find.byId<'TKey, 'TDoc> tableName docId (Sql.existingConnection conn) Find.byId<'TKey, 'TDoc> tableName docId (Sql.existingConnection conn)
/// <summary>Retrieve documents matching JSON field comparisons (<tt>-&gt;&gt; =</tt>, etc.)</summary> /// <summary>Retrieve documents matching JSON field comparisons (<c>-&gt;&gt; =</c>, etc.)</summary>
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param> /// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
/// <param name="howMatched">Whether to match any or all of the field conditions</param> /// <param name="howMatched">Whether to match any or all of the field conditions</param>
/// <param name="fields">The field conditions to match</param> /// <param name="fields">The field conditions to match</param>
@ -182,8 +182,8 @@ module Extensions =
Find.byFields<'TDoc> tableName howMatched fields (Sql.existingConnection conn) Find.byFields<'TDoc> tableName howMatched fields (Sql.existingConnection conn)
/// <summary> /// <summary>
/// Retrieve documents matching JSON field comparisons (<tt>-&gt;&gt; =</tt>, etc.) ordered by the given fields /// Retrieve documents matching JSON field comparisons (<c>-&gt;&gt; =</c>, etc.) ordered by the given fields in
/// in the document /// the document
/// </summary> /// </summary>
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param> /// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
/// <param name="howMatched">Whether to match any or all of the field conditions</param> /// <param name="howMatched">Whether to match any or all of the field conditions</param>
@ -194,7 +194,7 @@ module Extensions =
Find.byFieldsOrdered<'TDoc> Find.byFieldsOrdered<'TDoc>
tableName howMatched queryFields orderFields (Sql.existingConnection conn) tableName howMatched queryFields orderFields (Sql.existingConnection conn)
/// <summary>Retrieve documents matching a JSON containment query (<tt>@&gt;</tt>)</summary> /// <summary>Retrieve documents matching a JSON containment query (<c>@&gt;</c>)</summary>
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param> /// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
/// <param name="criteria">The document to match with the containment query</param> /// <param name="criteria">The document to match with the containment query</param>
/// <returns>All documents matching the given containment query</returns> /// <returns>All documents matching the given containment query</returns>
@ -202,7 +202,7 @@ module Extensions =
Find.byContains<'TDoc> tableName criteria (Sql.existingConnection conn) Find.byContains<'TDoc> tableName criteria (Sql.existingConnection conn)
/// <summary> /// <summary>
/// Retrieve documents matching a JSON containment query (<tt>@&gt;</tt>) ordered by the given fields in the /// Retrieve documents matching a JSON containment query (<c>@&gt;</c>) ordered by the given fields in the
/// document /// document
/// </summary> /// </summary>
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param> /// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
@ -212,7 +212,7 @@ module Extensions =
member conn.findByContainsOrdered<'TDoc> tableName (criteria: obj) orderFields = member conn.findByContainsOrdered<'TDoc> tableName (criteria: obj) orderFields =
Find.byContainsOrdered<'TDoc> tableName criteria orderFields (Sql.existingConnection conn) Find.byContainsOrdered<'TDoc> tableName criteria orderFields (Sql.existingConnection conn)
/// <summary>Retrieve documents matching a JSON Path match query (<tt>@?</tt>)</summary> /// <summary>Retrieve documents matching a JSON Path match query (<c>@?</c>)</summary>
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param> /// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
/// <param name="jsonPath">The JSON Path expression to match</param> /// <param name="jsonPath">The JSON Path expression to match</param>
/// <returns>All documents matching the given JSON Path expression</returns> /// <returns>All documents matching the given JSON Path expression</returns>
@ -220,8 +220,7 @@ module Extensions =
Find.byJsonPath<'TDoc> tableName jsonPath (Sql.existingConnection conn) Find.byJsonPath<'TDoc> tableName jsonPath (Sql.existingConnection conn)
/// <summary> /// <summary>
/// Retrieve documents matching a JSON Path match query (<tt>@?</tt>) ordered by the given fields in the /// Retrieve documents matching a JSON Path match query (<c>@?</c>) ordered by the given fields in the document
/// document
/// </summary> /// </summary>
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param> /// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
/// <param name="jsonPath">The JSON Path expression to match</param> /// <param name="jsonPath">The JSON Path expression to match</param>
@ -230,65 +229,65 @@ module Extensions =
member conn.findByJsonPathOrdered<'TDoc> tableName jsonPath orderFields = member conn.findByJsonPathOrdered<'TDoc> tableName jsonPath orderFields =
Find.byJsonPathOrdered<'TDoc> tableName jsonPath orderFields (Sql.existingConnection conn) Find.byJsonPathOrdered<'TDoc> tableName jsonPath orderFields (Sql.existingConnection conn)
/// <summary>Retrieve the first document matching JSON field comparisons (<tt>-&gt;&gt; =</tt>, etc.)</summary> /// <summary>Retrieve the first document matching JSON field comparisons (<c>-&gt;&gt; =</c>, etc.)</summary>
/// <param name="tableName">The table from which a document should be retrieved (may include schema)</param> /// <param name="tableName">The table from which a document should be retrieved (may include schema)</param>
/// <param name="howMatched">Whether to match any or all of the field conditions</param> /// <param name="howMatched">Whether to match any or all of the field conditions</param>
/// <param name="fields">The field conditions to match</param> /// <param name="fields">The field conditions to match</param>
/// <returns><tt>Some</tt> with the first document, or <tt>None</tt> if not found</returns> /// <returns><c>Some</c> with the first document, or <c>None</c> if not found</returns>
member conn.findFirstByFields<'TDoc> tableName howMatched fields = member conn.findFirstByFields<'TDoc> tableName howMatched fields =
Find.firstByFields<'TDoc> tableName howMatched fields (Sql.existingConnection conn) Find.firstByFields<'TDoc> tableName howMatched fields (Sql.existingConnection conn)
/// <summary> /// <summary>
/// Retrieve the first document matching JSON field comparisons (<tt>-&gt;&gt; =</tt>, etc.) ordered by the /// Retrieve the first document matching JSON field comparisons (<c>-&gt;&gt; =</c>, etc.) ordered by the given
/// given fields in the document /// fields in the document
/// </summary> /// </summary>
/// <param name="tableName">The table from which a document should be retrieved (may include schema)</param> /// <param name="tableName">The table from which a document should be retrieved (may include schema)</param>
/// <param name="howMatched">Whether to match any or all of the field conditions</param> /// <param name="howMatched">Whether to match any or all of the field conditions</param>
/// <param name="queryFields">The field conditions to match</param> /// <param name="queryFields">The field conditions to match</param>
/// <param name="orderFields">Fields by which the results should be ordered</param> /// <param name="orderFields">Fields by which the results should be ordered</param>
/// <returns> /// <returns>
/// <tt>Some</tt> with the first document ordered by the given fields, or <tt>None</tt> if not found /// <c>Some</c> with the first document ordered by the given fields, or <c>None</c> if not found
/// </returns> /// </returns>
member conn.findFirstByFieldsOrdered<'TDoc> tableName howMatched queryFields orderFields = member conn.findFirstByFieldsOrdered<'TDoc> tableName howMatched queryFields orderFields =
Find.firstByFieldsOrdered<'TDoc> Find.firstByFieldsOrdered<'TDoc>
tableName howMatched queryFields orderFields (Sql.existingConnection conn) tableName howMatched queryFields orderFields (Sql.existingConnection conn)
/// <summary>Retrieve the first document matching a JSON containment query (<tt>@&gt;</tt>)</summary> /// <summary>Retrieve the first document matching a JSON containment query (<c>@&gt;</c>)</summary>
/// <param name="tableName">The table from which a document should be retrieved (may include schema)</param> /// <param name="tableName">The table from which a document should be retrieved (may include schema)</param>
/// <param name="criteria">The document to match with the containment query</param> /// <param name="criteria">The document to match with the containment query</param>
/// <returns><tt>Some</tt> with the first document, or <tt>None</tt> if not found</returns> /// <returns><c>Some</c> with the first document, or <c>None</c> if not found</returns>
member conn.findFirstByContains<'TDoc> tableName (criteria: obj) = member conn.findFirstByContains<'TDoc> tableName (criteria: obj) =
Find.firstByContains<'TDoc> tableName criteria (Sql.existingConnection conn) Find.firstByContains<'TDoc> tableName criteria (Sql.existingConnection conn)
/// <summary> /// <summary>
/// Retrieve the first document matching a JSON containment query (<tt>@&gt;</tt>) ordered by the given fields /// Retrieve the first document matching a JSON containment query (<c>@&gt;</c>) ordered by the given fields in
/// in the document /// the document
/// </summary> /// </summary>
/// <param name="tableName">The table from which a document should be retrieved (may include schema)</param> /// <param name="tableName">The table from which a document should be retrieved (may include schema)</param>
/// <param name="criteria">The document to match with the containment query</param> /// <param name="criteria">The document to match with the containment query</param>
/// <param name="orderFields">Fields by which the results should be ordered</param> /// <param name="orderFields">Fields by which the results should be ordered</param>
/// <returns> /// <returns>
/// <tt>Some</tt> with the first document ordered by the given fields, or <tt>None</tt> if not found /// <c>Some</c> with the first document ordered by the given fields, or <c>None</c> if not found
/// </returns> /// </returns>
member conn.findFirstByContainsOrdered<'TDoc> tableName (criteria: obj) orderFields = member conn.findFirstByContainsOrdered<'TDoc> tableName (criteria: obj) orderFields =
Find.firstByContainsOrdered<'TDoc> tableName criteria orderFields (Sql.existingConnection conn) Find.firstByContainsOrdered<'TDoc> tableName criteria orderFields (Sql.existingConnection conn)
/// <summary>Retrieve the first document matching a JSON Path match query (<tt>@?</tt>)</summary> /// <summary>Retrieve the first document matching a JSON Path match query (<c>@?</c>)</summary>
/// <param name="tableName">The table from which a document should be retrieved (may include schema)</param> /// <param name="tableName">The table from which a document should be retrieved (may include schema)</param>
/// <param name="jsonPath">The JSON Path expression to match</param> /// <param name="jsonPath">The JSON Path expression to match</param>
/// <returns><tt>Some</tt> with the first document, or <tt>None</tt> if not found</returns> /// <returns><c>Some</c> with the first document, or <c>None</c> if not found</returns>
member conn.findFirstByJsonPath<'TDoc> tableName jsonPath = member conn.findFirstByJsonPath<'TDoc> tableName jsonPath =
Find.firstByJsonPath<'TDoc> tableName jsonPath (Sql.existingConnection conn) Find.firstByJsonPath<'TDoc> tableName jsonPath (Sql.existingConnection conn)
/// <summary> /// <summary>
/// Retrieve the first document matching a JSON Path match query (<tt>@?</tt>) ordered by the given fields in /// Retrieve the first document matching a JSON Path match query (<c>@?</c>) ordered by the given fields in the
/// the document /// document
/// </summary> /// </summary>
/// <param name="tableName">The table from which a document should be retrieved (may include schema)</param> /// <param name="tableName">The table from which a document should be retrieved (may include schema)</param>
/// <param name="jsonPath">The JSON Path expression to match</param> /// <param name="jsonPath">The JSON Path expression to match</param>
/// <param name="orderFields">Fields by which the results should be ordered</param> /// <param name="orderFields">Fields by which the results should be ordered</param>
/// <returns> /// <returns>
/// <tt>Some</tt> with the first document ordered by the given fields, or <tt>None</tt> if not found /// <c>Some</c> with the first document ordered by the given fields, or <c>None</c> if not found
/// </returns> /// </returns>
member conn.findFirstByJsonPathOrdered<'TDoc> tableName jsonPath orderFields = member conn.findFirstByJsonPathOrdered<'TDoc> tableName jsonPath orderFields =
Find.firstByJsonPathOrdered<'TDoc> tableName jsonPath orderFields (Sql.existingConnection conn) Find.firstByJsonPathOrdered<'TDoc> tableName jsonPath orderFields (Sql.existingConnection conn)
@ -605,7 +604,7 @@ module Extensions =
Patch.byId tableName docId patch (Sql.existingConnection conn) Patch.byId tableName docId patch (Sql.existingConnection conn)
/// <summary> /// <summary>
/// Patch documents using a JSON field comparison query in the <tt>WHERE</tt> clause (<tt>-&gt;&gt; =</tt>, /// Patch documents using a JSON field comparison query in the <c>WHERE</c> clause (<c>-&gt;&gt; =</c>,
/// etc.) /// etc.)
/// </summary> /// </summary>
/// <param name="tableName">The table in which documents should be patched (may include schema)</param> /// <param name="tableName">The table in which documents should be patched (may include schema)</param>
@ -616,7 +615,7 @@ module Extensions =
Patch.byFields tableName howMatched fields patch (Sql.existingConnection conn) Patch.byFields tableName howMatched fields patch (Sql.existingConnection conn)
/// <summary> /// <summary>
/// Patch documents using a JSON containment query in the <tt>WHERE</tt> clause (<tt>@&gt;</tt>) /// Patch documents using a JSON containment query in the <c>WHERE</c> clause (<c>@&gt;</c>)
/// </summary> /// </summary>
/// <param name="tableName">The table in which documents should be patched (may include schema)</param> /// <param name="tableName">The table in which documents should be patched (may include schema)</param>
/// <param name="criteria">The document to match the containment query</param> /// <param name="criteria">The document to match the containment query</param>
@ -624,7 +623,7 @@ module Extensions =
member conn.patchByContains tableName (criteria: 'TCriteria) (patch: 'TPatch) = member conn.patchByContains tableName (criteria: 'TCriteria) (patch: 'TPatch) =
Patch.byContains tableName criteria patch (Sql.existingConnection conn) Patch.byContains tableName criteria patch (Sql.existingConnection conn)
/// <summary>Patch documents using a JSON Path match query in the <tt>WHERE</tt> clause (<tt>@?</tt>)</summary> /// <summary>Patch documents using a JSON Path match query in the <c>WHERE</c> clause (<c>@?</c>)</summary>
/// <param name="tableName">The table in which documents should be patched (may include schema)</param> /// <param name="tableName">The table in which documents should be patched (may include schema)</param>
/// <param name="jsonPath">The JSON Path expression to match</param> /// <param name="jsonPath">The JSON Path expression to match</param>
/// <param name="patch">The partial document to patch the existing document</param> /// <param name="patch">The partial document to patch the existing document</param>
@ -646,14 +645,14 @@ module Extensions =
member conn.removeFieldsByFields tableName howMatched fields fieldNames = member conn.removeFieldsByFields tableName howMatched fields fieldNames =
RemoveFields.byFields tableName howMatched fields fieldNames (Sql.existingConnection conn) RemoveFields.byFields tableName howMatched fields fieldNames (Sql.existingConnection conn)
/// <summary>Remove fields from documents via a JSON containment query (<tt>@&gt;</tt>)</summary> /// <summary>Remove fields from documents via a JSON containment query (<c>@&gt;</c>)</summary>
/// <param name="tableName">The table in which documents should be modified (may include schema)</param> /// <param name="tableName">The table in which documents should be modified (may include schema)</param>
/// <param name="criteria">The document to match the containment query</param> /// <param name="criteria">The document to match the containment query</param>
/// <param name="fieldNames">One or more field names to remove from the matching documents</param> /// <param name="fieldNames">One or more field names to remove from the matching documents</param>
member conn.removeFieldsByContains tableName (criteria: 'TContains) fieldNames = member conn.removeFieldsByContains tableName (criteria: 'TContains) fieldNames =
RemoveFields.byContains tableName criteria fieldNames (Sql.existingConnection conn) RemoveFields.byContains tableName criteria fieldNames (Sql.existingConnection conn)
/// <summary>Remove fields from documents via a JSON Path match query (<tt>@?</tt>)</summary> /// <summary>Remove fields from documents via a JSON Path match query (<c>@?</c>)</summary>
/// <param name="tableName">The table in which documents should be modified (may include schema)</param> /// <param name="tableName">The table in which documents should be modified (may include schema)</param>
/// <param name="jsonPath">The JSON Path expression to match</param> /// <param name="jsonPath">The JSON Path expression to match</param>
/// <param name="fieldNames">One or more field names to remove from the matching documents</param> /// <param name="fieldNames">One or more field names to remove from the matching documents</param>
@ -666,14 +665,14 @@ module Extensions =
member conn.deleteById tableName (docId: 'TKey) = member conn.deleteById tableName (docId: 'TKey) =
Delete.byId tableName docId (Sql.existingConnection conn) Delete.byId tableName docId (Sql.existingConnection conn)
/// <summary>Delete documents by matching a JSON field comparison query (<tt>-&gt;&gt; =</tt>, etc.)</summary> /// <summary>Delete documents by matching a JSON field comparison query (<c>-&gt;&gt; =</c>, etc.)</summary>
/// <param name="tableName">The table in which documents should be deleted (may include schema)</param> /// <param name="tableName">The table in which documents should be deleted (may include schema)</param>
/// <param name="howMatched">Whether to match any or all of the field conditions</param> /// <param name="howMatched">Whether to match any or all of the field conditions</param>
/// <param name="fields">The field conditions to match</param> /// <param name="fields">The field conditions to match</param>
member conn.deleteByFields tableName howMatched fields = member conn.deleteByFields tableName howMatched fields =
Delete.byFields tableName howMatched fields (Sql.existingConnection conn) Delete.byFields tableName howMatched fields (Sql.existingConnection conn)
/// <summary>Delete documents by matching a JSON contains query (<tt>@&gt;</tt>)</summary> /// <summary>Delete documents by matching a JSON contains query (<c>@&gt;</c>)</summary>
/// <param name="tableName">The table in which documents should be deleted (may include schema)</param> /// <param name="tableName">The table in which documents should be deleted (may include schema)</param>
/// <param name="criteria">The document to match the containment query</param> /// <param name="criteria">The document to match the containment query</param>
member conn.deleteByContains tableName (criteria: 'TContains) = member conn.deleteByContains tableName (criteria: 'TContains) =
@ -707,6 +706,7 @@ type NpgsqlConnectionCSharpExtensions =
/// <param name="parameters">Parameters to use for the query</param> /// <param name="parameters">Parameters to use for the query</param>
/// <param name="mapFunc">The mapping function to extract the document</param> /// <param name="mapFunc">The mapping function to extract the document</param>
/// <returns>A JSON array of results for the given query</returns> /// <returns>A JSON array of results for the given query</returns>
[<Extension>]
static member inline CustomJsonArray(conn, query, parameters, mapFunc) = static member inline CustomJsonArray(conn, query, parameters, mapFunc) =
Custom.JsonArray(query, parameters, mapFunc, Sql.existingConnection conn) Custom.JsonArray(query, parameters, mapFunc, Sql.existingConnection conn)
@ -716,6 +716,7 @@ type NpgsqlConnectionCSharpExtensions =
/// <param name="parameters">Parameters to use for the query</param> /// <param name="parameters">Parameters to use for the query</param>
/// <param name="writer">The StreamWriter to which the results should be written</param> /// <param name="writer">The StreamWriter to which the results should be written</param>
/// <param name="mapFunc">The mapping function to extract the document</param> /// <param name="mapFunc">The mapping function to extract the document</param>
[<Extension>]
static member inline WriteCustomJsonArray(conn, query, parameters, writer, mapFunc) = static member inline WriteCustomJsonArray(conn, query, parameters, writer, mapFunc) =
Custom.WriteJsonArray(query, parameters, writer, mapFunc, Sql.existingConnection conn) Custom.WriteJsonArray(query, parameters, writer, mapFunc, Sql.existingConnection conn)
@ -724,7 +725,7 @@ type NpgsqlConnectionCSharpExtensions =
/// <param name="query">The query to retrieve the results</param> /// <param name="query">The query to retrieve the results</param>
/// <param name="parameters">Parameters to use for the query</param> /// <param name="parameters">Parameters to use for the query</param>
/// <param name="mapFunc">The mapping function between the document and the domain item</param> /// <param name="mapFunc">The mapping function between the document and the domain item</param>
/// <returns>The first matching result, or <tt>null</tt> if not found</returns> /// <returns>The first matching result, or <c>null</c> if not found</returns>
[<Extension>] [<Extension>]
static member inline CustomSingle<'TDoc when 'TDoc: null and 'TDoc: not struct>( static member inline CustomSingle<'TDoc when 'TDoc: null and 'TDoc: not struct>(
conn, query, parameters, mapFunc: System.Func<RowReader, 'TDoc>) = conn, query, parameters, mapFunc: System.Func<RowReader, 'TDoc>) =
@ -736,6 +737,7 @@ type NpgsqlConnectionCSharpExtensions =
/// <param name="parameters">Parameters to use for the query</param> /// <param name="parameters">Parameters to use for the query</param>
/// <param name="mapFunc">The mapping function to extract the document</param> /// <param name="mapFunc">The mapping function to extract the document</param>
/// <returns>The JSON document with the first matching result, or an empty document if not found</returns> /// <returns>The JSON document with the first matching result, or an empty document if not found</returns>
[<Extension>]
static member inline CustomJsonSingle(conn, query, parameters, mapFunc) = static member inline CustomJsonSingle(conn, query, parameters, mapFunc) =
Custom.JsonSingle(query, parameters, mapFunc, Sql.existingConnection conn) Custom.JsonSingle(query, parameters, mapFunc, Sql.existingConnection conn)
@ -806,7 +808,7 @@ type NpgsqlConnectionCSharpExtensions =
static member inline CountAll(conn, tableName) = static member inline CountAll(conn, tableName) =
Count.all tableName (Sql.existingConnection conn) Count.all tableName (Sql.existingConnection conn)
/// <summary>Count matching documents using JSON field comparisons (<tt>-&gt;&gt; =</tt>, etc.)</summary> /// <summary>Count matching documents using JSON field comparisons (<c>-&gt;&gt; =</c>, etc.)</summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table in which documents should be counted (may include schema)</param> /// <param name="tableName">The table in which documents should be counted (may include schema)</param>
/// <param name="howMatched">Whether to match any or all of the field conditions</param> /// <param name="howMatched">Whether to match any or all of the field conditions</param>
@ -816,7 +818,7 @@ type NpgsqlConnectionCSharpExtensions =
static member inline CountByFields(conn, tableName, howMatched, fields) = static member inline CountByFields(conn, tableName, howMatched, fields) =
Count.byFields tableName howMatched fields (Sql.existingConnection conn) Count.byFields tableName howMatched fields (Sql.existingConnection conn)
/// <summary>Count matching documents using a JSON containment query (<tt>@&gt;</tt>)</summary> /// <summary>Count matching documents using a JSON containment query (<c>@&gt;</c>)</summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table in which documents should be counted (may include schema)</param> /// <param name="tableName">The table in which documents should be counted (may include schema)</param>
/// <param name="criteria">The document to match with the containment query</param> /// <param name="criteria">The document to match with the containment query</param>
@ -825,7 +827,7 @@ type NpgsqlConnectionCSharpExtensions =
static member inline CountByContains(conn, tableName, criteria: 'TCriteria) = static member inline CountByContains(conn, tableName, criteria: 'TCriteria) =
Count.byContains tableName criteria (Sql.existingConnection conn) Count.byContains tableName criteria (Sql.existingConnection conn)
/// <summary>Count matching documents using a JSON Path match query (<tt>@?</tt>)</summary> /// <summary>Count matching documents using a JSON Path match query (<c>@?</c>)</summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table in which documents should be counted (may include schema)</param> /// <param name="tableName">The table in which documents should be counted (may include schema)</param>
/// <param name="jsonPath">The JSON Path expression to be matched</param> /// <param name="jsonPath">The JSON Path expression to be matched</param>
@ -843,7 +845,7 @@ type NpgsqlConnectionCSharpExtensions =
static member inline ExistsById(conn, tableName, docId) = static member inline ExistsById(conn, tableName, docId) =
Exists.byId tableName docId (Sql.existingConnection conn) Exists.byId tableName docId (Sql.existingConnection conn)
/// <summary>Determine if a document exists using JSON field comparisons (<tt>-&gt;&gt; =</tt>, etc.)</summary> /// <summary>Determine if a document exists using JSON field comparisons (<c>-&gt;&gt; =</c>, etc.)</summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table in which existence should be checked (may include schema)</param> /// <param name="tableName">The table in which existence should be checked (may include schema)</param>
/// <param name="howMatched">Whether to match any or all of the field conditions</param> /// <param name="howMatched">Whether to match any or all of the field conditions</param>
@ -853,7 +855,7 @@ type NpgsqlConnectionCSharpExtensions =
static member inline ExistsByFields(conn, tableName, howMatched, fields) = static member inline ExistsByFields(conn, tableName, howMatched, fields) =
Exists.byFields tableName howMatched fields (Sql.existingConnection conn) Exists.byFields tableName howMatched fields (Sql.existingConnection conn)
/// <summary>Determine if a document exists using a JSON containment query (<tt>@&gt;</tt>)</summary> /// <summary>Determine if a document exists using a JSON containment query (<c>@&gt;</c>)</summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table in which existence should be checked (may include schema)</param> /// <param name="tableName">The table in which existence should be checked (may include schema)</param>
/// <param name="criteria">The document to match with the containment query</param> /// <param name="criteria">The document to match with the containment query</param>
@ -862,7 +864,7 @@ type NpgsqlConnectionCSharpExtensions =
static member inline ExistsByContains(conn, tableName, criteria: 'TCriteria) = static member inline ExistsByContains(conn, tableName, criteria: 'TCriteria) =
Exists.byContains tableName criteria (Sql.existingConnection conn) Exists.byContains tableName criteria (Sql.existingConnection conn)
/// <summary>Determine if a document exists using a JSON Path match query (<tt>@?</tt>)</summary> /// <summary>Determine if a document exists using a JSON Path match query (<c>@?</c>)</summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table in which existence should be checked (may include schema)</param> /// <param name="tableName">The table in which existence should be checked (may include schema)</param>
/// <param name="jsonPath">The JSON Path expression to be matched</param> /// <param name="jsonPath">The JSON Path expression to be matched</param>
@ -892,12 +894,12 @@ type NpgsqlConnectionCSharpExtensions =
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table from which a document should be retrieved (may include schema)</param> /// <param name="tableName">The table from which a document should be retrieved (may include schema)</param>
/// <param name="docId">The ID of the document to retrieve</param> /// <param name="docId">The ID of the document to retrieve</param>
/// <returns>The document if found, <tt>null</tt> otherwise</returns> /// <returns>The document if found, <c>null</c> otherwise</returns>
[<Extension>] [<Extension>]
static member inline FindById<'TKey, 'TDoc when 'TDoc: null and 'TDoc: not struct>(conn, tableName, docId: 'TKey) = static member inline FindById<'TKey, 'TDoc when 'TDoc: null and 'TDoc: not struct>(conn, tableName, docId: 'TKey) =
Find.ById<'TKey, 'TDoc>(tableName, docId, Sql.existingConnection conn) Find.ById<'TKey, 'TDoc>(tableName, docId, Sql.existingConnection conn)
/// <summary>Retrieve documents matching JSON field comparisons (<tt>-&gt;&gt; =</tt>, etc.)</summary> /// <summary>Retrieve documents matching JSON field comparisons (<c>-&gt;&gt; =</c>, etc.)</summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param> /// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
/// <param name="howMatched">Whether to match any or all of the field conditions</param> /// <param name="howMatched">Whether to match any or all of the field conditions</param>
@ -908,8 +910,8 @@ type NpgsqlConnectionCSharpExtensions =
Find.ByFields<'TDoc>(tableName, howMatched, fields, Sql.existingConnection conn) Find.ByFields<'TDoc>(tableName, howMatched, fields, Sql.existingConnection conn)
/// <summary> /// <summary>
/// Retrieve documents matching JSON field comparisons (<tt>-&gt;&gt; =</tt>, etc.) ordered by the given fields in /// Retrieve documents matching JSON field comparisons (<c>-&gt;&gt; =</c>, etc.) ordered by the given fields in the
/// the document /// document
/// </summary> /// </summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param> /// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
@ -922,7 +924,7 @@ type NpgsqlConnectionCSharpExtensions =
Find.ByFieldsOrdered<'TDoc>( Find.ByFieldsOrdered<'TDoc>(
tableName, howMatched, queryFields, orderFields, Sql.existingConnection conn) tableName, howMatched, queryFields, orderFields, Sql.existingConnection conn)
/// <summary>Retrieve documents matching a JSON containment query (<tt>@&gt;</tt>)</summary> /// <summary>Retrieve documents matching a JSON containment query (<c>@&gt;</c>)</summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param> /// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
/// <param name="criteria">The document to match with the containment query</param> /// <param name="criteria">The document to match with the containment query</param>
@ -932,8 +934,7 @@ type NpgsqlConnectionCSharpExtensions =
Find.ByContains<'TDoc>(tableName, criteria, Sql.existingConnection conn) Find.ByContains<'TDoc>(tableName, criteria, Sql.existingConnection conn)
/// <summary> /// <summary>
/// Retrieve documents matching a JSON containment query (<tt>@&gt;</tt>) ordered by the given fields in the /// Retrieve documents matching a JSON containment query (<c>@&gt;</c>) ordered by the given fields in the document
/// document
/// </summary> /// </summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param> /// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
@ -944,7 +945,7 @@ type NpgsqlConnectionCSharpExtensions =
static member inline FindByContainsOrdered<'TDoc>(conn, tableName, criteria: obj, orderFields) = static member inline FindByContainsOrdered<'TDoc>(conn, tableName, criteria: obj, orderFields) =
Find.ByContainsOrdered<'TDoc>(tableName, criteria, orderFields, Sql.existingConnection conn) Find.ByContainsOrdered<'TDoc>(tableName, criteria, orderFields, Sql.existingConnection conn)
/// <summary>Retrieve documents matching a JSON Path match query (<tt>@?</tt>)</summary> /// <summary>Retrieve documents matching a JSON Path match query (<c>@?</c>)</summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param> /// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
/// <param name="jsonPath">The JSON Path expression to match</param> /// <param name="jsonPath">The JSON Path expression to match</param>
@ -954,7 +955,7 @@ type NpgsqlConnectionCSharpExtensions =
Find.ByJsonPath<'TDoc>(tableName, jsonPath, Sql.existingConnection conn) Find.ByJsonPath<'TDoc>(tableName, jsonPath, Sql.existingConnection conn)
/// <summary> /// <summary>
/// Retrieve documents matching a JSON Path match query (<tt>@?</tt>) ordered by the given fields in the document /// Retrieve documents matching a JSON Path match query (<c>@?</c>) ordered by the given fields in the document
/// </summary> /// </summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param> /// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
@ -965,19 +966,19 @@ type NpgsqlConnectionCSharpExtensions =
static member inline FindByJsonPathOrdered<'TDoc>(conn, tableName, jsonPath, orderFields) = static member inline FindByJsonPathOrdered<'TDoc>(conn, tableName, jsonPath, orderFields) =
Find.ByJsonPathOrdered<'TDoc>(tableName, jsonPath, orderFields, Sql.existingConnection conn) Find.ByJsonPathOrdered<'TDoc>(tableName, jsonPath, orderFields, Sql.existingConnection conn)
/// <summary>Retrieve the first document matching JSON field comparisons (<tt>-&gt;&gt; =</tt>, etc.)</summary> /// <summary>Retrieve the first document matching JSON field comparisons (<c>-&gt;&gt; =</c>, etc.)</summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table from which a document should be retrieved (may include schema)</param> /// <param name="tableName">The table from which a document should be retrieved (may include schema)</param>
/// <param name="howMatched">Whether to match any or all of the field conditions</param> /// <param name="howMatched">Whether to match any or all of the field conditions</param>
/// <param name="fields">The field conditions to match</param> /// <param name="fields">The field conditions to match</param>
/// <returns>The first document, or <tt>null</tt> if not found</returns> /// <returns>The first document, or <c>null</c> if not found</returns>
[<Extension>] [<Extension>]
static member inline FindFirstByFields<'TDoc when 'TDoc: null and 'TDoc: not struct>( static member inline FindFirstByFields<'TDoc when 'TDoc: null and 'TDoc: not struct>(
conn, tableName, howMatched, fields) = conn, tableName, howMatched, fields) =
Find.FirstByFields<'TDoc>(tableName, howMatched, fields, Sql.existingConnection conn) Find.FirstByFields<'TDoc>(tableName, howMatched, fields, Sql.existingConnection conn)
/// <summary> /// <summary>
/// Retrieve the first document matching JSON field comparisons (<tt>-&gt;&gt; =</tt>, etc.) ordered by the given /// Retrieve the first document matching JSON field comparisons (<c>-&gt;&gt; =</c>, etc.) ordered by the given
/// fields in the document /// fields in the document
/// </summary> /// </summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
@ -985,55 +986,55 @@ type NpgsqlConnectionCSharpExtensions =
/// <param name="howMatched">Whether to match any or all of the field conditions</param> /// <param name="howMatched">Whether to match any or all of the field conditions</param>
/// <param name="queryFields">The field conditions to match</param> /// <param name="queryFields">The field conditions to match</param>
/// <param name="orderFields">Fields by which the results should be ordered</param> /// <param name="orderFields">Fields by which the results should be ordered</param>
/// <returns>The first document ordered by the given fields, or <tt>null</tt> if not found</returns> /// <returns>The first document ordered by the given fields, or <c>null</c> if not found</returns>
[<Extension>] [<Extension>]
static member inline FindFirstByFieldsOrdered<'TDoc when 'TDoc: null and 'TDoc: not struct>( static member inline FindFirstByFieldsOrdered<'TDoc when 'TDoc: null and 'TDoc: not struct>(
conn, tableName, howMatched, queryFields, orderFields) = conn, tableName, howMatched, queryFields, orderFields) =
Find.FirstByFieldsOrdered<'TDoc>( Find.FirstByFieldsOrdered<'TDoc>(
tableName, howMatched, queryFields, orderFields, Sql.existingConnection conn) tableName, howMatched, queryFields, orderFields, Sql.existingConnection conn)
/// <summary>Retrieve the first document matching a JSON containment query (<tt>@&gt;</tt>)</summary> /// <summary>Retrieve the first document matching a JSON containment query (<c>@&gt;</c>)</summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table from which a document should be retrieved (may include schema)</param> /// <param name="tableName">The table from which a document should be retrieved (may include schema)</param>
/// <param name="criteria">The document to match with the containment query</param> /// <param name="criteria">The document to match with the containment query</param>
/// <returns>The first document, or <tt>null</tt> if not found</returns> /// <returns>The first document, or <c>null</c> if not found</returns>
[<Extension>] [<Extension>]
static member inline FindFirstByContains<'TDoc when 'TDoc: null and 'TDoc: not struct>( static member inline FindFirstByContains<'TDoc when 'TDoc: null and 'TDoc: not struct>(
conn, tableName, criteria: obj) = conn, tableName, criteria: obj) =
Find.FirstByContains<'TDoc>(tableName, criteria, Sql.existingConnection conn) Find.FirstByContains<'TDoc>(tableName, criteria, Sql.existingConnection conn)
/// <summary> /// <summary>
/// Retrieve the first document matching a JSON containment query (<tt>@&gt;</tt>) ordered by the given fields in /// Retrieve the first document matching a JSON containment query (<c>@&gt;</c>) ordered by the given fields in the
/// the document /// document
/// </summary> /// </summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table from which a document should be retrieved (may include schema)</param> /// <param name="tableName">The table from which a document should be retrieved (may include schema)</param>
/// <param name="criteria">The document to match with the containment query</param> /// <param name="criteria">The document to match with the containment query</param>
/// <param name="orderFields">Fields by which the results should be ordered</param> /// <param name="orderFields">Fields by which the results should be ordered</param>
/// <returns>The first document ordered by the given fields, or <tt>null</tt> if not found</returns> /// <returns>The first document ordered by the given fields, or <c>null</c> if not found</returns>
[<Extension>] [<Extension>]
static member inline FindFirstByContainsOrdered<'TDoc when 'TDoc: null and 'TDoc: not struct>( static member inline FindFirstByContainsOrdered<'TDoc when 'TDoc: null and 'TDoc: not struct>(
conn, tableName, criteria: obj, orderFields) = conn, tableName, criteria: obj, orderFields) =
Find.FirstByContainsOrdered<'TDoc>(tableName, criteria, orderFields, Sql.existingConnection conn) Find.FirstByContainsOrdered<'TDoc>(tableName, criteria, orderFields, Sql.existingConnection conn)
/// <summary>Retrieve the first document matching a JSON Path match query (<tt>@?</tt>)</summary> /// <summary>Retrieve the first document matching a JSON Path match query (<c>@?</c>)</summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table from which a document should be retrieved (may include schema)</param> /// <param name="tableName">The table from which a document should be retrieved (may include schema)</param>
/// <param name="jsonPath">The JSON Path expression to match</param> /// <param name="jsonPath">The JSON Path expression to match</param>
/// <returns>The first document, or <tt>null</tt> if not found</returns> /// <returns>The first document, or <c>null</c> if not found</returns>
[<Extension>] [<Extension>]
static member inline FindFirstByJsonPath<'TDoc when 'TDoc: null and 'TDoc: not struct>(conn, tableName, jsonPath) = static member inline FindFirstByJsonPath<'TDoc when 'TDoc: null and 'TDoc: not struct>(conn, tableName, jsonPath) =
Find.FirstByJsonPath<'TDoc>(tableName, jsonPath, Sql.existingConnection conn) Find.FirstByJsonPath<'TDoc>(tableName, jsonPath, Sql.existingConnection conn)
/// <summary> /// <summary>
/// Retrieve the first document matching a JSON Path match query (<tt>@?</tt>) ordered by the given fields in the /// Retrieve the first document matching a JSON Path match query (<c>@?</c>) ordered by the given fields in the
/// document /// document
/// </summary> /// </summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table from which a document should be retrieved (may include schema)</param> /// <param name="tableName">The table from which a document should be retrieved (may include schema)</param>
/// <param name="jsonPath">The JSON Path expression to match</param> /// <param name="jsonPath">The JSON Path expression to match</param>
/// <param name="orderFields">Fields by which the results should be ordered</param> /// <param name="orderFields">Fields by which the results should be ordered</param>
/// <returns>The first document ordered by the given fields, or <tt>null</tt> if not found</returns> /// <returns>The first document ordered by the given fields, or <c>null</c> if not found</returns>
[<Extension>] [<Extension>]
static member inline FindFirstByJsonPathOrdered<'TDoc when 'TDoc: null and 'TDoc: not struct>( static member inline FindFirstByJsonPathOrdered<'TDoc when 'TDoc: null and 'TDoc: not struct>(
conn, tableName, jsonPath, orderFields) = conn, tableName, jsonPath, orderFields) =
@ -1107,8 +1108,7 @@ type NpgsqlConnectionCSharpExtensions =
Json.byFields tableName howMatched fields (Sql.existingConnection conn) Json.byFields tableName howMatched fields (Sql.existingConnection conn)
/// <summary> /// <summary>
/// Write JSON documents to the given <c>StreamWriter</c> matching JSON field comparisons (<c>-&gt;&gt; =</c>, /// Write JSON documents to the given <c>StreamWriter</c> matching JSON field comparisons (<c>-&gt;&gt; =</c>, etc.)
/// etc.)
/// </summary> /// </summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param> /// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
@ -1120,8 +1120,8 @@ type NpgsqlConnectionCSharpExtensions =
Json.writeByFields tableName writer howMatched fields (Sql.existingConnection conn) Json.writeByFields tableName writer howMatched fields (Sql.existingConnection conn)
/// <summary> /// <summary>
/// Retrieve JSON documents matching JSON field comparisons (<c>-&gt;&gt; =</c>, etc.) ordered by the given /// Retrieve JSON documents matching JSON field comparisons (<c>-&gt;&gt; =</c>, etc.) ordered by the given fields
/// fields in the document /// in the document
/// </summary> /// </summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param> /// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
@ -1134,8 +1134,8 @@ type NpgsqlConnectionCSharpExtensions =
Json.byFieldsOrdered tableName howMatched queryFields orderFields (Sql.existingConnection conn) Json.byFieldsOrdered tableName howMatched queryFields orderFields (Sql.existingConnection conn)
/// <summary> /// <summary>
/// Write JSON documents to the given <c>StreamWriter</c> matching JSON field comparisons (<c>-&gt;&gt; =</c>, /// Write JSON documents to the given <c>StreamWriter</c> matching JSON field comparisons (<c>-&gt;&gt; =</c>, etc.)
/// etc.) ordered by the given fields in the document /// ordered by the given fields in the document
/// </summary> /// </summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param> /// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
@ -1181,8 +1181,8 @@ type NpgsqlConnectionCSharpExtensions =
Json.byContainsOrdered tableName criteria orderFields (Sql.existingConnection conn) Json.byContainsOrdered tableName criteria orderFields (Sql.existingConnection conn)
/// <summary> /// <summary>
/// Write JSON documents to the given <c>StreamWriter</c> matching a JSON containment query (<c>@&gt;</c>) /// Write JSON documents to the given <c>StreamWriter</c> matching a JSON containment query (<c>@&gt;</c>) ordered
/// ordered by the given fields in the document /// by the given fields in the document
/// </summary> /// </summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param> /// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
@ -1214,8 +1214,7 @@ type NpgsqlConnectionCSharpExtensions =
Json.writeByJsonPath tableName writer jsonPath (Sql.existingConnection conn) Json.writeByJsonPath tableName writer jsonPath (Sql.existingConnection conn)
/// <summary> /// <summary>
/// Retrieve JSON documents matching a JSON Path match query (<c>@?</c>) ordered by the given fields in the /// Retrieve JSON documents matching a JSON Path match query (<c>@?</c>) ordered by the given fields in the document
/// document
/// </summary> /// </summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param> /// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
@ -1227,8 +1226,8 @@ type NpgsqlConnectionCSharpExtensions =
Json.byJsonPathOrdered tableName jsonPath orderFields (Sql.existingConnection conn) Json.byJsonPathOrdered tableName jsonPath orderFields (Sql.existingConnection conn)
/// <summary> /// <summary>
/// Write JSON documents to the given <c>StreamWriter</c> matching a JSON Path match query (<c>@?</c>) ordered /// Write JSON documents to the given <c>StreamWriter</c> matching a JSON Path match query (<c>@?</c>) ordered by
/// by the given fields in the document /// the given fields in the document
/// </summary> /// </summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param> /// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
@ -1239,9 +1238,7 @@ type NpgsqlConnectionCSharpExtensions =
static member inline WriteJsonByJsonPathOrdered(conn, tableName, writer, jsonPath, orderFields) = static member inline WriteJsonByJsonPathOrdered(conn, tableName, writer, jsonPath, orderFields) =
Json.writeByJsonPathOrdered tableName writer jsonPath orderFields (Sql.existingConnection conn) Json.writeByJsonPathOrdered tableName writer jsonPath orderFields (Sql.existingConnection conn)
/// <summary> /// <summary>Retrieve the first JSON document matching JSON field comparisons (<c>-&gt;&gt; =</c>, etc.)</summary>
/// Retrieve the first JSON document matching JSON field comparisons (<c>-&gt;&gt; =</c>, etc.)
/// </summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table from which a document should be retrieved (may include schema)</param> /// <param name="tableName">The table from which a document should be retrieved (may include schema)</param>
/// <param name="howMatched">Whether to match any or all of the field conditions</param> /// <param name="howMatched">Whether to match any or all of the field conditions</param>
@ -1303,8 +1300,7 @@ type NpgsqlConnectionCSharpExtensions =
Json.firstByContains tableName criteria (Sql.existingConnection conn) Json.firstByContains tableName criteria (Sql.existingConnection conn)
/// <summary> /// <summary>
/// Write the first JSON document to the given <c>StreamWriter</c> matching a JSON containment query /// Write the first JSON document to the given <c>StreamWriter</c> matching a JSON containment query (<c>@&gt;</c>)
/// (<c>@&gt;</c>)
/// </summary> /// </summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table from which a document should be retrieved (may include schema)</param> /// <param name="tableName">The table from which a document should be retrieved (may include schema)</param>
@ -1315,8 +1311,8 @@ type NpgsqlConnectionCSharpExtensions =
Json.writeFirstByContains tableName writer criteria (Sql.existingConnection conn) Json.writeFirstByContains tableName writer criteria (Sql.existingConnection conn)
/// <summary> /// <summary>
/// Retrieve the first JSON document matching a JSON containment query (<c>@&gt;</c>) ordered by the given /// Retrieve the first JSON document matching a JSON containment query (<c>@&gt;</c>) ordered by the given fields in
/// fields in the document /// the document
/// </summary> /// </summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table from which a document should be retrieved (may include schema)</param> /// <param name="tableName">The table from which a document should be retrieved (may include schema)</param>
@ -1328,8 +1324,8 @@ type NpgsqlConnectionCSharpExtensions =
Json.firstByContainsOrdered tableName criteria orderFields (Sql.existingConnection conn) Json.firstByContainsOrdered tableName criteria orderFields (Sql.existingConnection conn)
/// <summary> /// <summary>
/// Write the first JSON document to the given <c>StreamWriter</c> matching a JSON containment query /// Write the first JSON document to the given <c>StreamWriter</c> matching a JSON containment query (<c>@&gt;</c>)
/// (<c>@&gt;</c>) ordered by the given fields in the document /// ordered by the given fields in the document
/// </summary> /// </summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table from which a document should be retrieved (may include schema)</param> /// <param name="tableName">The table from which a document should be retrieved (may include schema)</param>
@ -1361,8 +1357,8 @@ type NpgsqlConnectionCSharpExtensions =
Json.writeFirstByJsonPath tableName writer jsonPath (Sql.existingConnection conn) Json.writeFirstByJsonPath tableName writer jsonPath (Sql.existingConnection conn)
/// <summary> /// <summary>
/// Retrieve the first JSON document matching a JSON Path match query (<c>@?</c>) ordered by the given fields /// Retrieve the first JSON document matching a JSON Path match query (<c>@?</c>) ordered by the given fields in the
/// in the document /// document
/// </summary> /// </summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table from which a document should be retrieved (may include schema)</param> /// <param name="tableName">The table from which a document should be retrieved (may include schema)</param>
@ -1416,7 +1412,7 @@ type NpgsqlConnectionCSharpExtensions =
Patch.byId tableName docId patch (Sql.existingConnection conn) Patch.byId tableName docId patch (Sql.existingConnection conn)
/// <summary> /// <summary>
/// Patch documents using a JSON field comparison query in the <tt>WHERE</tt> clause (<tt>-&gt;&gt; =</tt>, etc.) /// Patch documents using a JSON field comparison query in the <c>WHERE</c> clause (<c>-&gt;&gt; =</c>, etc.)
/// </summary> /// </summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table in which documents should be patched (may include schema)</param> /// <param name="tableName">The table in which documents should be patched (may include schema)</param>
@ -1427,7 +1423,7 @@ type NpgsqlConnectionCSharpExtensions =
static member inline PatchByFields(conn, tableName, howMatched, fields, patch: 'TPatch) = static member inline PatchByFields(conn, tableName, howMatched, fields, patch: 'TPatch) =
Patch.byFields tableName howMatched fields patch (Sql.existingConnection conn) Patch.byFields tableName howMatched fields patch (Sql.existingConnection conn)
/// <summary>Patch documents using a JSON containment query in the <tt>WHERE</tt> clause (<tt>@&gt;</tt>)</summary> /// <summary>Patch documents using a JSON containment query in the <c>WHERE</c> clause (<c>@&gt;</c>)</summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table in which documents should be patched (may include schema)</param> /// <param name="tableName">The table in which documents should be patched (may include schema)</param>
/// <param name="criteria">The document to match the containment query</param> /// <param name="criteria">The document to match the containment query</param>
@ -1436,7 +1432,7 @@ type NpgsqlConnectionCSharpExtensions =
static member inline PatchByContains(conn, tableName, criteria: 'TCriteria, patch: 'TPatch) = static member inline PatchByContains(conn, tableName, criteria: 'TCriteria, patch: 'TPatch) =
Patch.byContains tableName criteria patch (Sql.existingConnection conn) Patch.byContains tableName criteria patch (Sql.existingConnection conn)
/// <summary>Patch documents using a JSON Path match query in the <tt>WHERE</tt> clause (<tt>@?</tt>)</summary> /// <summary>Patch documents using a JSON Path match query in the <c>WHERE</c> clause (<c>@?</c>)</summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table in which documents should be patched (may include schema)</param> /// <param name="tableName">The table in which documents should be patched (may include schema)</param>
/// <param name="jsonPath">The JSON Path expression to match</param> /// <param name="jsonPath">The JSON Path expression to match</param>
@ -1464,7 +1460,7 @@ type NpgsqlConnectionCSharpExtensions =
static member inline RemoveFieldsByFields(conn, tableName, howMatched, fields, fieldNames) = static member inline RemoveFieldsByFields(conn, tableName, howMatched, fields, fieldNames) =
RemoveFields.byFields tableName howMatched fields fieldNames (Sql.existingConnection conn) RemoveFields.byFields tableName howMatched fields fieldNames (Sql.existingConnection conn)
/// <summary>Remove fields from documents via a JSON containment query (<tt>@&gt;</tt>)</summary> /// <summary>Remove fields from documents via a JSON containment query (<c>@&gt;</c>)</summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table in which documents should be modified (may include schema)</param> /// <param name="tableName">The table in which documents should be modified (may include schema)</param>
/// <param name="criteria">The document to match the containment query</param> /// <param name="criteria">The document to match the containment query</param>
@ -1473,7 +1469,7 @@ type NpgsqlConnectionCSharpExtensions =
static member inline RemoveFieldsByContains(conn, tableName, criteria: 'TContains, fieldNames) = static member inline RemoveFieldsByContains(conn, tableName, criteria: 'TContains, fieldNames) =
RemoveFields.byContains tableName criteria fieldNames (Sql.existingConnection conn) RemoveFields.byContains tableName criteria fieldNames (Sql.existingConnection conn)
/// <summary>Remove fields from documents via a JSON Path match query (<tt>@?</tt>)</summary> /// <summary>Remove fields from documents via a JSON Path match query (<c>@?</c>)</summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table in which documents should be modified (may include schema)</param> /// <param name="tableName">The table in which documents should be modified (may include schema)</param>
/// <param name="jsonPath">The JSON Path expression to match</param> /// <param name="jsonPath">The JSON Path expression to match</param>
@ -1490,7 +1486,7 @@ type NpgsqlConnectionCSharpExtensions =
static member inline DeleteById(conn, tableName, docId: 'TKey) = static member inline DeleteById(conn, tableName, docId: 'TKey) =
Delete.byId tableName docId (Sql.existingConnection conn) Delete.byId tableName docId (Sql.existingConnection conn)
/// <summary>Delete documents by matching a JSON field comparison query (<tt>-&gt;&gt; =</tt>, etc.)</summary> /// <summary>Delete documents by matching a JSON field comparison query (<c>-&gt;&gt; =</c>, etc.)</summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table in which documents should be deleted (may include schema)</param> /// <param name="tableName">The table in which documents should be deleted (may include schema)</param>
/// <param name="howMatched">Whether to match any or all of the field conditions</param> /// <param name="howMatched">Whether to match any or all of the field conditions</param>
@ -1499,7 +1495,7 @@ type NpgsqlConnectionCSharpExtensions =
static member inline DeleteByFields(conn, tableName, howMatched, fields) = static member inline DeleteByFields(conn, tableName, howMatched, fields) =
Delete.byFields tableName howMatched fields (Sql.existingConnection conn) Delete.byFields tableName howMatched fields (Sql.existingConnection conn)
/// <summary>Delete documents by matching a JSON contains query (<tt>@&gt;</tt>)</summary> /// <summary>Delete documents by matching a JSON contains query (<c>@&gt;</c>)</summary>
/// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param> /// <param name="conn">The <c>NpgsqlConnection</c> on which to run the query</param>
/// <param name="tableName">The table in which documents should be deleted (may include schema)</param> /// <param name="tableName">The table in which documents should be deleted (may include schema)</param>
/// <param name="criteria">The document to match the containment query</param> /// <param name="criteria">The document to match the containment query</param>

View File

@ -59,7 +59,7 @@ module Custom =
/// <param name="query">The query to retrieve the results</param> /// <param name="query">The query to retrieve the results</param>
/// <param name="parameters">Parameters to use for the query</param> /// <param name="parameters">Parameters to use for the query</param>
/// <param name="mapFunc">The mapping function between the document and the domain item</param> /// <param name="mapFunc">The mapping function between the document and the domain item</param>
/// <returns><tt>Some</tt> with the first matching result, or <tt>None</tt> if not found</returns> /// <returns><c>Some</c> with the first matching result, or <c>None</c> if not found</returns>
[<CompiledName "FSharpSingle">] [<CompiledName "FSharpSingle">]
let single<'TDoc> query parameters (mapFunc: RowReader -> 'TDoc) = let single<'TDoc> query parameters (mapFunc: RowReader -> 'TDoc) =
WithProps.Custom.single<'TDoc> query parameters mapFunc (fromDataSource ()) WithProps.Custom.single<'TDoc> query parameters mapFunc (fromDataSource ())
@ -68,7 +68,7 @@ module Custom =
/// <param name="query">The query to retrieve the results</param> /// <param name="query">The query to retrieve the results</param>
/// <param name="parameters">Parameters to use for the query</param> /// <param name="parameters">Parameters to use for the query</param>
/// <param name="mapFunc">The mapping function between the document and the domain item</param> /// <param name="mapFunc">The mapping function between the document and the domain item</param>
/// <returns>The first matching result, or <tt>null</tt> if not found</returns> /// <returns>The first matching result, or <c>null</c> if not found</returns>
let Single<'TDoc when 'TDoc: null and 'TDoc: not struct>( let Single<'TDoc when 'TDoc: null and 'TDoc: not struct>(
query, parameters, mapFunc: System.Func<RowReader, 'TDoc>) = query, parameters, mapFunc: System.Func<RowReader, 'TDoc>) =
WithProps.Custom.Single<'TDoc>(query, parameters, mapFunc, fromDataSource ()) WithProps.Custom.Single<'TDoc>(query, parameters, mapFunc, fromDataSource ())
@ -171,7 +171,7 @@ module Count =
let all tableName = let all tableName =
WithProps.Count.all tableName (fromDataSource ()) WithProps.Count.all tableName (fromDataSource ())
/// <summary>Count matching documents using JSON field comparisons (<tt>-&gt;&gt; =</tt>, etc.)</summary> /// <summary>Count matching documents using JSON field comparisons (<c>-&gt;&gt; =</c>, etc.)</summary>
/// <param name="tableName">The table in which documents should be counted (may include schema)</param> /// <param name="tableName">The table in which documents should be counted (may include schema)</param>
/// <param name="howMatched">Whether to match any or all of the field conditions</param> /// <param name="howMatched">Whether to match any or all of the field conditions</param>
/// <param name="fields">The field conditions to match</param> /// <param name="fields">The field conditions to match</param>
@ -180,7 +180,7 @@ module Count =
let byFields tableName howMatched fields = let byFields tableName howMatched fields =
WithProps.Count.byFields tableName howMatched fields (fromDataSource ()) WithProps.Count.byFields tableName howMatched fields (fromDataSource ())
/// <summary>Count matching documents using a JSON containment query (<tt>@&gt;</tt>)</summary> /// <summary>Count matching documents using a JSON containment query (<c>@&gt;</c>)</summary>
/// <param name="tableName">The table in which documents should be counted (may include schema)</param> /// <param name="tableName">The table in which documents should be counted (may include schema)</param>
/// <param name="criteria">The document to match with the containment query</param> /// <param name="criteria">The document to match with the containment query</param>
/// <returns>The count of the documents in the table</returns> /// <returns>The count of the documents in the table</returns>
@ -188,7 +188,7 @@ module Count =
let byContains tableName criteria = let byContains tableName criteria =
WithProps.Count.byContains tableName criteria (fromDataSource ()) WithProps.Count.byContains tableName criteria (fromDataSource ())
/// <summary>Count matching documents using a JSON Path match query (<tt>@?</tt>)</summary> /// <summary>Count matching documents using a JSON Path match query (<c>@?</c>)</summary>
/// <param name="tableName">The table in which documents should be counted (may include schema)</param> /// <param name="tableName">The table in which documents should be counted (may include schema)</param>
/// <param name="jsonPath">The JSON Path expression to be matched</param> /// <param name="jsonPath">The JSON Path expression to be matched</param>
/// <returns>The count of the documents in the table</returns> /// <returns>The count of the documents in the table</returns>
@ -209,7 +209,7 @@ module Exists =
let byId tableName docId = let byId tableName docId =
WithProps.Exists.byId tableName docId (fromDataSource ()) WithProps.Exists.byId tableName docId (fromDataSource ())
/// <summary>Determine if a document exists using JSON field comparisons (<tt>-&gt;&gt; =</tt>, etc.)</summary> /// <summary>Determine if a document exists using JSON field comparisons (<c>-&gt;&gt; =</c>, etc.)</summary>
/// <param name="tableName">The table in which existence should be checked (may include schema)</param> /// <param name="tableName">The table in which existence should be checked (may include schema)</param>
/// <param name="howMatched">Whether to match any or all of the field conditions</param> /// <param name="howMatched">Whether to match any or all of the field conditions</param>
/// <param name="fields">The field conditions to match</param> /// <param name="fields">The field conditions to match</param>
@ -218,7 +218,7 @@ module Exists =
let byFields tableName howMatched fields = let byFields tableName howMatched fields =
WithProps.Exists.byFields tableName howMatched fields (fromDataSource ()) WithProps.Exists.byFields tableName howMatched fields (fromDataSource ())
/// <summary>Determine if a document exists using a JSON containment query (<tt>@&gt;</tt>)</summary> /// <summary>Determine if a document exists using a JSON containment query (<c>@&gt;</c>)</summary>
/// <param name="tableName">The table in which existence should be checked (may include schema)</param> /// <param name="tableName">The table in which existence should be checked (may include schema)</param>
/// <param name="criteria">The document to match with the containment query</param> /// <param name="criteria">The document to match with the containment query</param>
/// <returns>True if any matching documents exist, false if not</returns> /// <returns>True if any matching documents exist, false if not</returns>
@ -226,7 +226,7 @@ module Exists =
let byContains tableName criteria = let byContains tableName criteria =
WithProps.Exists.byContains tableName criteria (fromDataSource ()) WithProps.Exists.byContains tableName criteria (fromDataSource ())
/// <summary>Determine if a document exists using a JSON Path match query (<tt>@?</tt>)</summary> /// <summary>Determine if a document exists using a JSON Path match query (<c>@?</c>)</summary>
/// <param name="tableName">The table in which existence should be checked (may include schema)</param> /// <param name="tableName">The table in which existence should be checked (may include schema)</param>
/// <param name="jsonPath">The JSON Path expression to be matched</param> /// <param name="jsonPath">The JSON Path expression to be matched</param>
/// <returns>True if any matching documents exist, false if not</returns> /// <returns>True if any matching documents exist, false if not</returns>
@ -270,7 +270,7 @@ module Find =
/// <summary>Retrieve a document by its ID</summary> /// <summary>Retrieve a document by its ID</summary>
/// <param name="tableName">The table from which a document should be retrieved (may include schema)</param> /// <param name="tableName">The table from which a document should be retrieved (may include schema)</param>
/// <param name="docId">The ID of the document to retrieve</param> /// <param name="docId">The ID of the document to retrieve</param>
/// <returns><tt>Some</tt> with the document if found, <tt>None</tt> otherwise</returns> /// <returns><c>Some</c> with the document if found, <c>None</c> otherwise</returns>
[<CompiledName "FSharpById">] [<CompiledName "FSharpById">]
let byId<'TKey, 'TDoc> tableName docId = let byId<'TKey, 'TDoc> tableName docId =
WithProps.Find.byId<'TKey, 'TDoc> tableName docId (fromDataSource ()) WithProps.Find.byId<'TKey, 'TDoc> tableName docId (fromDataSource ())
@ -278,11 +278,11 @@ module Find =
/// <summary>Retrieve a document by its ID</summary> /// <summary>Retrieve a document by its ID</summary>
/// <param name="tableName">The table from which a document should be retrieved (may include schema)</param> /// <param name="tableName">The table from which a document should be retrieved (may include schema)</param>
/// <param name="docId">The ID of the document to retrieve</param> /// <param name="docId">The ID of the document to retrieve</param>
/// <returns>The document if found, <tt>null</tt> otherwise</returns> /// <returns>The document if found, <c>null</c> otherwise</returns>
let ById<'TKey, 'TDoc when 'TDoc: null and 'TDoc: not struct>(tableName, docId: 'TKey) = let ById<'TKey, 'TDoc when 'TDoc: null and 'TDoc: not struct>(tableName, docId: 'TKey) =
WithProps.Find.ById<'TKey, 'TDoc>(tableName, docId, fromDataSource ()) WithProps.Find.ById<'TKey, 'TDoc>(tableName, docId, fromDataSource ())
/// <summary>Retrieve documents matching JSON field comparisons (<tt>-&gt;&gt; =</tt>, etc.)</summary> /// <summary>Retrieve documents matching JSON field comparisons (<c>-&gt;&gt; =</c>, etc.)</summary>
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param> /// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
/// <param name="howMatched">Whether to match any or all of the field conditions</param> /// <param name="howMatched">Whether to match any or all of the field conditions</param>
/// <param name="fields">The field conditions to match</param> /// <param name="fields">The field conditions to match</param>
@ -291,7 +291,7 @@ module Find =
let byFields<'TDoc> tableName howMatched fields = let byFields<'TDoc> tableName howMatched fields =
WithProps.Find.byFields<'TDoc> tableName howMatched fields (fromDataSource ()) WithProps.Find.byFields<'TDoc> tableName howMatched fields (fromDataSource ())
/// <summary>Retrieve documents matching JSON field comparisons (<tt>-&gt;&gt; =</tt>, etc.)</summary> /// <summary>Retrieve documents matching JSON field comparisons (<c>-&gt;&gt; =</c>, etc.)</summary>
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param> /// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
/// <param name="howMatched">Whether to match any or all of the field conditions</param> /// <param name="howMatched">Whether to match any or all of the field conditions</param>
/// <param name="fields">The field conditions to match</param> /// <param name="fields">The field conditions to match</param>
@ -300,8 +300,8 @@ module Find =
WithProps.Find.ByFields<'TDoc>(tableName, howMatched, fields, fromDataSource ()) WithProps.Find.ByFields<'TDoc>(tableName, howMatched, fields, fromDataSource ())
/// <summary> /// <summary>
/// Retrieve documents matching JSON field comparisons (<tt>-&gt;&gt; =</tt>, etc.) ordered by the given fields in /// Retrieve documents matching JSON field comparisons (<c>-&gt;&gt; =</c>, etc.) ordered by the given fields in the
/// the document /// document
/// </summary> /// </summary>
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param> /// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
/// <param name="howMatched">Whether to match any or all of the field conditions</param> /// <param name="howMatched">Whether to match any or all of the field conditions</param>
@ -313,8 +313,8 @@ module Find =
WithProps.Find.byFieldsOrdered<'TDoc> tableName howMatched queryFields orderFields (fromDataSource ()) WithProps.Find.byFieldsOrdered<'TDoc> tableName howMatched queryFields orderFields (fromDataSource ())
/// <summary> /// <summary>
/// Retrieve documents matching JSON field comparisons (<tt>-&gt;&gt; =</tt>, etc.) ordered by the given fields in /// Retrieve documents matching JSON field comparisons (<c>-&gt;&gt; =</c>, etc.) ordered by the given fields in the
/// the document /// document
/// </summary> /// </summary>
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param> /// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
/// <param name="howMatched">Whether to match any or all of the field conditions</param> /// <param name="howMatched">Whether to match any or all of the field conditions</param>
@ -324,7 +324,7 @@ module Find =
let ByFieldsOrdered<'TDoc>(tableName, howMatched, queryFields, orderFields) = let ByFieldsOrdered<'TDoc>(tableName, howMatched, queryFields, orderFields) =
WithProps.Find.ByFieldsOrdered<'TDoc>(tableName, howMatched, queryFields, orderFields, fromDataSource ()) WithProps.Find.ByFieldsOrdered<'TDoc>(tableName, howMatched, queryFields, orderFields, fromDataSource ())
/// <summary>Retrieve documents matching a JSON containment query (<tt>@&gt;</tt>)</summary> /// <summary>Retrieve documents matching a JSON containment query (<c>@&gt;</c>)</summary>
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param> /// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
/// <param name="criteria">The document to match with the containment query</param> /// <param name="criteria">The document to match with the containment query</param>
/// <returns>All documents matching the given containment query</returns> /// <returns>All documents matching the given containment query</returns>
@ -332,7 +332,7 @@ module Find =
let byContains<'TDoc> tableName (criteria: obj) = let byContains<'TDoc> tableName (criteria: obj) =
WithProps.Find.byContains<'TDoc> tableName criteria (fromDataSource ()) WithProps.Find.byContains<'TDoc> tableName criteria (fromDataSource ())
/// <summary>Retrieve documents matching a JSON containment query (<tt>@&gt;</tt>)</summary> /// <summary>Retrieve documents matching a JSON containment query (<c>@&gt;</c>)</summary>
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param> /// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
/// <param name="criteria">The document to match with the containment query</param> /// <param name="criteria">The document to match with the containment query</param>
/// <returns>All documents matching the given containment query</returns> /// <returns>All documents matching the given containment query</returns>
@ -340,8 +340,7 @@ module Find =
WithProps.Find.ByContains<'TDoc>(tableName, criteria, fromDataSource ()) WithProps.Find.ByContains<'TDoc>(tableName, criteria, fromDataSource ())
/// <summary> /// <summary>
/// Retrieve documents matching a JSON containment query (<tt>@&gt;</tt>) ordered by the given fields in the /// Retrieve documents matching a JSON containment query (<c>@&gt;</c>) ordered by the given fields in the document
/// document
/// </summary> /// </summary>
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param> /// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
/// <param name="criteria">The document to match with the containment query</param> /// <param name="criteria">The document to match with the containment query</param>
@ -352,8 +351,7 @@ module Find =
WithProps.Find.byContainsOrdered<'TDoc> tableName criteria orderFields (fromDataSource ()) WithProps.Find.byContainsOrdered<'TDoc> tableName criteria orderFields (fromDataSource ())
/// <summary> /// <summary>
/// Retrieve documents matching a JSON containment query (<tt>@&gt;</tt>) ordered by the given fields in the /// Retrieve documents matching a JSON containment query (<c>@&gt;</c>) ordered by the given fields in the document
/// document
/// </summary> /// </summary>
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param> /// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
/// <param name="criteria">The document to match with the containment query</param> /// <param name="criteria">The document to match with the containment query</param>
@ -362,7 +360,7 @@ module Find =
let ByContainsOrdered<'TDoc>(tableName, criteria: obj, orderFields) = let ByContainsOrdered<'TDoc>(tableName, criteria: obj, orderFields) =
WithProps.Find.ByContainsOrdered<'TDoc>(tableName, criteria, orderFields, fromDataSource ()) WithProps.Find.ByContainsOrdered<'TDoc>(tableName, criteria, orderFields, fromDataSource ())
/// <summary>Retrieve documents matching a JSON Path match query (<tt>@?</tt>)</summary> /// <summary>Retrieve documents matching a JSON Path match query (<c>@?</c>)</summary>
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param> /// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
/// <param name="jsonPath">The JSON Path expression to match</param> /// <param name="jsonPath">The JSON Path expression to match</param>
/// <returns>All documents matching the given JSON Path expression</returns> /// <returns>All documents matching the given JSON Path expression</returns>
@ -370,7 +368,7 @@ module Find =
let byJsonPath<'TDoc> tableName jsonPath = let byJsonPath<'TDoc> tableName jsonPath =
WithProps.Find.byJsonPath<'TDoc> tableName jsonPath (fromDataSource ()) WithProps.Find.byJsonPath<'TDoc> tableName jsonPath (fromDataSource ())
/// <summary>Retrieve documents matching a JSON Path match query (<tt>@?</tt>)</summary> /// <summary>Retrieve documents matching a JSON Path match query (<c>@?</c>)</summary>
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param> /// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
/// <param name="jsonPath">The JSON Path expression to match</param> /// <param name="jsonPath">The JSON Path expression to match</param>
/// <returns>All documents matching the given JSON Path expression</returns> /// <returns>All documents matching the given JSON Path expression</returns>
@ -378,7 +376,7 @@ module Find =
WithProps.Find.ByJsonPath<'TDoc>(tableName, jsonPath, fromDataSource ()) WithProps.Find.ByJsonPath<'TDoc>(tableName, jsonPath, fromDataSource ())
/// <summary> /// <summary>
/// Retrieve documents matching a JSON Path match query (<tt>@?</tt>) ordered by the given fields in the document /// Retrieve documents matching a JSON Path match query (<c>@?</c>) ordered by the given fields in the document
/// </summary> /// </summary>
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param> /// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
/// <param name="jsonPath">The JSON Path expression to match</param> /// <param name="jsonPath">The JSON Path expression to match</param>
@ -389,7 +387,7 @@ module Find =
WithProps.Find.byJsonPathOrdered<'TDoc> tableName jsonPath orderFields (fromDataSource ()) WithProps.Find.byJsonPathOrdered<'TDoc> tableName jsonPath orderFields (fromDataSource ())
/// <summary> /// <summary>
/// Retrieve documents matching a JSON Path match query (<tt>@?</tt>) ordered by the given fields in the document /// Retrieve documents matching a JSON Path match query (<c>@?</c>) ordered by the given fields in the document
/// </summary> /// </summary>
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param> /// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
/// <param name="jsonPath">The JSON Path expression to match</param> /// <param name="jsonPath">The JSON Path expression to match</param>
@ -398,128 +396,122 @@ module Find =
let ByJsonPathOrdered<'TDoc>(tableName, jsonPath, orderFields) = let ByJsonPathOrdered<'TDoc>(tableName, jsonPath, orderFields) =
WithProps.Find.ByJsonPathOrdered<'TDoc>(tableName, jsonPath, orderFields, fromDataSource ()) WithProps.Find.ByJsonPathOrdered<'TDoc>(tableName, jsonPath, orderFields, fromDataSource ())
/// <summary>Retrieve the first document matching JSON field comparisons (<tt>-&gt;&gt; =</tt>, etc.)</summary> /// <summary>Retrieve the first document matching JSON field comparisons (<c>-&gt;&gt; =</c>, etc.)</summary>
/// <param name="tableName">The table from which a document should be retrieved (may include schema)</param> /// <param name="tableName">The table from which a document should be retrieved (may include schema)</param>
/// <param name="howMatched">Whether to match any or all of the field conditions</param> /// <param name="howMatched">Whether to match any or all of the field conditions</param>
/// <param name="fields">The field conditions to match</param> /// <param name="fields">The field conditions to match</param>
/// <returns><tt>Some</tt> with the first document, or <tt>None</tt> if not found</returns> /// <returns><c>Some</c> with the first document, or <c>None</c> if not found</returns>
[<CompiledName "FSharpFirstByFields">] [<CompiledName "FSharpFirstByFields">]
let firstByFields<'TDoc> tableName howMatched fields = let firstByFields<'TDoc> tableName howMatched fields =
WithProps.Find.firstByFields<'TDoc> tableName howMatched fields (fromDataSource ()) WithProps.Find.firstByFields<'TDoc> tableName howMatched fields (fromDataSource ())
/// <summary>Retrieve the first document matching JSON field comparisons (<tt>-&gt;&gt; =</tt>, etc.)</summary> /// <summary>Retrieve the first document matching JSON field comparisons (<c>-&gt;&gt; =</c>, etc.)</summary>
/// <param name="tableName">The table from which a document should be retrieved (may include schema)</param> /// <param name="tableName">The table from which a document should be retrieved (may include schema)</param>
/// <param name="howMatched">Whether to match any or all of the field conditions</param> /// <param name="howMatched">Whether to match any or all of the field conditions</param>
/// <param name="fields">The field conditions to match</param> /// <param name="fields">The field conditions to match</param>
/// <returns>The first document, or <tt>null</tt> if not found</returns> /// <returns>The first document, or <c>null</c> if not found</returns>
let FirstByFields<'TDoc when 'TDoc: null and 'TDoc: not struct>(tableName, howMatched, fields) = let FirstByFields<'TDoc when 'TDoc: null and 'TDoc: not struct>(tableName, howMatched, fields) =
WithProps.Find.FirstByFields<'TDoc>(tableName, howMatched, fields, fromDataSource ()) WithProps.Find.FirstByFields<'TDoc>(tableName, howMatched, fields, fromDataSource ())
/// <summary> /// <summary>
/// Retrieve the first document matching JSON field comparisons (<tt>-&gt;&gt; =</tt>, etc.) ordered by the given /// Retrieve the first document matching JSON field comparisons (<c>-&gt;&gt; =</c>, etc.) ordered by the given
/// fields in the document /// fields in the document
/// </summary> /// </summary>
/// <param name="tableName">The table from which a document should be retrieved (may include schema)</param> /// <param name="tableName">The table from which a document should be retrieved (may include schema)</param>
/// <param name="howMatched">Whether to match any or all of the field conditions</param> /// <param name="howMatched">Whether to match any or all of the field conditions</param>
/// <param name="queryFields">The field conditions to match</param> /// <param name="queryFields">The field conditions to match</param>
/// <param name="orderFields">Fields by which the results should be ordered</param> /// <param name="orderFields">Fields by which the results should be ordered</param>
/// <returns> /// <returns><c>Some</c> with the first document ordered by the given fields, or <c>None</c> if not found</returns>
/// <tt>Some</tt> with the first document ordered by the given fields, or <tt>None</tt> if not found
/// </returns>
[<CompiledName "FSharpFirstByFieldsOrdered">] [<CompiledName "FSharpFirstByFieldsOrdered">]
let firstByFieldsOrdered<'TDoc> tableName howMatched queryFields orderFields = let firstByFieldsOrdered<'TDoc> tableName howMatched queryFields orderFields =
WithProps.Find.firstByFieldsOrdered<'TDoc> tableName howMatched queryFields orderFields (fromDataSource ()) WithProps.Find.firstByFieldsOrdered<'TDoc> tableName howMatched queryFields orderFields (fromDataSource ())
/// <summary> /// <summary>
/// Retrieve the first document matching JSON field comparisons (<tt>-&gt;&gt; =</tt>, etc.) ordered by the given /// Retrieve the first document matching JSON field comparisons (<c>-&gt;&gt; =</c>, etc.) ordered by the given
/// fields in the document /// fields in the document
/// </summary> /// </summary>
/// <param name="tableName">The table from which a document should be retrieved (may include schema)</param> /// <param name="tableName">The table from which a document should be retrieved (may include schema)</param>
/// <param name="howMatched">Whether to match any or all of the field conditions</param> /// <param name="howMatched">Whether to match any or all of the field conditions</param>
/// <param name="queryFields">The field conditions to match</param> /// <param name="queryFields">The field conditions to match</param>
/// <param name="orderFields">Fields by which the results should be ordered</param> /// <param name="orderFields">Fields by which the results should be ordered</param>
/// <returns>The first document ordered by the given fields, or <tt>null</tt> if not found</returns> /// <returns>The first document ordered by the given fields, or <c>null</c> if not found</returns>
let FirstByFieldsOrdered<'TDoc when 'TDoc: null and 'TDoc: not struct>( let FirstByFieldsOrdered<'TDoc when 'TDoc: null and 'TDoc: not struct>(
tableName, howMatched, queryFields, orderFields) = tableName, howMatched, queryFields, orderFields) =
WithProps.Find.FirstByFieldsOrdered<'TDoc>(tableName, howMatched, queryFields, orderFields, fromDataSource ()) WithProps.Find.FirstByFieldsOrdered<'TDoc>(tableName, howMatched, queryFields, orderFields, fromDataSource ())
/// <summary>Retrieve the first document matching a JSON containment query (<tt>@&gt;</tt>)</summary> /// <summary>Retrieve the first document matching a JSON containment query (<c>@&gt;</c>)</summary>
/// <param name="tableName">The table from which a document should be retrieved (may include schema)</param> /// <param name="tableName">The table from which a document should be retrieved (may include schema)</param>
/// <param name="criteria">The document to match with the containment query</param> /// <param name="criteria">The document to match with the containment query</param>
/// <returns><tt>Some</tt> with the first document, or <tt>None</tt> if not found</returns> /// <returns><c>Some</c> with the first document, or <c>None</c> if not found</returns>
[<CompiledName "FSharpFirstByContains">] [<CompiledName "FSharpFirstByContains">]
let firstByContains<'TDoc> tableName (criteria: obj) = let firstByContains<'TDoc> tableName (criteria: obj) =
WithProps.Find.firstByContains<'TDoc> tableName criteria (fromDataSource ()) WithProps.Find.firstByContains<'TDoc> tableName criteria (fromDataSource ())
/// <summary>Retrieve the first document matching a JSON containment query (<tt>@&gt;</tt>)</summary> /// <summary>Retrieve the first document matching a JSON containment query (<c>@&gt;</c>)</summary>
/// <param name="tableName">The table from which a document should be retrieved (may include schema)</param> /// <param name="tableName">The table from which a document should be retrieved (may include schema)</param>
/// <param name="criteria">The document to match with the containment query</param> /// <param name="criteria">The document to match with the containment query</param>
/// <returns>The first document, or <tt>null</tt> if not found</returns> /// <returns>The first document, or <c>null</c> if not found</returns>
let FirstByContains<'TDoc when 'TDoc: null and 'TDoc: not struct>(tableName, criteria: obj) = let FirstByContains<'TDoc when 'TDoc: null and 'TDoc: not struct>(tableName, criteria: obj) =
WithProps.Find.FirstByContains<'TDoc>(tableName, criteria, fromDataSource ()) WithProps.Find.FirstByContains<'TDoc>(tableName, criteria, fromDataSource ())
/// <summary> /// <summary>
/// Retrieve the first document matching a JSON containment query (<tt>@&gt;</tt>) ordered by the given fields in /// Retrieve the first document matching a JSON containment query (<c>@&gt;</c>) ordered by the given fields in the
/// the document /// document
/// </summary> /// </summary>
/// <param name="tableName">The table from which a document should be retrieved (may include schema)</param> /// <param name="tableName">The table from which a document should be retrieved (may include schema)</param>
/// <param name="criteria">The document to match with the containment query</param> /// <param name="criteria">The document to match with the containment query</param>
/// <param name="orderFields">Fields by which the results should be ordered</param> /// <param name="orderFields">Fields by which the results should be ordered</param>
/// <returns> /// <returns><c>Some</c> with the first document ordered by the given fields, or <c>None</c> if not found</returns>
/// <tt>Some</tt> with the first document ordered by the given fields, or <tt>None</tt> if not found
/// </returns>
[<CompiledName "FSharpFirstByContainsOrdered">] [<CompiledName "FSharpFirstByContainsOrdered">]
let firstByContainsOrdered<'TDoc> tableName (criteria: obj) orderFields = let firstByContainsOrdered<'TDoc> tableName (criteria: obj) orderFields =
WithProps.Find.firstByContainsOrdered<'TDoc> tableName criteria orderFields (fromDataSource ()) WithProps.Find.firstByContainsOrdered<'TDoc> tableName criteria orderFields (fromDataSource ())
/// <summary> /// <summary>
/// Retrieve the first document matching a JSON containment query (<tt>@&gt;</tt>) ordered by the given fields in /// Retrieve the first document matching a JSON containment query (<c>@&gt;</c>) ordered by the given fields in the
/// the document /// document
/// </summary> /// </summary>
/// <param name="tableName">The table from which a document should be retrieved (may include schema)</param> /// <param name="tableName">The table from which a document should be retrieved (may include schema)</param>
/// <param name="criteria">The document to match with the containment query</param> /// <param name="criteria">The document to match with the containment query</param>
/// <param name="orderFields">Fields by which the results should be ordered</param> /// <param name="orderFields">Fields by which the results should be ordered</param>
/// <returns>The first document ordered by the given fields, or <tt>null</tt> if not found</returns> /// <returns>The first document ordered by the given fields, or <c>null</c> if not found</returns>
let FirstByContainsOrdered<'TDoc when 'TDoc: null and 'TDoc: not struct>(tableName, criteria: obj, orderFields) = let FirstByContainsOrdered<'TDoc when 'TDoc: null and 'TDoc: not struct>(tableName, criteria: obj, orderFields) =
WithProps.Find.FirstByContainsOrdered<'TDoc>(tableName, criteria, orderFields, fromDataSource ()) WithProps.Find.FirstByContainsOrdered<'TDoc>(tableName, criteria, orderFields, fromDataSource ())
/// <summary>Retrieve the first document matching a JSON Path match query (<tt>@?</tt>)</summary> /// <summary>Retrieve the first document matching a JSON Path match query (<c>@?</c>)</summary>
/// <param name="tableName">The table from which a document should be retrieved (may include schema)</param> /// <param name="tableName">The table from which a document should be retrieved (may include schema)</param>
/// <param name="jsonPath">The JSON Path expression to match</param> /// <param name="jsonPath">The JSON Path expression to match</param>
/// <returns><tt>Some</tt> with the first document, or <tt>None</tt> if not found</returns> /// <returns><c>Some</c> with the first document, or <c>None</c> if not found</returns>
[<CompiledName "FSharpFirstByJsonPath">] [<CompiledName "FSharpFirstByJsonPath">]
let firstByJsonPath<'TDoc> tableName jsonPath = let firstByJsonPath<'TDoc> tableName jsonPath =
WithProps.Find.firstByJsonPath<'TDoc> tableName jsonPath (fromDataSource ()) WithProps.Find.firstByJsonPath<'TDoc> tableName jsonPath (fromDataSource ())
/// <summary>Retrieve the first document matching a JSON Path match query (<tt>@?</tt>)</summary> /// <summary>Retrieve the first document matching a JSON Path match query (<c>@?</c>)</summary>
/// <param name="tableName">The table from which a document should be retrieved (may include schema)</param> /// <param name="tableName">The table from which a document should be retrieved (may include schema)</param>
/// <param name="jsonPath">The JSON Path expression to match</param> /// <param name="jsonPath">The JSON Path expression to match</param>
/// <returns>The first document, or <tt>null</tt> if not found</returns> /// <returns>The first document, or <c>null</c> if not found</returns>
let FirstByJsonPath<'TDoc when 'TDoc: null and 'TDoc: not struct>(tableName, jsonPath) = let FirstByJsonPath<'TDoc when 'TDoc: null and 'TDoc: not struct>(tableName, jsonPath) =
WithProps.Find.FirstByJsonPath<'TDoc>(tableName, jsonPath, fromDataSource ()) WithProps.Find.FirstByJsonPath<'TDoc>(tableName, jsonPath, fromDataSource ())
/// <summary> /// <summary>
/// Retrieve the first document matching a JSON Path match query (<tt>@?</tt>) ordered by the given fields in the /// Retrieve the first document matching a JSON Path match query (<c>@?</c>) ordered by the given fields in the
/// document /// document
/// </summary> /// </summary>
/// <param name="tableName">The table from which a document should be retrieved (may include schema)</param> /// <param name="tableName">The table from which a document should be retrieved (may include schema)</param>
/// <param name="jsonPath">The JSON Path expression to match</param> /// <param name="jsonPath">The JSON Path expression to match</param>
/// <param name="orderFields">Fields by which the results should be ordered</param> /// <param name="orderFields">Fields by which the results should be ordered</param>
/// <returns> /// <returns><c>Some</c> with the first document ordered by the given fields, or <c>None</c> if not found</returns>
/// <tt>Some</tt> with the first document ordered by the given fields, or <tt>None</tt> if not found
/// </returns>
[<CompiledName "FSharpFirstByJsonPathOrdered">] [<CompiledName "FSharpFirstByJsonPathOrdered">]
let firstByJsonPathOrdered<'TDoc> tableName jsonPath orderFields = let firstByJsonPathOrdered<'TDoc> tableName jsonPath orderFields =
WithProps.Find.firstByJsonPathOrdered<'TDoc> tableName jsonPath orderFields (fromDataSource ()) WithProps.Find.firstByJsonPathOrdered<'TDoc> tableName jsonPath orderFields (fromDataSource ())
/// <summary> /// <summary>
/// Retrieve the first document matching a JSON Path match query (<tt>@?</tt>) ordered by the given fields in the /// Retrieve the first document matching a JSON Path match query (<c>@?</c>) ordered by the given fields in the
/// document /// document
/// </summary> /// </summary>
/// <param name="tableName">The table from which a document should be retrieved (may include schema)</param> /// <param name="tableName">The table from which a document should be retrieved (may include schema)</param>
/// <param name="jsonPath">The JSON Path expression to match</param> /// <param name="jsonPath">The JSON Path expression to match</param>
/// <param name="orderFields">Fields by which the results should be ordered</param> /// <param name="orderFields">Fields by which the results should be ordered</param>
/// <returns>The first document ordered by the given fields, or <tt>null</tt> if not found</returns> /// <returns>The first document ordered by the given fields, or <c>null</c> if not found</returns>
let FirstByJsonPathOrdered<'TDoc when 'TDoc: null and 'TDoc: not struct>(tableName, jsonPath, orderFields) = let FirstByJsonPathOrdered<'TDoc when 'TDoc: null and 'TDoc: not struct>(tableName, jsonPath, orderFields) =
WithProps.Find.FirstByJsonPathOrdered<'TDoc>(tableName, jsonPath, orderFields, fromDataSource ()) WithProps.Find.FirstByJsonPathOrdered<'TDoc>(tableName, jsonPath, orderFields, fromDataSource ())
@ -885,7 +877,7 @@ module Patch =
WithProps.Patch.byId tableName docId patch (fromDataSource ()) WithProps.Patch.byId tableName docId patch (fromDataSource ())
/// <summary> /// <summary>
/// Patch documents using a JSON field comparison query in the <tt>WHERE</tt> clause (<tt>-&gt;&gt; =</tt>, etc.) /// Patch documents using a JSON field comparison query in the <c>WHERE</c> clause (<c>-&gt;&gt; =</c>, etc.)
/// </summary> /// </summary>
/// <param name="tableName">The table in which documents should be patched (may include schema)</param> /// <param name="tableName">The table in which documents should be patched (may include schema)</param>
/// <param name="howMatched">Whether to match any or all of the field conditions</param> /// <param name="howMatched">Whether to match any or all of the field conditions</param>
@ -895,7 +887,7 @@ module Patch =
let byFields tableName howMatched fields (patch: 'TPatch) = let byFields tableName howMatched fields (patch: 'TPatch) =
WithProps.Patch.byFields tableName howMatched fields patch (fromDataSource ()) WithProps.Patch.byFields tableName howMatched fields patch (fromDataSource ())
/// <summary>Patch documents using a JSON containment query in the <tt>WHERE</tt> clause (<tt>@&gt;</tt>)</summary> /// <summary>Patch documents using a JSON containment query in the <c>WHERE</c> clause (<c>@&gt;</c>)</summary>
/// <param name="tableName">The table in which documents should be patched (may include schema)</param> /// <param name="tableName">The table in which documents should be patched (may include schema)</param>
/// <param name="criteria">The document to match the containment query</param> /// <param name="criteria">The document to match the containment query</param>
/// <param name="patch">The partial document to patch the existing document</param> /// <param name="patch">The partial document to patch the existing document</param>
@ -903,7 +895,7 @@ module Patch =
let byContains tableName (criteria: 'TCriteria) (patch: 'TPatch) = let byContains tableName (criteria: 'TCriteria) (patch: 'TPatch) =
WithProps.Patch.byContains tableName criteria patch (fromDataSource ()) WithProps.Patch.byContains tableName criteria patch (fromDataSource ())
/// <summary>Patch documents using a JSON Path match query in the <tt>WHERE</tt> clause (<tt>@?</tt>)</summary> /// <summary>Patch documents using a JSON Path match query in the <c>WHERE</c> clause (<c>@?</c>)</summary>
/// <param name="tableName">The table in which documents should be patched (may include schema)</param> /// <param name="tableName">The table in which documents should be patched (may include schema)</param>
/// <param name="jsonPath">The JSON Path expression to match</param> /// <param name="jsonPath">The JSON Path expression to match</param>
/// <param name="patch">The partial document to patch the existing document</param> /// <param name="patch">The partial document to patch the existing document</param>
@ -933,7 +925,7 @@ module RemoveFields =
let byFields tableName howMatched fields fieldNames = let byFields tableName howMatched fields fieldNames =
WithProps.RemoveFields.byFields tableName howMatched fields fieldNames (fromDataSource ()) WithProps.RemoveFields.byFields tableName howMatched fields fieldNames (fromDataSource ())
/// <summary>Remove fields from documents via a JSON containment query (<tt>@&gt;</tt>)</summary> /// <summary>Remove fields from documents via a JSON containment query (<c>@&gt;</c>)</summary>
/// <param name="tableName">The table in which documents should be modified (may include schema)</param> /// <param name="tableName">The table in which documents should be modified (may include schema)</param>
/// <param name="criteria">The document to match the containment query</param> /// <param name="criteria">The document to match the containment query</param>
/// <param name="fieldNames">One or more field names to remove from the matching documents</param> /// <param name="fieldNames">One or more field names to remove from the matching documents</param>
@ -941,7 +933,7 @@ module RemoveFields =
let byContains tableName (criteria: 'TContains) fieldNames = let byContains tableName (criteria: 'TContains) fieldNames =
WithProps.RemoveFields.byContains tableName criteria fieldNames (fromDataSource ()) WithProps.RemoveFields.byContains tableName criteria fieldNames (fromDataSource ())
/// <summary>Remove fields from documents via a JSON Path match query (<tt>@?</tt>)</summary> /// <summary>Remove fields from documents via a JSON Path match query (<c>@?</c>)</summary>
/// <param name="tableName">The table in which documents should be modified (may include schema)</param> /// <param name="tableName">The table in which documents should be modified (may include schema)</param>
/// <param name="jsonPath">The JSON Path expression to match</param> /// <param name="jsonPath">The JSON Path expression to match</param>
/// <param name="fieldNames">One or more field names to remove from the matching documents</param> /// <param name="fieldNames">One or more field names to remove from the matching documents</param>
@ -961,7 +953,7 @@ module Delete =
let byId tableName (docId: 'TKey) = let byId tableName (docId: 'TKey) =
WithProps.Delete.byId tableName docId (fromDataSource ()) WithProps.Delete.byId tableName docId (fromDataSource ())
/// <summary>Delete documents by matching a JSON field comparison query (<tt>-&gt;&gt; =</tt>, etc.)</summary> /// <summary>Delete documents by matching a JSON field comparison query (<c>-&gt;&gt; =</c>, etc.)</summary>
/// <param name="tableName">The table in which documents should be deleted (may include schema)</param> /// <param name="tableName">The table in which documents should be deleted (may include schema)</param>
/// <param name="howMatched">Whether to match any or all of the field conditions</param> /// <param name="howMatched">Whether to match any or all of the field conditions</param>
/// <param name="fields">The field conditions to match</param> /// <param name="fields">The field conditions to match</param>
@ -969,7 +961,7 @@ module Delete =
let byFields tableName howMatched fields = let byFields tableName howMatched fields =
WithProps.Delete.byFields tableName howMatched fields (fromDataSource ()) WithProps.Delete.byFields tableName howMatched fields (fromDataSource ())
/// <summary>Delete documents by matching a JSON contains query (<tt>@&gt;</tt>)</summary> /// <summary>Delete documents by matching a JSON contains query (<c>@&gt;</c>)</summary>
/// <param name="tableName">The table in which documents should be deleted (may include schema)</param> /// <param name="tableName">The table in which documents should be deleted (may include schema)</param>
/// <param name="criteria">The document to match the containment query</param> /// <param name="criteria">The document to match the containment query</param>
[<CompiledName "ByContains">] [<CompiledName "ByContains">]

View File

@ -7,11 +7,11 @@ open System.Text
[<Struct>] [<Struct>]
type DocumentIndex = type DocumentIndex =
/// <summary>A <tt>GIN</tt> index with standard operations (all operators supported)</summary> /// <summary>A <c>GIN</c> index with standard operations (all operators supported)</summary>
| Full | Full
/// <summary> /// <summary>
/// A <tt>GIN</tt> index with JSONPath operations (optimized for <tt>@&gt;</tt>, <tt>@?</tt>, <tt>@@</tt> operators) /// A <c>GIN</c> index with JSON Path operations (optimized for <c>@&gt;</c>, <c>@?</c>, <c>@@</c> operators)
/// </summary> /// </summary>
| Optimized | Optimized
@ -97,7 +97,7 @@ module Parameters =
name, Sql.jsonb (Configuration.serializer().Serialize it) name, Sql.jsonb (Configuration.serializer().Serialize it)
/// <summary>Create JSON field parameters</summary> /// <summary>Create JSON field parameters</summary>
/// <param name="fields">The <tt>Field</tt>s to convert to parameters</param> /// <param name="fields">The <c>Field</c>s to convert to parameters</param>
/// <param name="parameters">The current parameters for the query</param> /// <param name="parameters">The current parameters for the query</param>
/// <returns>A unified sequence of parameter names and values</returns> /// <returns>A unified sequence of parameter names and values</returns>
[<CompiledName "AddFields">] [<CompiledName "AddFields">]
@ -132,7 +132,7 @@ module Parameters =
/// <summary>Append JSON field name parameters for the given field names to the given parameters</summary> /// <summary>Append JSON field name parameters for the given field names to the given parameters</summary>
/// <param name="fieldNames">The names of fields to be addressed</param> /// <param name="fieldNames">The names of fields to be addressed</param>
/// <returns>The name (<tt>@name</tt>) and parameter value for the field names</returns> /// <returns>The name (<c>@name</c>) and parameter value for the field names</returns>
[<CompiledName "FieldNames">] [<CompiledName "FieldNames">]
let fieldNameParams (fieldNames: string seq) = let fieldNameParams (fieldNames: string seq) =
if Seq.length fieldNames = 1 then "@name", Sql.string (Seq.head fieldNames) if Seq.length fieldNames = 1 then "@name", Sql.string (Seq.head fieldNames)
@ -148,12 +148,10 @@ module Parameters =
[<RequireQualifiedAccess>] [<RequireQualifiedAccess>]
module Query = module Query =
/// <summary> /// <summary>Create a <c>WHERE</c> clause fragment to implement a comparison on fields in a JSON document</summary>
/// Create a <tt>WHERE</tt> clause fragment to implement a comparison on fields in a JSON document
/// </summary>
/// <param name="howMatched">How the fields should be matched</param> /// <param name="howMatched">How the fields should be matched</param>
/// <param name="fields">The fields for the comparisons</param> /// <param name="fields">The fields for the comparisons</param>
/// <returns>A <tt>WHERE</tt> clause implementing the comparisons for the given fields</returns> /// <returns>A <c>WHERE</c> clause implementing the comparisons for the given fields</returns>
[<CompiledName "WhereByFields">] [<CompiledName "WhereByFields">]
let whereByFields (howMatched: FieldMatch) fields = let whereByFields (howMatched: FieldMatch) fields =
let name = ParameterName() let name = ParameterName()
@ -182,9 +180,9 @@ module Query =
else $"{it.Path PostgreSQL AsSql} {it.Comparison.OpSql} {param}") else $"{it.Path PostgreSQL AsSql} {it.Comparison.OpSql} {param}")
|> String.concat $" {howMatched} " |> String.concat $" {howMatched} "
/// <summary>Create a <tt>WHERE</tt> clause fragment to implement an ID-based query</summary> /// <summary>Create a <c>WHERE</c> clause fragment to implement an ID-based query</summary>
/// <param name="docId">The ID of the document</param> /// <param name="docId">The ID of the document</param>
/// <returns>A <tt>WHERE</tt> clause fragment identifying a document by its ID</returns> /// <returns>A <c>WHERE</c> clause fragment identifying a document by its ID</returns>
[<CompiledName "WhereById">] [<CompiledName "WhereById">]
let whereById<'TKey> (docId: 'TKey) = let whereById<'TKey> (docId: 'TKey) =
whereByFields Any [ { Field.Equal (Configuration.idField ()) docId with ParameterName = Some "@id" } ] whereByFields Any [ { Field.Equal (Configuration.idField ()) docId with ParameterName = Some "@id" } ]
@ -209,32 +207,28 @@ module Query =
let tableName = name.Split '.' |> Array.last let tableName = name.Split '.' |> Array.last
$"CREATE INDEX IF NOT EXISTS idx_{tableName}_document ON {name} USING GIN (data{extraOps})" $"CREATE INDEX IF NOT EXISTS idx_{tableName}_document ON {name} USING GIN (data{extraOps})"
/// <summary> /// <summary>Create a <c>WHERE</c> clause fragment to implement a <c>@&gt;</c> (JSON contains) condition</summary>
/// Create a <tt>WHERE</tt> clause fragment to implement a <tt>@&gt;</tt> (JSON contains) condition
/// </summary>
/// <param name="paramName">The parameter name for the query</param> /// <param name="paramName">The parameter name for the query</param>
/// <returns>A <tt>WHERE</tt> clause fragment for the contains condition</returns> /// <returns>A <c>WHERE</c> clause fragment for the contains condition</returns>
[<CompiledName "WhereDataContains">] [<CompiledName "WhereDataContains">]
let whereDataContains paramName = let whereDataContains paramName =
$"data @> %s{paramName}" $"data @> %s{paramName}"
/// <summary> /// <summary>Create a <c>WHERE</c> clause fragment to implement a <c>@?</c> (JSON Path match) condition</summary>
/// Create a <tt>WHERE</tt> clause fragment to implement a <tt>@?</tt> (JSON Path match) condition
/// </summary>
/// <param name="paramName">The parameter name for the query</param> /// <param name="paramName">The parameter name for the query</param>
/// <returns>A <tt>WHERE</tt> clause fragment for the JSON Path match condition</returns> /// <returns>A <c>WHERE</c> clause fragment for the JSON Path match condition</returns>
[<CompiledName "WhereJsonPathMatches">] [<CompiledName "WhereJsonPathMatches">]
let whereJsonPathMatches paramName = let whereJsonPathMatches paramName =
$"data @? %s{paramName}::jsonpath" $"data @? %s{paramName}::jsonpath"
/// <summary>Create an <tt>UPDATE</tt> statement to patch documents</summary> /// <summary>Create an <c>UPDATE</c> statement to patch documents</summary>
/// <param name="tableName">The table to be updated</param> /// <param name="tableName">The table to be updated</param>
/// <returns>A query to patch documents</returns> /// <returns>A query to patch documents</returns>
[<CompiledName "Patch">] [<CompiledName "Patch">]
let patch tableName = let patch tableName =
$"UPDATE %s{tableName} SET data = data || @data" $"UPDATE %s{tableName} SET data = data || @data"
/// <summary>Create an <tt>UPDATE</tt> statement to remove fields from documents</summary> /// <summary>Create an <c>UPDATE</c> statement to remove fields from documents</summary>
/// <param name="tableName">The table to be updated</param> /// <param name="tableName">The table to be updated</param>
/// <returns>A query to remove fields from documents</returns> /// <returns>A query to remove fields from documents</returns>
[<CompiledName "RemoveFields">] [<CompiledName "RemoveFields">]
@ -292,14 +286,14 @@ module Results =
let fromData<'T> row : 'T = let fromData<'T> row : 'T =
fromDocument "data" row fromDocument "data" row
/// <summary>Extract a count from the column <tt>it</tt></summary> /// <summary>Extract a count from the column <c>it</c></summary>
/// <param name="row">A row reader set to the row with the count to retrieve</param> /// <param name="row">A row reader set to the row with the count to retrieve</param>
/// <returns>The count from the row</returns> /// <returns>The count from the row</returns>
[<CompiledName "ToCount">] [<CompiledName "ToCount">]
let toCount (row: RowReader) = let toCount (row: RowReader) =
row.int "it" row.int "it"
/// <summary>Extract a true/false value from the column <tt>it</tt></summary> /// <summary>Extract a true/false value from the column <c>it</c></summary>
/// <param name="row">A row reader set to the row with the true/false value to retrieve</param> /// <param name="row">A row reader set to the row with the true/false value to retrieve</param>
/// <returns>The true/false value from the row</returns> /// <returns>The true/false value from the row</returns>
[<CompiledName "ToExists">] [<CompiledName "ToExists">]

View File

@ -1,4 +1,4 @@
/// <summary>Versions of queries that accept <tt>SqlProps</tt> as the last parameter</summary> /// <summary>Versions of queries that accept <c>SqlProps</c> as the last parameter</summary>
module BitBadger.Documents.Postgres.WithProps module BitBadger.Documents.Postgres.WithProps
open System.IO open System.IO

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@ using static CommonExtensionsAndTypesForNpgsqlFSharp;
using static Runner; using static Runner;
/// <summary> /// <summary>
/// C# tests for the PostgreSQL implementation of <tt>BitBadger.Documents</tt> /// C# tests for the PostgreSQL implementation of <c>BitBadger.Documents</c>
/// </summary> /// </summary>
public static class PostgresCSharpTests public static class PostgresCSharpTests
{ {
@ -323,21 +323,21 @@ public static class PostgresCSharpTests
/// <summary> /// <summary>
/// Add the test documents to the database /// Add the test documents to the database
/// </summary> /// </summary>
internal static async Task LoadDocs() private static async Task LoadDocs()
{ {
foreach (var doc in JsonDocument.TestDocuments) await Document.Insert(SqliteDb.TableName, doc); foreach (var doc in JsonDocument.TestDocuments) await Document.Insert(SqliteDb.TableName, doc);
} }
/// <summary>Set up a stream writer for a test</summary> /// <summary>Set up a stream writer for a test</summary>
internal static StreamWriter WriteStream(Stream stream) private static StreamWriter WriteStream(Stream stream)
{ {
StreamWriter writer = new(stream); StreamWriter writer = new(stream);
writer.AutoFlush = true; writer.AutoFlush = true;
return writer; return writer;
} }
/// Get the text of the given stream /// <summary>Get the text of the given stream</summary>
internal static string StreamText(Stream stream) private static string StreamText(Stream stream)
{ {
stream.Position = 0L; stream.Position = 0L;
using StreamReader reader = new(stream); using StreamReader reader = new(stream);
@ -1298,20 +1298,20 @@ public static class PostgresCSharpTests
Expect.stringEnds(json, "]", "The array should have ended with `]`"); Expect.stringEnds(json, "]", "The array should have ended with `]`");
} }
/// Verify the presence of a document by its ID /// <summary>Verify the presence of a document by its ID</summary>
private static void VerifyDocById(string json, string docId) private static void VerifyDocById(string json, string docId)
{ {
Expect.stringContains(json, $"{{\"Id\": \"{docId}\",", $"Document `{docId}` not present"); Expect.stringContains(json, $"{{\"Id\": \"{docId}\",", $"Document `{docId}` not present");
} }
/// Verify the presence of a document by its ID /// <summary>Verify the presence of a document by its ID</summary>
private static void VerifySingleById(string json, string docId) private static void VerifySingleById(string json, string docId)
{ {
VerifyBeginEnd(json); VerifyBeginEnd(json);
Expect.stringContains(json, $"{{\"Id\": \"{docId}\",", $"Document `{docId}` not present"); Expect.stringContains(json, $"{{\"Id\": \"{docId}\",", $"Document `{docId}` not present");
} }
/// Verify the presence of any of the given document IDs in the given JSON /// <summary>Verify the presence of any of the given document IDs in the given JSON</summary>
private static void VerifyAnyById(string json, IEnumerable<string> docIds) private static void VerifyAnyById(string json, IEnumerable<string> docIds)
{ {
var theIds = docIds.ToList(); var theIds = docIds.ToList();
@ -1320,7 +1320,7 @@ public static class PostgresCSharpTests
Expect.isTrue(false, $"Could not find any of IDs {ids} in {json}"); Expect.isTrue(false, $"Could not find any of IDs {ids} in {json}");
} }
/// Verify the JSON for `all` returning data /// <summary>Verify the JSON for `all` returning data</summary>
private static void VerifyAllData(string json) private static void VerifyAllData(string json)
{ {
VerifyBeginEnd(json); VerifyBeginEnd(json);
@ -1328,19 +1328,19 @@ public static class PostgresCSharpTests
foreach (var docId in ids) VerifyDocById(json, docId); foreach (var docId in ids) VerifyDocById(json, docId);
} }
/// Verify an empty JSON array /// <summary>Verify an empty JSON array</summary>
private static void VerifyEmpty(string json) private static void VerifyEmpty(string json)
{ {
Expect.equal(json, "[]", "There should be no documents returned"); Expect.equal(json, "[]", "There should be no documents returned");
} }
/// Verify an empty JSON document /// <summary>Verify an empty JSON document</summary>
private static void VerifyNoDoc(string json) private static void VerifyNoDoc(string json)
{ {
Expect.equal(json, "{}", "There should be no document returned"); Expect.equal(json, "{}", "There should be no document returned");
} }
/// Verify the JSON for an ordered query /// <summary>Verify the JSON for an ordered query</summary>
private static void VerifyExpectedOrder(string json, string idFirst, string idSecond, string? idThird = null, private static void VerifyExpectedOrder(string json, string idFirst, string idSecond, string? idThird = null,
string? idFourth = null, string? idFifth = null) string? idFourth = null, string? idFifth = null)
{ {

File diff suppressed because it is too large Load Diff