v4.1 #11
@ -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>->> =</tt>, etc.)</summary>
|
/// <summary>Count matching documents using JSON field comparisons (<c>->> =</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>@></tt>)</summary>
|
/// <summary>Count matching documents using a JSON containment 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="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>->> =</tt>, etc.)</summary>
|
/// <summary>Determine if a document exists using JSON field comparisons (<c>->> =</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>@></tt>)</summary>
|
/// <summary>Determine if a document exists using a JSON containment 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="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>->> =</tt>, etc.)</summary>
|
/// <summary>Retrieve documents matching JSON field comparisons (<c>->> =</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>->> =</tt>, etc.) ordered by the given fields
|
/// Retrieve documents matching JSON field comparisons (<c>->> =</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>@></tt>)</summary>
|
/// <summary>Retrieve documents matching a JSON containment 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="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>@></tt>) ordered by the given fields in the
|
/// Retrieve documents matching a JSON containment 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>
|
||||||
@ -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>->> =</tt>, etc.)</summary>
|
/// <summary>Retrieve the first document matching JSON field comparisons (<c>->> =</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>->> =</tt>, etc.) ordered by the
|
/// Retrieve the first document matching JSON field comparisons (<c>->> =</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>@></tt>)</summary>
|
/// <summary>Retrieve the first document matching a JSON containment 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="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>@></tt>) ordered by the given fields
|
/// Retrieve the first document matching a JSON containment query (<c>@></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>->> =</tt>,
|
/// Patch documents using a JSON field comparison query in the <c>WHERE</c> clause (<c>->> =</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>@></tt>)
|
/// Patch documents using a JSON containment query in the <c>WHERE</c> clause (<c>@></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>@></tt>)</summary>
|
/// <summary>Remove fields from documents via a JSON containment 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="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>->> =</tt>, etc.)</summary>
|
/// <summary>Delete documents by matching a JSON field comparison query (<c>->> =</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>@></tt>)</summary>
|
/// <summary>Delete documents by matching a JSON contains query (<c>@></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>->> =</tt>, etc.)</summary>
|
/// <summary>Count matching documents using JSON field comparisons (<c>->> =</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>@></tt>)</summary>
|
/// <summary>Count matching documents using a JSON containment 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="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>->> =</tt>, etc.)</summary>
|
/// <summary>Determine if a document exists using JSON field comparisons (<c>->> =</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>@></tt>)</summary>
|
/// <summary>Determine if a document exists using a JSON containment 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="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>->> =</tt>, etc.)</summary>
|
/// <summary>Retrieve documents matching JSON field comparisons (<c>->> =</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>->> =</tt>, etc.) ordered by the given fields in
|
/// Retrieve documents matching JSON field comparisons (<c>->> =</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>@></tt>)</summary>
|
/// <summary>Retrieve documents matching a JSON containment 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="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>@></tt>) ordered by the given fields in the
|
/// Retrieve documents matching a JSON containment 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>
|
||||||
@ -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>->> =</tt>, etc.)</summary>
|
/// <summary>Retrieve the first document matching JSON field comparisons (<c>->> =</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>->> =</tt>, etc.) ordered by the given
|
/// Retrieve the first document matching JSON field comparisons (<c>->> =</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>@></tt>)</summary>
|
/// <summary>Retrieve the first document matching a JSON containment 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="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>@></tt>) ordered by the given fields in
|
/// Retrieve the first document matching a JSON containment query (<c>@></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>->> =</c>,
|
/// Write JSON documents to the given <c>StreamWriter</c> matching JSON field comparisons (<c>->> =</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>->> =</c>, etc.) ordered by the given
|
/// Retrieve JSON documents matching JSON field comparisons (<c>->> =</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>->> =</c>,
|
/// Write JSON documents to the given <c>StreamWriter</c> matching JSON field comparisons (<c>->> =</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>@></c>)
|
/// Write JSON documents to the given <c>StreamWriter</c> matching a JSON containment query (<c>@></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>->> =</c>, etc.)</summary>
|
||||||
/// Retrieve the first JSON document matching JSON field comparisons (<c>->> =</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>@></c>)
|
||||||
/// (<c>@></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>@></c>) ordered by the given
|
/// Retrieve the first JSON document matching a JSON containment query (<c>@></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>@></c>)
|
||||||
/// (<c>@></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>->> =</tt>, etc.)
|
/// Patch documents using a JSON field comparison query in the <c>WHERE</c> clause (<c>->> =</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>@></tt>)</summary>
|
/// <summary>Patch documents using a JSON containment 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="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>@></tt>)</summary>
|
/// <summary>Remove fields from documents via a JSON containment 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="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>->> =</tt>, etc.)</summary>
|
/// <summary>Delete documents by matching a JSON field comparison query (<c>->> =</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>@></tt>)</summary>
|
/// <summary>Delete documents by matching a JSON contains 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 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>
|
||||||
|
@ -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>->> =</tt>, etc.)</summary>
|
/// <summary>Count matching documents using JSON field comparisons (<c>->> =</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>@></tt>)</summary>
|
/// <summary>Count matching documents using a JSON containment 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="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>->> =</tt>, etc.)</summary>
|
/// <summary>Determine if a document exists using JSON field comparisons (<c>->> =</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>@></tt>)</summary>
|
/// <summary>Determine if a document exists using a JSON containment 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="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>->> =</tt>, etc.)</summary>
|
/// <summary>Retrieve documents matching JSON field comparisons (<c>->> =</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>->> =</tt>, etc.)</summary>
|
/// <summary>Retrieve documents matching JSON field comparisons (<c>->> =</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>->> =</tt>, etc.) ordered by the given fields in
|
/// Retrieve documents matching JSON field comparisons (<c>->> =</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>->> =</tt>, etc.) ordered by the given fields in
|
/// Retrieve documents matching JSON field comparisons (<c>->> =</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>@></tt>)</summary>
|
/// <summary>Retrieve documents matching a JSON containment 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="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>@></tt>)</summary>
|
/// <summary>Retrieve documents matching a JSON containment 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="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>@></tt>) ordered by the given fields in the
|
/// Retrieve documents matching a JSON containment 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="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>@></tt>) ordered by the given fields in the
|
/// Retrieve documents matching a JSON containment 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="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>->> =</tt>, etc.)</summary>
|
/// <summary>Retrieve the first document matching JSON field comparisons (<c>->> =</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>->> =</tt>, etc.)</summary>
|
/// <summary>Retrieve the first document matching JSON field comparisons (<c>->> =</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>->> =</tt>, etc.) ordered by the given
|
/// Retrieve the first document matching JSON field comparisons (<c>->> =</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>->> =</tt>, etc.) ordered by the given
|
/// Retrieve the first document matching JSON field comparisons (<c>->> =</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>@></tt>)</summary>
|
/// <summary>Retrieve the first document matching a JSON containment 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="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>@></tt>)</summary>
|
/// <summary>Retrieve the first document matching a JSON containment 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="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>@></tt>) ordered by the given fields in
|
/// Retrieve the first document matching a JSON containment 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="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>@></tt>) ordered by the given fields in
|
/// Retrieve the first document matching a JSON containment 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="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>->> =</tt>, etc.)
|
/// Patch documents using a JSON field comparison query in the <c>WHERE</c> clause (<c>->> =</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>@></tt>)</summary>
|
/// <summary>Patch documents using a JSON containment 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="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>@></tt>)</summary>
|
/// <summary>Remove fields from documents via a JSON containment 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="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>->> =</tt>, etc.)</summary>
|
/// <summary>Delete documents by matching a JSON field comparison query (<c>->> =</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>@></tt>)</summary>
|
/// <summary>Delete documents by matching a JSON contains query (<c>@></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">]
|
||||||
|
@ -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>@></tt>, <tt>@?</tt>, <tt>@@</tt> operators)
|
/// A <c>GIN</c> index with JSON Path operations (optimized for <c>@></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>@></c> (JSON contains) condition</summary>
|
||||||
/// Create a <tt>WHERE</tt> clause fragment to implement a <tt>@></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">]
|
||||||
|
@ -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
@ -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)
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
module PostgresExtensionTests
|
module PostgresExtensionTests
|
||||||
|
|
||||||
|
open System.IO
|
||||||
open BitBadger.Documents
|
open BitBadger.Documents
|
||||||
open BitBadger.Documents.Postgres
|
open BitBadger.Documents.Postgres
|
||||||
open BitBadger.Documents.Tests
|
open BitBadger.Documents.Tests
|
||||||
@ -13,6 +14,75 @@ let private mkConn (db: ThrowawayPostgresDb) =
|
|||||||
conn.Open()
|
conn.Open()
|
||||||
conn
|
conn
|
||||||
|
|
||||||
|
/// Set up a stream writer for a test
|
||||||
|
let private writeStream (stream: Stream) =
|
||||||
|
let writer = new StreamWriter(stream)
|
||||||
|
writer.AutoFlush <- true
|
||||||
|
writer
|
||||||
|
|
||||||
|
/// Get the text of the given stream
|
||||||
|
let private streamText (stream: Stream) =
|
||||||
|
stream.Position <- 0L
|
||||||
|
use reader = new StreamReader(stream)
|
||||||
|
reader.ReadToEnd()
|
||||||
|
|
||||||
|
/// Verify a JSON array begins with "[" and ends with "]"
|
||||||
|
let private verifyBeginEnd json =
|
||||||
|
Expect.stringStarts json "[" "The array should have started with `[`"
|
||||||
|
Expect.stringEnds json "]" "The array should have ended with `]`"
|
||||||
|
|
||||||
|
/// Verify the presence of a document by its ID
|
||||||
|
let private verifyDocById json docId =
|
||||||
|
Expect.stringContains json $"{{\"Id\": \"%s{docId}\"," $"Document `{docId}` not present"
|
||||||
|
|
||||||
|
/// Verify the presence of a document by its ID
|
||||||
|
let private verifySingleById json docId =
|
||||||
|
verifyBeginEnd json
|
||||||
|
Expect.stringContains json $"{{\"Id\": \"%s{docId}\"," $"Document `{docId}` not present"
|
||||||
|
|
||||||
|
/// Verify the presence of any of the given document IDs in the given JSON
|
||||||
|
let private verifyAnyById (json: string) (docIds: string list) =
|
||||||
|
match docIds |> List.tryFind (fun it -> json.Contains $"{{\"Id\": \"{it}\"") with
|
||||||
|
| Some _ -> ()
|
||||||
|
| None ->
|
||||||
|
let ids = docIds |> String.concat ", "
|
||||||
|
Expect.isTrue false $"Could not find any of IDs {ids} in {json}"
|
||||||
|
|
||||||
|
/// Verify the JSON for `all` returning data
|
||||||
|
let private verifyAllData json =
|
||||||
|
verifyBeginEnd json
|
||||||
|
[ "one"; "two"; "three"; "four"; "five" ] |> List.iter (verifyDocById json)
|
||||||
|
|
||||||
|
/// Verify an empty JSON array
|
||||||
|
let private verifyEmpty json =
|
||||||
|
Expect.equal json "[]" "There should be no documents returned"
|
||||||
|
|
||||||
|
/// Verify an empty JSON document
|
||||||
|
let private verifyNoDoc json =
|
||||||
|
Expect.equal json "{}" "There should be no document returned"
|
||||||
|
|
||||||
|
/// Verify the JSON for an ordered query
|
||||||
|
let private verifyExpectedOrder (json: string) idFirst idSecond idThird idFourth idFifth =
|
||||||
|
let firstIdx = json.IndexOf $"{{\"Id\": \"%s{idFirst}\","
|
||||||
|
let secondIdx = json.IndexOf $"{{\"Id\": \"%s{idSecond}\","
|
||||||
|
verifyBeginEnd json
|
||||||
|
Expect.isGreaterThan secondIdx firstIdx $"`{idSecond}` should have been after `{idFirst}`"
|
||||||
|
match idThird with
|
||||||
|
| Some id3 ->
|
||||||
|
let thirdIdx = json.IndexOf $"{{\"Id\": \"%s{id3}\","
|
||||||
|
Expect.isGreaterThan thirdIdx secondIdx $"`{id3}` should have been after `{idSecond}`"
|
||||||
|
match idFourth with
|
||||||
|
| Some id4 ->
|
||||||
|
let fourthIdx = json.IndexOf $"{{\"Id\": \"%s{id4}\","
|
||||||
|
Expect.isGreaterThan fourthIdx thirdIdx $"`{id4}` should have been after `{id3}`"
|
||||||
|
match idFifth with
|
||||||
|
| Some id5 ->
|
||||||
|
let fifthIdx = json.IndexOf $"{{\"Id\": \"%s{id5}\","
|
||||||
|
Expect.isGreaterThan fifthIdx fourthIdx $"`{id5}` should have been after `{id4}`"
|
||||||
|
| None -> ()
|
||||||
|
| None -> ()
|
||||||
|
| None -> ()
|
||||||
|
|
||||||
/// Integration tests for the F# extensions on the NpgsqlConnection data type
|
/// Integration tests for the F# extensions on the NpgsqlConnection data type
|
||||||
let integrationTests =
|
let integrationTests =
|
||||||
let loadDocs (conn: NpgsqlConnection) = backgroundTask {
|
let loadDocs (conn: NpgsqlConnection) = backgroundTask {
|
||||||
@ -41,6 +111,61 @@ let integrationTests =
|
|||||||
Expect.isEmpty docs "There should have been no documents returned"
|
Expect.isEmpty docs "There should have been no documents returned"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
testList "customJsonArray" [
|
||||||
|
testTask "succeeds when data is found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
let! docs = conn.customJsonArray (Query.find PostgresDb.TableName) [] jsonFromData
|
||||||
|
Expect.stringStarts docs "[" "The JSON array should have started with `[`"
|
||||||
|
Expect.hasLength ((string docs).Split "{\"Id\":") 6 "There should have been 5 documents returned"
|
||||||
|
Expect.stringEnds docs "]" "The JSON array should have ended with `[`"
|
||||||
|
}
|
||||||
|
testTask "succeeds when data is not found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
let! docs =
|
||||||
|
conn.customJsonArray
|
||||||
|
$"SELECT data FROM {PostgresDb.TableName} WHERE data @? @path::jsonpath"
|
||||||
|
[ "@path", Sql.string "$.NumValue ? (@ > 100)" ]
|
||||||
|
jsonFromData
|
||||||
|
Expect.equal docs "[]" "There should have been no documents returned"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "writeCustomJsonArray" [
|
||||||
|
testTask "succeeds when data is found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeCustomJsonArray (Query.find PostgresDb.TableName) [] writer jsonFromData
|
||||||
|
|
||||||
|
let docs = streamText stream
|
||||||
|
Expect.stringStarts docs "[" "The JSON array should have started with `[`"
|
||||||
|
Expect.hasLength (docs.Split "{\"Id\":") 6 "There should have been 5 documents returned"
|
||||||
|
Expect.stringEnds docs "]" "The JSON array should have ended with `[`"
|
||||||
|
}
|
||||||
|
testTask "succeeds when data is not found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeCustomJsonArray
|
||||||
|
$"SELECT data FROM {PostgresDb.TableName} WHERE data @? @path::jsonpath"
|
||||||
|
[ "@path", Sql.string "$.NumValue ? (@ > 100)" ]
|
||||||
|
writer
|
||||||
|
jsonFromData
|
||||||
|
|
||||||
|
Expect.equal (streamText stream) "[]" "There should have been no documents returned"
|
||||||
|
}
|
||||||
|
]
|
||||||
testList "customSingle" [
|
testList "customSingle" [
|
||||||
testTask "succeeds when a row is found" {
|
testTask "succeeds when a row is found" {
|
||||||
use db = PostgresDb.BuildDb()
|
use db = PostgresDb.BuildDb()
|
||||||
@ -68,6 +193,34 @@ let integrationTests =
|
|||||||
Expect.isNone doc "There should not have been a document returned"
|
Expect.isNone doc "There should not have been a document returned"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
testList "customJsonSingle" [
|
||||||
|
testTask "succeeds when a row is found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
let! doc =
|
||||||
|
conn.customJsonSingle
|
||||||
|
$"SELECT data FROM {PostgresDb.TableName} WHERE data ->> 'Id' = @id"
|
||||||
|
[ "@id", Sql.string "one"]
|
||||||
|
jsonFromData
|
||||||
|
Expect.stringStarts doc "{" "The document should have started with an open brace"
|
||||||
|
Expect.stringContains doc "\"Id\": \"one\"" "An incorrect document was returned"
|
||||||
|
Expect.stringEnds doc "}" "The document should have ended with a closing brace"
|
||||||
|
}
|
||||||
|
testTask "succeeds when a row is not found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
let! doc =
|
||||||
|
conn.customJsonSingle
|
||||||
|
$"SELECT data FROM {PostgresDb.TableName} WHERE data ->> 'Id' = @id"
|
||||||
|
[ "@id", Sql.string "eighty" ]
|
||||||
|
jsonFromData
|
||||||
|
Expect.equal doc "{}" "There should not have been a document returned"
|
||||||
|
}
|
||||||
|
]
|
||||||
testList "customNonQuery" [
|
testList "customNonQuery" [
|
||||||
testTask "succeeds when operating on data" {
|
testTask "succeeds when operating on data" {
|
||||||
use db = PostgresDb.BuildDb()
|
use db = PostgresDb.BuildDb()
|
||||||
@ -677,6 +830,769 @@ let integrationTests =
|
|||||||
Expect.equal "four" doc.Value.Id "An incorrect document was returned"
|
Expect.equal "four" doc.Value.Id "An incorrect document was returned"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
testList "jsonAll" [
|
||||||
|
testTask "succeeds when there is data" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
let! json = conn.jsonAll PostgresDb.TableName
|
||||||
|
verifyAllData json
|
||||||
|
}
|
||||||
|
testTask "succeeds when there is no data" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
let! json = conn.jsonAll PostgresDb.TableName
|
||||||
|
verifyEmpty json
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "jsonAllOrdered" [
|
||||||
|
testTask "succeeds when ordering numerically" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
let! json = conn.jsonAllOrdered PostgresDb.TableName [ Field.Named "n:NumValue" ]
|
||||||
|
verifyExpectedOrder json "one" "three" (Some "two") (Some "four") (Some "five")
|
||||||
|
}
|
||||||
|
testTask "succeeds when ordering numerically descending" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
let! json = conn.jsonAllOrdered PostgresDb.TableName [ Field.Named "n:NumValue DESC" ]
|
||||||
|
verifyExpectedOrder json "five" "four" (Some "two") (Some "three") (Some "one")
|
||||||
|
}
|
||||||
|
testTask "succeeds when ordering alphabetically" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
let! json = conn.jsonAllOrdered PostgresDb.TableName [ Field.Named "Id DESC" ]
|
||||||
|
verifyExpectedOrder json "two" "three" (Some "one") (Some "four") (Some "five")
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "jsonById" [
|
||||||
|
testTask "succeeds when a document is found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
let! json = conn.jsonById PostgresDb.TableName "two"
|
||||||
|
Expect.stringStarts json """{"Id": "two",""" "An incorrect document was returned"
|
||||||
|
Expect.stringEnds json "}" "JSON should have ended with this document"
|
||||||
|
}
|
||||||
|
testTask "succeeds when a document is not found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
let! json = conn.jsonById PostgresDb.TableName "three hundred eighty-seven"
|
||||||
|
verifyNoDoc json
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "jsonByFields" [
|
||||||
|
testTask "succeeds when documents are found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
let! json =
|
||||||
|
conn.jsonByFields
|
||||||
|
PostgresDb.TableName All [ Field.In "Value" [ "purple"; "blue" ]; Field.Exists "Sub" ]
|
||||||
|
verifySingleById json "four"
|
||||||
|
}
|
||||||
|
testTask "succeeds when documents are found using IN with numeric field" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
let! json = conn.jsonByFields PostgresDb.TableName All [ Field.In "NumValue" [ 2; 4; 6; 8 ] ]
|
||||||
|
verifySingleById json "three"
|
||||||
|
}
|
||||||
|
testTask "succeeds when documents are not found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
let! json =
|
||||||
|
conn.jsonByFields
|
||||||
|
PostgresDb.TableName All [ Field.Equal "Value" "mauve"; Field.NotEqual "NumValue" 40 ]
|
||||||
|
verifyEmpty json
|
||||||
|
}
|
||||||
|
testTask "succeeds for InArray when matching documents exist" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! conn.ensureTable PostgresDb.TableName
|
||||||
|
for doc in ArrayDocument.TestDocuments do do! conn.insert PostgresDb.TableName doc
|
||||||
|
|
||||||
|
let! json =
|
||||||
|
conn.jsonByFields PostgresDb.TableName All [ Field.InArray "Values" PostgresDb.TableName [ "c" ] ]
|
||||||
|
verifyBeginEnd json
|
||||||
|
verifyDocById json "first"
|
||||||
|
verifyDocById json "second"
|
||||||
|
}
|
||||||
|
testTask "succeeds for InArray when no matching documents exist" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! conn.ensureTable PostgresDb.TableName
|
||||||
|
for doc in ArrayDocument.TestDocuments do do! conn.insert PostgresDb.TableName doc
|
||||||
|
let! json =
|
||||||
|
conn.jsonByFields PostgresDb.TableName All [ Field.InArray "Values" PostgresDb.TableName [ "j" ] ]
|
||||||
|
verifyEmpty json
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "jsoByFieldsOrdered" [
|
||||||
|
testTask "succeeds when sorting ascending" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
let! json =
|
||||||
|
conn.jsonByFieldsOrdered
|
||||||
|
PostgresDb.TableName All [ Field.Equal "Value" "purple" ] [ Field.Named "Id" ]
|
||||||
|
verifyExpectedOrder json "five" "four" None None None
|
||||||
|
}
|
||||||
|
testTask "succeeds when sorting descending" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
let! json =
|
||||||
|
conn.jsonByFieldsOrdered
|
||||||
|
PostgresDb.TableName All [ Field.Equal "Value" "purple" ] [ Field.Named "Id DESC" ]
|
||||||
|
verifyExpectedOrder json "four" "five" None None None
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "jsonByContains" [
|
||||||
|
testTask "succeeds when documents are found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
let! json = conn.jsonByContains PostgresDb.TableName {| Sub = {| Foo = "green" |} |}
|
||||||
|
verifyBeginEnd json
|
||||||
|
verifyDocById json "two"
|
||||||
|
verifyDocById json "four"
|
||||||
|
}
|
||||||
|
testTask "succeeds when documents are not found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
let! json = conn.jsonByContains PostgresDb.TableName {| Value = "mauve" |}
|
||||||
|
verifyEmpty json
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "jsonByContainsOrdered" [
|
||||||
|
// Id = two, Sub.Bar = blue; Id = four, Sub.Bar = red
|
||||||
|
testTask "succeeds when sorting ascending" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
let! json =
|
||||||
|
conn.jsonByContainsOrdered
|
||||||
|
PostgresDb.TableName {| Sub = {| Foo = "green" |} |} [ Field.Named "Sub.Bar" ]
|
||||||
|
verifyExpectedOrder json "two" "four" None None None
|
||||||
|
}
|
||||||
|
testTask "succeeds when sorting descending" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
let! json =
|
||||||
|
conn.jsonByContainsOrdered
|
||||||
|
PostgresDb.TableName {| Sub = {| Foo = "green" |} |} [ Field.Named "Sub.Bar DESC" ]
|
||||||
|
verifyExpectedOrder json "four" "two" None None None
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "jsonByJsonPath" [
|
||||||
|
testTask "succeeds when documents are found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
let! json = conn.jsonByJsonPath PostgresDb.TableName "$.NumValue ? (@ < 15)"
|
||||||
|
verifyBeginEnd json
|
||||||
|
verifyDocById json "one"
|
||||||
|
verifyDocById json "two"
|
||||||
|
verifyDocById json "three"
|
||||||
|
}
|
||||||
|
testTask "succeeds when documents are not found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
let! json = conn.jsonByJsonPath PostgresDb.TableName "$.NumValue ? (@ < 0)"
|
||||||
|
verifyEmpty json
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "jsonByJsonPathOrdered" [
|
||||||
|
// Id = one, NumValue = 0; Id = two, NumValue = 10; Id = three, NumValue = 4
|
||||||
|
testTask "succeeds when sorting ascending" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
let! json =
|
||||||
|
conn.jsonByJsonPathOrdered PostgresDb.TableName "$.NumValue ? (@ < 15)" [ Field.Named "n:NumValue" ]
|
||||||
|
verifyExpectedOrder json "one" "three" (Some "two") None None
|
||||||
|
}
|
||||||
|
testTask "succeeds when sorting descending" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
let! json =
|
||||||
|
conn.jsonByJsonPathOrdered
|
||||||
|
PostgresDb.TableName "$.NumValue ? (@ < 15)" [ Field.Named "n:NumValue DESC" ]
|
||||||
|
verifyExpectedOrder json "two" "three" (Some "one") None None
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "jsonFirstByFields" [
|
||||||
|
testTask "succeeds when a document is found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
let! json = conn.jsonFirstByFields PostgresDb.TableName Any [ Field.Equal "Value" "another" ]
|
||||||
|
verifyDocById json "two"
|
||||||
|
}
|
||||||
|
testTask "succeeds when multiple documents are found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
let! json = conn.jsonFirstByFields PostgresDb.TableName Any [ Field.Equal "Value" "purple" ]
|
||||||
|
verifyAnyById json [ "five"; "four" ]
|
||||||
|
}
|
||||||
|
testTask "succeeds when a document is not found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
let! json = conn.jsonFirstByFields PostgresDb.TableName Any [ Field.Equal "Value" "absent" ]
|
||||||
|
verifyNoDoc json
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "jsonFirstByFieldsOrdered" [
|
||||||
|
testTask "succeeds when sorting ascending" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
let! json =
|
||||||
|
conn.jsonFirstByFieldsOrdered
|
||||||
|
PostgresDb.TableName Any [ Field.Equal "Value" "purple" ] [ Field.Named "Id" ]
|
||||||
|
verifyDocById json "five"
|
||||||
|
}
|
||||||
|
testTask "succeeds when sorting descending" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
let! json =
|
||||||
|
conn.jsonFirstByFieldsOrdered
|
||||||
|
PostgresDb.TableName Any [ Field.Equal "Value" "purple" ] [ Field.Named "Id DESC" ]
|
||||||
|
verifyDocById json "four"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "jsonFirstByContains" [
|
||||||
|
testTask "succeeds when a document is found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
let! json = conn.jsonFirstByContains PostgresDb.TableName {| Value = "another" |}
|
||||||
|
verifyDocById json "two"
|
||||||
|
}
|
||||||
|
testTask "succeeds when multiple documents are found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
let! json = conn.jsonFirstByContains PostgresDb.TableName {| Sub = {| Foo = "green" |} |}
|
||||||
|
verifyAnyById json [ "two"; "four" ]
|
||||||
|
}
|
||||||
|
testTask "succeeds when a document is not found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
let! json = conn.jsonFirstByContains PostgresDb.TableName {| Value = "absent" |}
|
||||||
|
verifyNoDoc json
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "jsonFirstByContainsOrdered" [
|
||||||
|
testTask "succeeds when sorting ascending" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
let! json =
|
||||||
|
conn.jsonFirstByContainsOrdered
|
||||||
|
PostgresDb.TableName {| Sub = {| Foo = "green" |} |} [ Field.Named "Value" ]
|
||||||
|
verifyDocById json "two"
|
||||||
|
}
|
||||||
|
testTask "succeeds when sorting descending" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
let! json =
|
||||||
|
conn.jsonFirstByContainsOrdered
|
||||||
|
PostgresDb.TableName {| Sub = {| Foo = "green" |} |} [ Field.Named "Value DESC" ]
|
||||||
|
verifyDocById json "four"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "jsonFirstByJsonPath" [
|
||||||
|
testTask "succeeds when a document is found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
let! json = conn.jsonFirstByJsonPath PostgresDb.TableName """$.Value ? (@ == "FIRST!")"""
|
||||||
|
verifyDocById json "one"
|
||||||
|
}
|
||||||
|
testTask "succeeds when multiple documents are found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
let! json = conn.jsonFirstByJsonPath PostgresDb.TableName """$.Sub.Foo ? (@ == "green")"""
|
||||||
|
verifyAnyById json [ "two"; "four" ]
|
||||||
|
}
|
||||||
|
testTask "succeeds when a document is not found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
let! json = conn.jsonFirstByJsonPath PostgresDb.TableName """$.Id ? (@ == "nope")"""
|
||||||
|
verifyNoDoc json
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "jsonFirstByJsonPathOrdered" [
|
||||||
|
testTask "succeeds when sorting ascending" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
let! json =
|
||||||
|
conn.jsonFirstByJsonPathOrdered
|
||||||
|
PostgresDb.TableName """$.Sub.Foo ? (@ == "green")""" [ Field.Named "Sub.Bar" ]
|
||||||
|
verifyDocById json "two"
|
||||||
|
}
|
||||||
|
testTask "succeeds when sorting descending" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
let! json =
|
||||||
|
conn.jsonFirstByJsonPathOrdered
|
||||||
|
PostgresDb.TableName """$.Sub.Foo ? (@ == "green")""" [ Field.Named "Sub.Bar DESC" ]
|
||||||
|
verifyDocById json "four"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "writeJsonAll" [
|
||||||
|
testTask "succeeds when there is data" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonAll PostgresDb.TableName writer
|
||||||
|
verifyAllData (streamText stream)
|
||||||
|
}
|
||||||
|
testTask "succeeds when there is no data" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonAll PostgresDb.TableName writer
|
||||||
|
verifyEmpty (streamText stream)
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "writeJsonAllOrdered" [
|
||||||
|
testTask "succeeds when ordering numerically" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonAllOrdered PostgresDb.TableName writer [ Field.Named "n:NumValue" ]
|
||||||
|
verifyExpectedOrder (streamText stream) "one" "three" (Some "two") (Some "four") (Some "five")
|
||||||
|
}
|
||||||
|
testTask "succeeds when ordering numerically descending" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonAllOrdered PostgresDb.TableName writer [ Field.Named "n:NumValue DESC" ]
|
||||||
|
verifyExpectedOrder (streamText stream) "five" "four" (Some "two") (Some "three") (Some "one")
|
||||||
|
}
|
||||||
|
testTask "succeeds when ordering alphabetically" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonAllOrdered PostgresDb.TableName writer [ Field.Named "Id DESC" ]
|
||||||
|
verifyExpectedOrder (streamText stream) "two" "three" (Some "one") (Some "four") (Some "five")
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "writeJsonById" [
|
||||||
|
testTask "succeeds when a document is found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonById PostgresDb.TableName writer "two"
|
||||||
|
let json = streamText stream
|
||||||
|
Expect.stringStarts json """{"Id": "two",""" "An incorrect document was returned"
|
||||||
|
Expect.stringEnds json "}" "JSON should have ended with this document"
|
||||||
|
}
|
||||||
|
testTask "succeeds when a document is not found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonById PostgresDb.TableName writer "three hundred eighty-seven"
|
||||||
|
verifyNoDoc (streamText stream)
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "writeJsonByFields" [
|
||||||
|
testTask "succeeds when documents are found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonByFields
|
||||||
|
PostgresDb.TableName writer All [ Field.In "Value" [ "purple"; "blue" ]; Field.Exists "Sub" ]
|
||||||
|
verifySingleById (streamText stream) "four"
|
||||||
|
}
|
||||||
|
testTask "succeeds when documents are found using IN with numeric field" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonByFields PostgresDb.TableName writer All [ Field.In "NumValue" [ 2; 4; 6; 8 ] ]
|
||||||
|
verifySingleById (streamText stream) "three"
|
||||||
|
}
|
||||||
|
testTask "succeeds when documents are not found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonByFields
|
||||||
|
PostgresDb.TableName writer All [ Field.Equal "Value" "mauve"; Field.NotEqual "NumValue" 40 ]
|
||||||
|
verifyEmpty (streamText stream)
|
||||||
|
}
|
||||||
|
testTask "succeeds for InArray when matching documents exist" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! conn.ensureTable PostgresDb.TableName
|
||||||
|
for doc in ArrayDocument.TestDocuments do do! conn.insert PostgresDb.TableName doc
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonByFields
|
||||||
|
PostgresDb.TableName writer All [ Field.InArray "Values" PostgresDb.TableName [ "c" ] ]
|
||||||
|
let json = streamText stream
|
||||||
|
verifyBeginEnd json
|
||||||
|
verifyDocById json "first"
|
||||||
|
verifyDocById json "second"
|
||||||
|
}
|
||||||
|
testTask "succeeds for InArray when no matching documents exist" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! conn.ensureTable PostgresDb.TableName
|
||||||
|
for doc in ArrayDocument.TestDocuments do do! conn.insert PostgresDb.TableName doc
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonByFields
|
||||||
|
PostgresDb.TableName writer All [ Field.InArray "Values" PostgresDb.TableName [ "j" ] ]
|
||||||
|
verifyEmpty (streamText stream)
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "writeJsonByFieldsOrdered" [
|
||||||
|
testTask "succeeds when sorting ascending" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonByFieldsOrdered
|
||||||
|
PostgresDb.TableName writer All [ Field.Equal "Value" "purple" ] [ Field.Named "Id" ]
|
||||||
|
verifyExpectedOrder (streamText stream) "five" "four" None None None
|
||||||
|
}
|
||||||
|
testTask "succeeds when sorting descending" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonByFieldsOrdered
|
||||||
|
PostgresDb.TableName writer All [ Field.Equal "Value" "purple" ] [ Field.Named "Id DESC" ]
|
||||||
|
verifyExpectedOrder (streamText stream) "four" "five" None None None
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "writeJsonByContains" [
|
||||||
|
testTask "succeeds when documents are found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonByContains PostgresDb.TableName writer {| Sub = {| Foo = "green" |} |}
|
||||||
|
let json = streamText stream
|
||||||
|
verifyBeginEnd json
|
||||||
|
verifyDocById json "two"
|
||||||
|
verifyDocById json "four"
|
||||||
|
}
|
||||||
|
testTask "succeeds when documents are not found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonByContains PostgresDb.TableName writer {| Value = "mauve" |}
|
||||||
|
verifyEmpty (streamText stream)
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "writeJsonByContainsOrdered" [
|
||||||
|
// Id = two, Sub.Bar = blue; Id = four, Sub.Bar = red
|
||||||
|
testTask "succeeds when sorting ascending" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonByContainsOrdered
|
||||||
|
PostgresDb.TableName writer {| Sub = {| Foo = "green" |} |} [ Field.Named "Sub.Bar" ]
|
||||||
|
verifyExpectedOrder (streamText stream) "two" "four" None None None
|
||||||
|
}
|
||||||
|
testTask "succeeds when sorting descending" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonByContainsOrdered
|
||||||
|
PostgresDb.TableName writer {| Sub = {| Foo = "green" |} |} [ Field.Named "Sub.Bar DESC" ]
|
||||||
|
verifyExpectedOrder (streamText stream) "four" "two" None None None
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "writeJsonByJsonPath" [
|
||||||
|
testTask "succeeds when documents are found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonByJsonPath PostgresDb.TableName writer "$.NumValue ? (@ < 15)"
|
||||||
|
let json = streamText stream
|
||||||
|
verifyBeginEnd json
|
||||||
|
verifyDocById json "one"
|
||||||
|
verifyDocById json "two"
|
||||||
|
verifyDocById json "three"
|
||||||
|
}
|
||||||
|
testTask "succeeds when documents are not found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonByJsonPath PostgresDb.TableName writer "$.NumValue ? (@ < 0)"
|
||||||
|
verifyEmpty (streamText stream)
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "writeJsonByJsonPathOrdered" [
|
||||||
|
// Id = one, NumValue = 0; Id = two, NumValue = 10; Id = three, NumValue = 4
|
||||||
|
testTask "succeeds when sorting ascending" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonByJsonPathOrdered
|
||||||
|
PostgresDb.TableName writer "$.NumValue ? (@ < 15)" [ Field.Named "n:NumValue" ]
|
||||||
|
verifyExpectedOrder (streamText stream) "one" "three" (Some "two") None None
|
||||||
|
}
|
||||||
|
testTask "succeeds when sorting descending" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonByJsonPathOrdered
|
||||||
|
PostgresDb.TableName writer "$.NumValue ? (@ < 15)" [ Field.Named "n:NumValue DESC" ]
|
||||||
|
verifyExpectedOrder (streamText stream) "two" "three" (Some "one") None None
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "writeJsonFirstByFields" [
|
||||||
|
testTask "succeeds when a document is found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonFirstByFields PostgresDb.TableName writer Any [ Field.Equal "Value" "another" ]
|
||||||
|
verifyDocById (streamText stream) "two"
|
||||||
|
}
|
||||||
|
testTask "succeeds when multiple documents are found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonFirstByFields PostgresDb.TableName writer Any [ Field.Equal "Value" "purple" ]
|
||||||
|
verifyAnyById (streamText stream) [ "five"; "four" ]
|
||||||
|
}
|
||||||
|
testTask "succeeds when a document is not found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonFirstByFields PostgresDb.TableName writer Any [ Field.Equal "Value" "absent" ]
|
||||||
|
verifyNoDoc (streamText stream)
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "writeJsonFirstByFieldsOrdered" [
|
||||||
|
testTask "succeeds when sorting ascending" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonFirstByFieldsOrdered
|
||||||
|
PostgresDb.TableName writer Any [ Field.Equal "Value" "purple" ] [ Field.Named "Id" ]
|
||||||
|
verifyDocById (streamText stream) "five"
|
||||||
|
}
|
||||||
|
testTask "succeeds when sorting descending" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonFirstByFieldsOrdered
|
||||||
|
PostgresDb.TableName writer Any [ Field.Equal "Value" "purple" ] [ Field.Named "Id DESC" ]
|
||||||
|
verifyDocById (streamText stream) "four"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "writeJsonFirstByContains" [
|
||||||
|
testTask "succeeds when a document is found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonFirstByContains PostgresDb.TableName writer {| Value = "another" |}
|
||||||
|
verifyDocById (streamText stream) "two"
|
||||||
|
}
|
||||||
|
testTask "succeeds when multiple documents are found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonFirstByContains PostgresDb.TableName writer {| Sub = {| Foo = "green" |} |}
|
||||||
|
verifyAnyById (streamText stream) [ "two"; "four" ]
|
||||||
|
}
|
||||||
|
testTask "succeeds when a document is not found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonFirstByContains PostgresDb.TableName writer {| Value = "absent" |}
|
||||||
|
verifyNoDoc (streamText stream)
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "writeJsonFirstByContainsOrdered" [
|
||||||
|
testTask "succeeds when sorting ascending" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonFirstByContainsOrdered
|
||||||
|
PostgresDb.TableName writer {| Sub = {| Foo = "green" |} |} [ Field.Named "Value" ]
|
||||||
|
verifyDocById (streamText stream) "two"
|
||||||
|
}
|
||||||
|
testTask "succeeds when sorting descending" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonFirstByContainsOrdered
|
||||||
|
PostgresDb.TableName writer {| Sub = {| Foo = "green" |} |} [ Field.Named "Value DESC" ]
|
||||||
|
verifyDocById (streamText stream) "four"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "writeJsonFirstByJsonPath" [
|
||||||
|
testTask "succeeds when a document is found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonFirstByJsonPath PostgresDb.TableName writer """$.Value ? (@ == "FIRST!")"""
|
||||||
|
verifyDocById (streamText stream) "one"
|
||||||
|
}
|
||||||
|
testTask "succeeds when multiple documents are found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonFirstByJsonPath PostgresDb.TableName writer """$.Sub.Foo ? (@ == "green")"""
|
||||||
|
verifyAnyById (streamText stream) [ "two"; "four" ]
|
||||||
|
}
|
||||||
|
testTask "succeeds when a document is not found" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonFirstByJsonPath PostgresDb.TableName writer """$.Id ? (@ == "nope")"""
|
||||||
|
verifyNoDoc (streamText stream)
|
||||||
|
}
|
||||||
|
]
|
||||||
|
testList "writeJsonFirstByJsonPathOrdered" [
|
||||||
|
testTask "succeeds when sorting ascending" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonFirstByJsonPathOrdered
|
||||||
|
PostgresDb.TableName writer """$.Sub.Foo ? (@ == "green")""" [ Field.Named "Sub.Bar" ]
|
||||||
|
verifyDocById (streamText stream) "two"
|
||||||
|
}
|
||||||
|
testTask "succeeds when sorting descending" {
|
||||||
|
use db = PostgresDb.BuildDb()
|
||||||
|
use conn = mkConn db
|
||||||
|
do! loadDocs conn
|
||||||
|
|
||||||
|
use stream = new MemoryStream()
|
||||||
|
use writer = writeStream stream
|
||||||
|
do! conn.writeJsonFirstByJsonPathOrdered
|
||||||
|
PostgresDb.TableName writer """$.Sub.Foo ? (@ == "green")""" [ Field.Named "Sub.Bar DESC" ]
|
||||||
|
verifyDocById (streamText stream) "four"
|
||||||
|
}
|
||||||
|
]
|
||||||
testList "updateById" [
|
testList "updateById" [
|
||||||
testTask "succeeds when a document is updated" {
|
testTask "succeeds when a document is updated" {
|
||||||
use db = PostgresDb.BuildDb()
|
use db = PostgresDb.BuildDb()
|
||||||
@ -707,7 +1623,7 @@ let integrationTests =
|
|||||||
do! loadDocs conn
|
do! loadDocs conn
|
||||||
|
|
||||||
do! conn.updateByFunc
|
do! conn.updateByFunc
|
||||||
PostgresDb.TableName (_.Id) { Id = "one"; Value = "le un"; NumValue = 1; Sub = None }
|
PostgresDb.TableName _.Id { Id = "one"; Value = "le un"; NumValue = 1; Sub = None }
|
||||||
let! after = conn.findById<string, JsonDocument> PostgresDb.TableName "one"
|
let! after = conn.findById<string, JsonDocument> PostgresDb.TableName "one"
|
||||||
Expect.isSome after "There should have been a document returned post-update"
|
Expect.isSome after "There should have been a document returned post-update"
|
||||||
Expect.equal
|
Expect.equal
|
||||||
@ -723,7 +1639,7 @@ let integrationTests =
|
|||||||
|
|
||||||
// This not raising an exception is the test
|
// This not raising an exception is the test
|
||||||
do! conn.updateByFunc
|
do! conn.updateByFunc
|
||||||
PostgresDb.TableName (_.Id) { Id = "one"; Value = "le un"; NumValue = 1; Sub = None }
|
PostgresDb.TableName _.Id { Id = "one"; Value = "le un"; NumValue = 1; Sub = None }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
testList "patchById" [
|
testList "patchById" [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user