WIP on docs; add F# PG ext docs
This commit is contained in:
parent
76df8a1ff6
commit
5f3f84d607
@ -2,6 +2,7 @@ namespace BitBadger.Documents.Postgres
|
|||||||
|
|
||||||
open Npgsql
|
open Npgsql
|
||||||
open Npgsql.FSharp
|
open Npgsql.FSharp
|
||||||
|
open WithProps
|
||||||
|
|
||||||
/// F# Extensions for the NpgsqlConnection type
|
/// F# Extensions for the NpgsqlConnection type
|
||||||
[<AutoOpen>]
|
[<AutoOpen>]
|
||||||
@ -9,194 +10,369 @@ module Extensions =
|
|||||||
|
|
||||||
type NpgsqlConnection with
|
type NpgsqlConnection with
|
||||||
|
|
||||||
/// Execute a query that returns a list of results
|
/// <summary>Execute a query that returns a list of results</summary>
|
||||||
|
/// <param name="query">The query to retrieve the results</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>
|
||||||
|
/// <returns>A list of results for the given query</returns>
|
||||||
member conn.customList<'TDoc> query parameters (mapFunc: RowReader -> 'TDoc) =
|
member conn.customList<'TDoc> query parameters (mapFunc: RowReader -> 'TDoc) =
|
||||||
WithProps.Custom.list<'TDoc> query parameters mapFunc (Sql.existingConnection conn)
|
Custom.list<'TDoc> query parameters mapFunc (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Execute a query that returns one or no results; returns None if not found
|
/// <summary>Execute a query that returns one or no results</summary>
|
||||||
|
/// <param name="query">The query to retrieve the results</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>
|
||||||
|
/// <returns><tt>Some</tt> with the first matching result, or <tt>None</tt> if not found</returns>
|
||||||
member conn.customSingle<'TDoc> query parameters (mapFunc: RowReader -> 'TDoc) =
|
member conn.customSingle<'TDoc> query parameters (mapFunc: RowReader -> 'TDoc) =
|
||||||
WithProps.Custom.single<'TDoc> query parameters mapFunc (Sql.existingConnection conn)
|
Custom.single<'TDoc> query parameters mapFunc (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Execute a query that returns no results
|
/// <summary>Execute a query that returns no results</summary>
|
||||||
|
/// <param name="query">The query to retrieve the results</param>
|
||||||
|
/// <param name="parameters">Parameters to use for the query</param>
|
||||||
member conn.customNonQuery query parameters =
|
member conn.customNonQuery query parameters =
|
||||||
WithProps.Custom.nonQuery query parameters (Sql.existingConnection conn)
|
Custom.nonQuery query parameters (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Execute a query that returns a scalar value
|
/// <summary>Execute a query that returns a scalar value</summary>
|
||||||
|
/// <param name="query">The query to retrieve the value</param>
|
||||||
|
/// <param name="parameters">Parameters to use for the query</param>
|
||||||
|
/// <param name="mapFunc">The mapping function to obtain the value</param>
|
||||||
|
/// <returns>The scalar value for the query</returns>
|
||||||
member conn.customScalar<'T when 'T: struct> query parameters (mapFunc: RowReader -> 'T) =
|
member conn.customScalar<'T when 'T: struct> query parameters (mapFunc: RowReader -> 'T) =
|
||||||
WithProps.Custom.scalar query parameters mapFunc (Sql.existingConnection conn)
|
Custom.scalar query parameters mapFunc (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Create a document table
|
/// <summary>Create a document table</summary>
|
||||||
|
/// <param name="name">The table whose existence should be ensured (may include schema)</param>
|
||||||
member conn.ensureTable name =
|
member conn.ensureTable name =
|
||||||
WithProps.Definition.ensureTable name (Sql.existingConnection conn)
|
Definition.ensureTable name (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Create an index on documents in the specified table
|
/// <summary>Create an index on documents in the specified table</summary>
|
||||||
|
/// <param name="name">The table to be indexed (may include schema)</param>
|
||||||
|
/// <param name="idxType">The type of document index to create</param>
|
||||||
member conn.ensureDocumentIndex name idxType =
|
member conn.ensureDocumentIndex name idxType =
|
||||||
WithProps.Definition.ensureDocumentIndex name idxType (Sql.existingConnection conn)
|
Definition.ensureDocumentIndex name idxType (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Create an index on field(s) within documents in the specified table
|
/// <summary>Create an index on field(s) within documents in the specified table</summary>
|
||||||
|
/// <param name="tableName">The table to be indexed (may include schema)</param>
|
||||||
|
/// <param name="indexName">The name of the index to create</param>
|
||||||
|
/// <param name="fields">One or more fields to be indexed</param>
|
||||||
member conn.ensureFieldIndex tableName indexName fields =
|
member conn.ensureFieldIndex tableName indexName fields =
|
||||||
WithProps.Definition.ensureFieldIndex tableName indexName fields (Sql.existingConnection conn)
|
Definition.ensureFieldIndex tableName indexName fields (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Insert a new document
|
/// <summary>Insert a new document</summary>
|
||||||
|
/// <param name="tableName">The table into which the document should be inserted (may include schema)</param>
|
||||||
|
/// <param name="document">The document to be inserted</param>
|
||||||
member conn.insert<'TDoc> tableName (document: 'TDoc) =
|
member conn.insert<'TDoc> tableName (document: 'TDoc) =
|
||||||
WithProps.Document.insert<'TDoc> tableName document (Sql.existingConnection conn)
|
insert<'TDoc> tableName document (Sql.existingConnection conn)
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
/// Save a document, inserting it if it does not exist and updating it if it does (AKA "upsert")
|
/// Save a document, inserting it if it does not exist and updating it if it does (AKA "upsert")
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tableName">The table into which the document should be saved (may include schema)</param>
|
||||||
|
/// <param name="document">The document to be saved</param>
|
||||||
member conn.save<'TDoc> tableName (document: 'TDoc) =
|
member conn.save<'TDoc> tableName (document: 'TDoc) =
|
||||||
WithProps.Document.save<'TDoc> tableName document (Sql.existingConnection conn)
|
save<'TDoc> tableName document (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Count all documents in a table
|
/// <summary>Count all documents in a table</summary>
|
||||||
|
/// <param name="tableName">The table in which documents should be counted (may include schema)</param>
|
||||||
|
/// <returns>The count of the documents in the table</returns>
|
||||||
member conn.countAll tableName =
|
member conn.countAll tableName =
|
||||||
WithProps.Count.all tableName (Sql.existingConnection conn)
|
Count.all tableName (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Count matching documents using a JSON field comparison query (->> =)
|
/// <summary>Count matching documents using JSON field comparisons (<tt>->> =</tt>, etc.)</summary>
|
||||||
|
/// <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="fields">The field conditions to match</param>
|
||||||
|
/// <returns>The count of matching documents in the table</returns>
|
||||||
member conn.countByFields tableName howMatched fields =
|
member conn.countByFields tableName howMatched fields =
|
||||||
WithProps.Count.byFields tableName howMatched fields (Sql.existingConnection conn)
|
Count.byFields tableName howMatched fields (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Count matching documents using a JSON containment query (@>)
|
/// <summary>Count matching documents using a JSON containment query (<tt>@></tt>)</summary>
|
||||||
|
/// <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>
|
||||||
|
/// <returns>The count of the documents in the table</returns>
|
||||||
member conn.countByContains tableName criteria =
|
member conn.countByContains tableName criteria =
|
||||||
WithProps.Count.byContains tableName criteria (Sql.existingConnection conn)
|
Count.byContains tableName criteria (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Count matching documents using a JSON Path match query (@?)
|
/// <summary>Count matching documents using a JSON Path match query (<tt>@?</tt>)</summary>
|
||||||
|
/// <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>
|
||||||
|
/// <returns>The count of the documents in the table</returns>
|
||||||
member conn.countByJsonPath tableName jsonPath =
|
member conn.countByJsonPath tableName jsonPath =
|
||||||
WithProps.Count.byJsonPath tableName jsonPath (Sql.existingConnection conn)
|
Count.byJsonPath tableName jsonPath (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Determine if a document exists for the given ID
|
/// <summary>Determine if a document exists for the given ID</summary>
|
||||||
|
/// <param name="tableName">The table in which existence should be checked (may include schema)</param>
|
||||||
|
/// <param name="docId">The ID of the document whose existence should be checked</param>
|
||||||
|
/// <returns>True if a document exists, false if not</returns>
|
||||||
member conn.existsById tableName docId =
|
member conn.existsById tableName docId =
|
||||||
WithProps.Exists.byId tableName docId (Sql.existingConnection conn)
|
Exists.byId tableName docId (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Determine if documents exist using a JSON field comparison query (->> =)
|
/// <summary>Determine if a document exists using JSON field comparisons (<tt>->> =</tt>, etc.)</summary>
|
||||||
|
/// <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="fields">The field conditions to match</param>
|
||||||
|
/// <returns>True if any matching documents exist, false if not</returns>
|
||||||
member conn.existsByFields tableName howMatched fields =
|
member conn.existsByFields tableName howMatched fields =
|
||||||
WithProps.Exists.byFields tableName howMatched fields (Sql.existingConnection conn)
|
Exists.byFields tableName howMatched fields (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Determine if documents exist using a JSON containment query (@>)
|
/// <summary>Determine if a document exists using a JSON containment query (<tt>@></tt>)</summary>
|
||||||
|
/// <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>
|
||||||
|
/// <returns>True if any matching documents exist, false if not</returns>
|
||||||
member conn.existsByContains tableName criteria =
|
member conn.existsByContains tableName criteria =
|
||||||
WithProps.Exists.byContains tableName criteria (Sql.existingConnection conn)
|
Exists.byContains tableName criteria (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Determine if documents exist using a JSON Path match query (@?)
|
/// <summary>Determine if a document exists using a JSON Path match query (<tt>@?</tt>)</summary>
|
||||||
|
/// <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>
|
||||||
|
/// <returns>True if any matching documents exist, false if not</returns>
|
||||||
member conn.existsByJsonPath tableName jsonPath =
|
member conn.existsByJsonPath tableName jsonPath =
|
||||||
WithProps.Exists.byJsonPath tableName jsonPath (Sql.existingConnection conn)
|
Exists.byJsonPath tableName jsonPath (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Retrieve all documents in the given table
|
/// <summary>Retrieve all documents in the given table</summary>
|
||||||
|
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
|
||||||
|
/// <returns>All documents from the given table</returns>
|
||||||
member conn.findAll<'TDoc> tableName =
|
member conn.findAll<'TDoc> tableName =
|
||||||
WithProps.Find.all<'TDoc> tableName (Sql.existingConnection conn)
|
Find.all<'TDoc> tableName (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Retrieve all documents in the given table ordered by the given fields in the document
|
/// <summary>Retrieve all documents in the given table ordered by the given fields in the document</summary>
|
||||||
|
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
|
||||||
|
/// <param name="orderFields">Fields by which the results should be ordered</param>
|
||||||
|
/// <returns>All documents from the given table, ordered by the given fields</returns>
|
||||||
member conn.findAllOrdered<'TDoc> tableName orderFields =
|
member conn.findAllOrdered<'TDoc> tableName orderFields =
|
||||||
WithProps.Find.allOrdered<'TDoc> tableName orderFields (Sql.existingConnection conn)
|
Find.allOrdered<'TDoc> tableName orderFields (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Retrieve a document by its ID; returns None if not found
|
/// <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="docId">The ID of the document to retrieve</param>
|
||||||
|
/// <returns><tt>Some</tt> with the document if found, <tt>None</tt> otherwise</returns>
|
||||||
member conn.findById<'TKey, 'TDoc> tableName docId =
|
member conn.findById<'TKey, 'TDoc> tableName docId =
|
||||||
WithProps.Find.byId<'TKey, 'TDoc> tableName docId (Sql.existingConnection conn)
|
Find.byId<'TKey, 'TDoc> tableName docId (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Retrieve documents matching a JSON field comparison query (->> =)
|
/// <summary>Retrieve documents matching JSON field comparisons (<tt>->> =</tt>, etc.)</summary>
|
||||||
|
/// <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="fields">The field conditions to match</param>
|
||||||
|
/// <returns>All documents matching the given fields</returns>
|
||||||
member conn.findByFields<'TDoc> tableName howMatched fields =
|
member conn.findByFields<'TDoc> tableName howMatched fields =
|
||||||
WithProps.Find.byFields<'TDoc> tableName howMatched fields (Sql.existingConnection conn)
|
Find.byFields<'TDoc> tableName howMatched fields (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Retrieve documents matching a JSON field comparison query (->> =) ordered by the given fields in the
|
/// <summary>
|
||||||
/// document
|
/// Retrieve documents matching JSON field comparisons (<tt>->> =</tt>, etc.) ordered by the given fields
|
||||||
|
/// in the document
|
||||||
|
/// </summary>
|
||||||
|
/// <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="queryFields">The field conditions to match</param>
|
||||||
|
/// <param name="orderFields">Fields by which the results should be ordered</param>
|
||||||
|
/// <returns>All documents matching the given fields, ordered by the other given fields</returns>
|
||||||
member conn.findByFieldsOrdered<'TDoc> tableName howMatched queryFields orderFields =
|
member conn.findByFieldsOrdered<'TDoc> tableName howMatched queryFields orderFields =
|
||||||
WithProps.Find.byFieldsOrdered<'TDoc>
|
Find.byFieldsOrdered<'TDoc>
|
||||||
tableName howMatched queryFields orderFields (Sql.existingConnection conn)
|
tableName howMatched queryFields orderFields (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Retrieve documents matching a JSON containment query (@>)
|
/// <summary>Retrieve documents matching a JSON containment query (<tt>@></tt>)</summary>
|
||||||
|
/// <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>
|
||||||
|
/// <returns>All documents matching the given containment query</returns>
|
||||||
member conn.findByContains<'TDoc> tableName (criteria: obj) =
|
member conn.findByContains<'TDoc> tableName (criteria: obj) =
|
||||||
WithProps.Find.byContains<'TDoc> tableName criteria (Sql.existingConnection conn)
|
Find.byContains<'TDoc> tableName criteria (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Retrieve documents matching a JSON containment query (@>) ordered by the given fields in the document
|
/// <summary>
|
||||||
|
/// Retrieve documents matching a JSON containment query (<tt>@></tt>) ordered by the given fields in the
|
||||||
|
/// document
|
||||||
|
/// </summary>
|
||||||
|
/// <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="orderFields">Fields by which the results should be ordered</param>
|
||||||
|
/// <returns>All documents matching the given containment query, ordered by the given fields</returns>
|
||||||
member conn.findByContainsOrdered<'TDoc> tableName (criteria: obj) orderFields =
|
member conn.findByContainsOrdered<'TDoc> tableName (criteria: obj) orderFields =
|
||||||
WithProps.Find.byContainsOrdered<'TDoc> tableName criteria orderFields (Sql.existingConnection conn)
|
Find.byContainsOrdered<'TDoc> tableName criteria orderFields (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Retrieve documents matching a JSON Path match query (@?)
|
/// <summary>Retrieve documents matching a JSON Path match query (<tt>@?</tt>)</summary>
|
||||||
|
/// <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>
|
||||||
|
/// <returns>All documents matching the given JSON Path expression</returns>
|
||||||
member conn.findByJsonPath<'TDoc> tableName jsonPath =
|
member conn.findByJsonPath<'TDoc> tableName jsonPath =
|
||||||
WithProps.Find.byJsonPath<'TDoc> tableName jsonPath (Sql.existingConnection conn)
|
Find.byJsonPath<'TDoc> tableName jsonPath (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Retrieve documents matching a JSON Path match query (@?) ordered by the given fields in the document
|
/// <summary>
|
||||||
|
/// Retrieve documents matching a JSON Path match query (<tt>@?</tt>) ordered by the given fields in the
|
||||||
|
/// document
|
||||||
|
/// </summary>
|
||||||
|
/// <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="orderFields">Fields by which the results should be ordered</param>
|
||||||
|
/// <returns>All documents matching the given JSON Path expression, ordered by the given fields</returns>
|
||||||
member conn.findByJsonPathOrdered<'TDoc> tableName jsonPath orderFields =
|
member conn.findByJsonPathOrdered<'TDoc> tableName jsonPath orderFields =
|
||||||
WithProps.Find.byJsonPathOrdered<'TDoc> tableName jsonPath orderFields (Sql.existingConnection conn)
|
Find.byJsonPathOrdered<'TDoc> tableName jsonPath orderFields (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Retrieve the first document matching a JSON field comparison query (->> =); returns None if not found
|
/// <summary>Retrieve the first document matching JSON field comparisons (<tt>->> =</tt>, etc.)</summary>
|
||||||
|
/// <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="fields">The field conditions to match</param>
|
||||||
|
/// <returns><tt>Some</tt> with the first document, or <tt>None</tt> if not found</returns>
|
||||||
member conn.findFirstByFields<'TDoc> tableName howMatched fields =
|
member conn.findFirstByFields<'TDoc> tableName howMatched fields =
|
||||||
WithProps.Find.firstByFields<'TDoc> tableName howMatched fields (Sql.existingConnection conn)
|
Find.firstByFields<'TDoc> tableName howMatched fields (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Retrieve the first document matching a JSON field comparison query (->> =) ordered by the given fields in
|
/// <summary>
|
||||||
/// the document; returns None if not found
|
/// Retrieve the first document matching JSON field comparisons (<tt>->> =</tt>, etc.) ordered by the
|
||||||
|
/// given fields in the document
|
||||||
|
/// </summary>
|
||||||
|
/// <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="queryFields">The field conditions to match</param>
|
||||||
|
/// <param name="orderFields">Fields by which the results should be ordered</param>
|
||||||
|
/// <returns>
|
||||||
|
/// <tt>Some</tt> with the first document ordered by the given fields, or <tt>None</tt> if not found
|
||||||
|
/// </returns>
|
||||||
member conn.findFirstByFieldsOrdered<'TDoc> tableName howMatched queryFields orderFields =
|
member conn.findFirstByFieldsOrdered<'TDoc> tableName howMatched queryFields orderFields =
|
||||||
WithProps.Find.firstByFieldsOrdered<'TDoc>
|
Find.firstByFieldsOrdered<'TDoc>
|
||||||
tableName howMatched queryFields orderFields (Sql.existingConnection conn)
|
tableName howMatched queryFields orderFields (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Retrieve the first document matching a JSON containment query (@>); returns None if not found
|
/// <summary>Retrieve the first document matching a JSON containment query (<tt>@></tt>)</summary>
|
||||||
|
/// <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>
|
||||||
|
/// <returns><tt>Some</tt> with the first document, or <tt>None</tt> if not found</returns>
|
||||||
member conn.findFirstByContains<'TDoc> tableName (criteria: obj) =
|
member conn.findFirstByContains<'TDoc> tableName (criteria: obj) =
|
||||||
WithProps.Find.firstByContains<'TDoc> tableName criteria (Sql.existingConnection conn)
|
Find.firstByContains<'TDoc> tableName criteria (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Retrieve the first document matching a JSON containment query (@>) ordered by the given fields in the
|
/// <summary>
|
||||||
/// document; returns None if not found
|
/// Retrieve the first document matching a JSON containment query (<tt>@></tt>) ordered by the given fields
|
||||||
|
/// in the document
|
||||||
|
/// </summary>
|
||||||
|
/// <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="orderFields">Fields by which the results should be ordered</param>
|
||||||
|
/// <returns>
|
||||||
|
/// <tt>Some</tt> with the first document ordered by the given fields, or <tt>None</tt> if not found
|
||||||
|
/// </returns>
|
||||||
member conn.findFirstByContainsOrdered<'TDoc> tableName (criteria: obj) orderFields =
|
member conn.findFirstByContainsOrdered<'TDoc> tableName (criteria: obj) orderFields =
|
||||||
WithProps.Find.firstByContainsOrdered<'TDoc> tableName criteria orderFields (Sql.existingConnection conn)
|
Find.firstByContainsOrdered<'TDoc> tableName criteria orderFields (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Retrieve the first document matching a JSON Path match query (@?); returns None if not found
|
/// <summary>Retrieve the first document matching a JSON Path match query (<tt>@?</tt>)</summary>
|
||||||
|
/// <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>
|
||||||
|
/// <returns><tt>Some</tt> with the first document, or <tt>None</tt> if not found</returns>
|
||||||
member conn.findFirstByJsonPath<'TDoc> tableName jsonPath =
|
member conn.findFirstByJsonPath<'TDoc> tableName jsonPath =
|
||||||
WithProps.Find.firstByJsonPath<'TDoc> tableName jsonPath (Sql.existingConnection conn)
|
Find.firstByJsonPath<'TDoc> tableName jsonPath (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Retrieve the first document matching a JSON Path match query (@?) ordered by the given fields in the
|
/// <summary>
|
||||||
/// document; returns None if not found
|
/// Retrieve the first document matching a JSON Path match query (<tt>@?</tt>) ordered by the given fields in
|
||||||
|
/// the document
|
||||||
|
/// </summary>
|
||||||
|
/// <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="orderFields">Fields by which the results should be ordered</param>
|
||||||
|
/// <returns>
|
||||||
|
/// <tt>Some</tt> with the first document ordered by the given fields, or <tt>None</tt> if not found
|
||||||
|
/// </returns>
|
||||||
member conn.findFirstByJsonPathOrdered<'TDoc> tableName jsonPath orderFields =
|
member conn.findFirstByJsonPathOrdered<'TDoc> tableName jsonPath orderFields =
|
||||||
WithProps.Find.firstByJsonPathOrdered<'TDoc> tableName jsonPath orderFields (Sql.existingConnection conn)
|
Find.firstByJsonPathOrdered<'TDoc> tableName jsonPath orderFields (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Update an entire document by its ID
|
/// <summary>Update (replace) an entire document by its ID</summary>
|
||||||
|
/// <param name="tableName">The table in which a document should be updated (may include schema)</param>
|
||||||
|
/// <param name="docId">The ID of the document to be updated (replaced)</param>
|
||||||
|
/// <param name="document">The new document</param>
|
||||||
member conn.updateById tableName (docId: 'TKey) (document: 'TDoc) =
|
member conn.updateById tableName (docId: 'TKey) (document: 'TDoc) =
|
||||||
WithProps.Update.byId tableName docId document (Sql.existingConnection conn)
|
Update.byId tableName docId document (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Update an entire document by its ID, using the provided function to obtain the ID from the document
|
/// <summary>
|
||||||
|
/// Update (replace) an entire document by its ID, using the provided function to obtain the ID from the
|
||||||
|
/// document
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tableName">The table in which a document should be updated (may include schema)</param>
|
||||||
|
/// <param name="idFunc">The function to obtain the ID of the document</param>
|
||||||
|
/// <param name="document">The new document</param>
|
||||||
member conn.updateByFunc tableName (idFunc: 'TDoc -> 'TKey) (document: 'TDoc) =
|
member conn.updateByFunc tableName (idFunc: 'TDoc -> 'TKey) (document: 'TDoc) =
|
||||||
WithProps.Update.byFunc tableName idFunc document (Sql.existingConnection conn)
|
Update.byFunc tableName idFunc document (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Patch a document by its ID
|
/// <summary>Patch a document by its ID</summary>
|
||||||
|
/// <param name="tableName">The table in which a document should be patched (may include schema)</param>
|
||||||
|
/// <param name="docId">The ID of the document to patch</param>
|
||||||
|
/// <param name="patch">The partial document to patch the existing document</param>
|
||||||
member conn.patchById tableName (docId: 'TKey) (patch: 'TPatch) =
|
member conn.patchById tableName (docId: 'TKey) (patch: 'TPatch) =
|
||||||
WithProps.Patch.byId tableName docId patch (Sql.existingConnection conn)
|
Patch.byId tableName docId patch (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Patch documents using a JSON field comparison query in the WHERE clause (->> =)
|
/// <summary>
|
||||||
|
/// Patch documents using a JSON field comparison query in the <tt>WHERE</tt> clause (<tt>->> =</tt>,
|
||||||
|
/// etc.)
|
||||||
|
/// </summary>
|
||||||
|
/// <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="fields">The field conditions to match</param>
|
||||||
|
/// <param name="patch">The partial document to patch the existing document</param>
|
||||||
member conn.patchByFields tableName howMatched fields (patch: 'TPatch) =
|
member conn.patchByFields tableName howMatched fields (patch: 'TPatch) =
|
||||||
WithProps.Patch.byFields tableName howMatched fields patch (Sql.existingConnection conn)
|
Patch.byFields tableName howMatched fields patch (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Patch documents using a JSON containment query in the WHERE clause (@>)
|
/// <summary>
|
||||||
|
/// Patch documents using a JSON containment query in the <tt>WHERE</tt> clause (<tt>@></tt>)
|
||||||
|
/// </summary>
|
||||||
|
/// <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="patch">The partial document to patch the existing document</param>
|
||||||
member conn.patchByContains tableName (criteria: 'TCriteria) (patch: 'TPatch) =
|
member conn.patchByContains tableName (criteria: 'TCriteria) (patch: 'TPatch) =
|
||||||
WithProps.Patch.byContains tableName criteria patch (Sql.existingConnection conn)
|
Patch.byContains tableName criteria patch (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Patch documents using a JSON Path match query in the WHERE clause (@?)
|
/// <summary>Patch documents using a JSON Path match query in the <tt>WHERE</tt> clause (<tt>@?</tt>)</summary>
|
||||||
|
/// <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="patch">The partial document to patch the existing document</param>
|
||||||
member conn.patchByJsonPath tableName jsonPath (patch: 'TPatch) =
|
member conn.patchByJsonPath tableName jsonPath (patch: 'TPatch) =
|
||||||
WithProps.Patch.byJsonPath tableName jsonPath patch (Sql.existingConnection conn)
|
Patch.byJsonPath tableName jsonPath patch (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Remove fields from a document by the document's ID
|
/// <summary>Remove fields from a document by the document's ID</summary>
|
||||||
|
/// <param name="tableName">The table in which a document should be modified (may include schema)</param>
|
||||||
|
/// <param name="docId">The ID of the document to modify</param>
|
||||||
|
/// <param name="fieldNames">One or more field names to remove from the document</param>
|
||||||
member conn.removeFieldsById tableName (docId: 'TKey) fieldNames =
|
member conn.removeFieldsById tableName (docId: 'TKey) fieldNames =
|
||||||
WithProps.RemoveFields.byId tableName docId fieldNames (Sql.existingConnection conn)
|
RemoveFields.byId tableName docId fieldNames (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Remove fields from documents via a comparison on JSON fields in the document
|
/// <summary>Remove fields from documents via a comparison on JSON fields in the document</summary>
|
||||||
|
/// <param name="tableName">The table in which documents should be modified (may include schema)</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="fieldNames">One or more field names to remove from the matching documents</param>
|
||||||
member conn.removeFieldsByFields tableName howMatched fields fieldNames =
|
member conn.removeFieldsByFields tableName howMatched fields fieldNames =
|
||||||
WithProps.RemoveFields.byFields tableName howMatched fields fieldNames (Sql.existingConnection conn)
|
RemoveFields.byFields tableName howMatched fields fieldNames (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Remove fields from documents via a JSON containment query (@>)
|
/// <summary>Remove fields from documents via a JSON containment query (<tt>@></tt>)</summary>
|
||||||
|
/// <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="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 =
|
||||||
WithProps.RemoveFields.byContains tableName criteria fieldNames (Sql.existingConnection conn)
|
RemoveFields.byContains tableName criteria fieldNames (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Remove fields from documents via a JSON Path match query (@?)
|
/// <summary>Remove fields from documents via a JSON Path match query (<tt>@?</tt>)</summary>
|
||||||
|
/// <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="fieldNames">One or more field names to remove from the matching documents</param>
|
||||||
member conn.removeFieldsByJsonPath tableName jsonPath fieldNames =
|
member conn.removeFieldsByJsonPath tableName jsonPath fieldNames =
|
||||||
WithProps.RemoveFields.byJsonPath tableName jsonPath fieldNames (Sql.existingConnection conn)
|
RemoveFields.byJsonPath tableName jsonPath fieldNames (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Delete a document by its ID
|
/// <summary>Delete a document by its ID</summary>
|
||||||
|
/// <param name="tableName">The table in which a document should be deleted (may include schema)</param>
|
||||||
|
/// <param name="docId">The ID of the document to delete</param>
|
||||||
member conn.deleteById tableName (docId: 'TKey) =
|
member conn.deleteById tableName (docId: 'TKey) =
|
||||||
WithProps.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>
|
||||||
|
/// <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="fields">The field conditions to match</param>
|
||||||
member conn.deleteByFields tableName howMatched fields =
|
member conn.deleteByFields tableName howMatched fields =
|
||||||
WithProps.Delete.byFields tableName howMatched fields (Sql.existingConnection conn)
|
Delete.byFields tableName howMatched fields (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Delete documents by matching a JSON containment query (@>)
|
/// <summary>Delete documents by matching a JSON contains query (<tt>@></tt>)</summary>
|
||||||
|
/// <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>
|
||||||
member conn.deleteByContains tableName (criteria: 'TContains) =
|
member conn.deleteByContains tableName (criteria: 'TContains) =
|
||||||
WithProps.Delete.byContains tableName criteria (Sql.existingConnection conn)
|
Delete.byContains tableName criteria (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Delete documents by matching a JSON Path match query (@?)
|
/// <summary>Delete documents by matching a JSON Path match query (@?)</summary>
|
||||||
member conn.deleteByJsonPath tableName path =
|
/// <param name="tableName">The table in which documents should be deleted (may include schema)</param>
|
||||||
WithProps.Delete.byJsonPath tableName path (Sql.existingConnection conn)
|
/// <param name="jsonPath">The JSON Path expression to match</param>
|
||||||
|
member conn.deleteByJsonPath tableName jsonPath =
|
||||||
|
Delete.byJsonPath tableName jsonPath (Sql.existingConnection conn)
|
||||||
|
|
||||||
|
|
||||||
open System.Runtime.CompilerServices
|
open System.Runtime.CompilerServices
|
||||||
@ -207,241 +383,241 @@ type NpgsqlConnectionCSharpExtensions =
|
|||||||
/// Execute a query that returns a list of results
|
/// Execute a query that returns a list of results
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline CustomList<'TDoc>(conn, query, parameters, mapFunc: System.Func<RowReader, 'TDoc>) =
|
static member inline CustomList<'TDoc>(conn, query, parameters, mapFunc: System.Func<RowReader, 'TDoc>) =
|
||||||
WithProps.Custom.List<'TDoc>(query, parameters, mapFunc, Sql.existingConnection conn)
|
Custom.List<'TDoc>(query, parameters, mapFunc, Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Execute a query that returns one or no results; returns None if not found
|
/// Execute a query that returns one or no results; returns None if not found
|
||||||
[<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>) =
|
||||||
WithProps.Custom.Single<'TDoc>(query, parameters, mapFunc, Sql.existingConnection conn)
|
Custom.Single<'TDoc>(query, parameters, mapFunc, Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Execute a query that returns no results
|
/// Execute a query that returns no results
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline CustomNonQuery(conn, query, parameters) =
|
static member inline CustomNonQuery(conn, query, parameters) =
|
||||||
WithProps.Custom.nonQuery query parameters (Sql.existingConnection conn)
|
Custom.nonQuery query parameters (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Execute a query that returns a scalar value
|
/// Execute a query that returns a scalar value
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline CustomScalar<'T when 'T: struct>(
|
static member inline CustomScalar<'T when 'T: struct>(
|
||||||
conn, query, parameters, mapFunc: System.Func<RowReader, 'T>) =
|
conn, query, parameters, mapFunc: System.Func<RowReader, 'T>) =
|
||||||
WithProps.Custom.Scalar(query, parameters, mapFunc, Sql.existingConnection conn)
|
Custom.Scalar(query, parameters, mapFunc, Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Create a document table
|
/// Create a document table
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline EnsureTable(conn, name) =
|
static member inline EnsureTable(conn, name) =
|
||||||
WithProps.Definition.ensureTable name (Sql.existingConnection conn)
|
Definition.ensureTable name (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Create an index on documents in the specified table
|
/// Create an index on documents in the specified table
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline EnsureDocumentIndex(conn, name, idxType) =
|
static member inline EnsureDocumentIndex(conn, name, idxType) =
|
||||||
WithProps.Definition.ensureDocumentIndex name idxType (Sql.existingConnection conn)
|
Definition.ensureDocumentIndex name idxType (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Create an index on field(s) within documents in the specified table
|
/// Create an index on field(s) within documents in the specified table
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline EnsureFieldIndex(conn, tableName, indexName, fields) =
|
static member inline EnsureFieldIndex(conn, tableName, indexName, fields) =
|
||||||
WithProps.Definition.ensureFieldIndex tableName indexName fields (Sql.existingConnection conn)
|
Definition.ensureFieldIndex tableName indexName fields (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Insert a new document
|
/// Insert a new document
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline Insert<'TDoc>(conn, tableName, document: 'TDoc) =
|
static member inline Insert<'TDoc>(conn, tableName, document: 'TDoc) =
|
||||||
WithProps.Document.insert<'TDoc> tableName document (Sql.existingConnection conn)
|
insert<'TDoc> tableName document (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Save a document, inserting it if it does not exist and updating it if it does (AKA "upsert")
|
/// Save a document, inserting it if it does not exist and updating it if it does (AKA "upsert")
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline Save<'TDoc>(conn, tableName, document: 'TDoc) =
|
static member inline Save<'TDoc>(conn, tableName, document: 'TDoc) =
|
||||||
WithProps.Document.save<'TDoc> tableName document (Sql.existingConnection conn)
|
save<'TDoc> tableName document (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Count all documents in a table
|
/// Count all documents in a table
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline CountAll(conn, tableName) =
|
static member inline CountAll(conn, tableName) =
|
||||||
WithProps.Count.all tableName (Sql.existingConnection conn)
|
Count.all tableName (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Count matching documents using a JSON field comparison query (->> =)
|
/// Count matching documents using a JSON field comparison query (->> =)
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline CountByFields(conn, tableName, howMatched, fields) =
|
static member inline CountByFields(conn, tableName, howMatched, fields) =
|
||||||
WithProps.Count.byFields tableName howMatched fields (Sql.existingConnection conn)
|
Count.byFields tableName howMatched fields (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Count matching documents using a JSON containment query (@>)
|
/// Count matching documents using a JSON containment query (@>)
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline CountByContains(conn, tableName, criteria: 'TCriteria) =
|
static member inline CountByContains(conn, tableName, criteria: 'TCriteria) =
|
||||||
WithProps.Count.byContains tableName criteria (Sql.existingConnection conn)
|
Count.byContains tableName criteria (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Count matching documents using a JSON Path match query (@?)
|
/// Count matching documents using a JSON Path match query (@?)
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline CountByJsonPath(conn, tableName, jsonPath) =
|
static member inline CountByJsonPath(conn, tableName, jsonPath) =
|
||||||
WithProps.Count.byJsonPath tableName jsonPath (Sql.existingConnection conn)
|
Count.byJsonPath tableName jsonPath (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Determine if a document exists for the given ID
|
/// Determine if a document exists for the given ID
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline ExistsById(conn, tableName, docId) =
|
static member inline ExistsById(conn, tableName, docId) =
|
||||||
WithProps.Exists.byId tableName docId (Sql.existingConnection conn)
|
Exists.byId tableName docId (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Determine if documents exist using a JSON field comparison query (->> =)
|
/// Determine if documents exist using a JSON field comparison query (->> =)
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline ExistsByFields(conn, tableName, howMatched, fields) =
|
static member inline ExistsByFields(conn, tableName, howMatched, fields) =
|
||||||
WithProps.Exists.byFields tableName howMatched fields (Sql.existingConnection conn)
|
Exists.byFields tableName howMatched fields (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Determine if documents exist using a JSON containment query (@>)
|
/// Determine if documents exist using a JSON containment query (@>)
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline ExistsByContains(conn, tableName, criteria: 'TCriteria) =
|
static member inline ExistsByContains(conn, tableName, criteria: 'TCriteria) =
|
||||||
WithProps.Exists.byContains tableName criteria (Sql.existingConnection conn)
|
Exists.byContains tableName criteria (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Determine if documents exist using a JSON Path match query (@?)
|
/// Determine if documents exist using a JSON Path match query (@?)
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline ExistsByJsonPath(conn, tableName, jsonPath) =
|
static member inline ExistsByJsonPath(conn, tableName, jsonPath) =
|
||||||
WithProps.Exists.byJsonPath tableName jsonPath (Sql.existingConnection conn)
|
Exists.byJsonPath tableName jsonPath (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Retrieve all documents in the given table
|
/// Retrieve all documents in the given table
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline FindAll<'TDoc>(conn, tableName) =
|
static member inline FindAll<'TDoc>(conn, tableName) =
|
||||||
WithProps.Find.All<'TDoc>(tableName, Sql.existingConnection conn)
|
Find.All<'TDoc>(tableName, Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Retrieve all documents in the given table ordered by the given fields in the document
|
/// Retrieve all documents in the given table ordered by the given fields in the document
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline FindAllOrdered<'TDoc>(conn, tableName, orderFields) =
|
static member inline FindAllOrdered<'TDoc>(conn, tableName, orderFields) =
|
||||||
WithProps.Find.AllOrdered<'TDoc>(tableName, orderFields, Sql.existingConnection conn)
|
Find.AllOrdered<'TDoc>(tableName, orderFields, Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Retrieve a document by its ID; returns None if not found
|
/// Retrieve a document by its ID; returns None if not found
|
||||||
[<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) =
|
||||||
WithProps.Find.ById<'TKey, 'TDoc>(tableName, docId, Sql.existingConnection conn)
|
Find.ById<'TKey, 'TDoc>(tableName, docId, Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Retrieve documents matching a JSON field comparison query (->> =)
|
/// Retrieve documents matching a JSON field comparison query (->> =)
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline FindByFields<'TDoc>(conn, tableName, howMatched, fields) =
|
static member inline FindByFields<'TDoc>(conn, tableName, howMatched, fields) =
|
||||||
WithProps.Find.ByFields<'TDoc>(tableName, howMatched, fields, Sql.existingConnection conn)
|
Find.ByFields<'TDoc>(tableName, howMatched, fields, Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Retrieve documents matching a JSON field comparison query (->> =) ordered by the given fields in the document
|
/// Retrieve documents matching a JSON field comparison query (->> =) ordered by the given fields in the document
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline FindByFieldsOrdered<'TDoc>(conn, tableName, howMatched, queryFields, orderFields) =
|
static member inline FindByFieldsOrdered<'TDoc>(conn, tableName, howMatched, queryFields, orderFields) =
|
||||||
WithProps.Find.ByFieldsOrdered<'TDoc>(
|
Find.ByFieldsOrdered<'TDoc>(
|
||||||
tableName, howMatched, queryFields, orderFields, Sql.existingConnection conn)
|
tableName, howMatched, queryFields, orderFields, Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Retrieve documents matching a JSON containment query (@>)
|
/// Retrieve documents matching a JSON containment query (@>)
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline FindByContains<'TDoc>(conn, tableName, criteria: obj) =
|
static member inline FindByContains<'TDoc>(conn, tableName, criteria: obj) =
|
||||||
WithProps.Find.ByContains<'TDoc>(tableName, criteria, Sql.existingConnection conn)
|
Find.ByContains<'TDoc>(tableName, criteria, Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Retrieve documents matching a JSON containment query (@>) ordered by the given fields in the document
|
/// Retrieve documents matching a JSON containment query (@>) ordered by the given fields in the document
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline FindByContainsOrdered<'TDoc>(conn, tableName, criteria: obj, orderFields) =
|
static member inline FindByContainsOrdered<'TDoc>(conn, tableName, criteria: obj, orderFields) =
|
||||||
WithProps.Find.ByContainsOrdered<'TDoc>(tableName, criteria, orderFields, Sql.existingConnection conn)
|
Find.ByContainsOrdered<'TDoc>(tableName, criteria, orderFields, Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Retrieve documents matching a JSON Path match query (@?)
|
/// Retrieve documents matching a JSON Path match query (@?)
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline FindByJsonPath<'TDoc>(conn, tableName, jsonPath) =
|
static member inline FindByJsonPath<'TDoc>(conn, tableName, jsonPath) =
|
||||||
WithProps.Find.ByJsonPath<'TDoc>(tableName, jsonPath, Sql.existingConnection conn)
|
Find.ByJsonPath<'TDoc>(tableName, jsonPath, Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Retrieve documents matching a JSON Path match query (@?) ordered by the given fields in the document
|
/// Retrieve documents matching a JSON Path match query (@?) ordered by the given fields in the document
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline FindByJsonPathOrdered<'TDoc>(conn, tableName, jsonPath, orderFields) =
|
static member inline FindByJsonPathOrdered<'TDoc>(conn, tableName, jsonPath, orderFields) =
|
||||||
WithProps.Find.ByJsonPathOrdered<'TDoc>(tableName, jsonPath, orderFields, Sql.existingConnection conn)
|
Find.ByJsonPathOrdered<'TDoc>(tableName, jsonPath, orderFields, Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Retrieve the first document matching a JSON field comparison query (->> =); returns null if not found
|
/// Retrieve the first document matching a JSON field comparison query (->> =); returns null if not found
|
||||||
[<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) =
|
||||||
WithProps.Find.FirstByFields<'TDoc>(tableName, howMatched, fields, Sql.existingConnection conn)
|
Find.FirstByFields<'TDoc>(tableName, howMatched, fields, Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Retrieve the first document matching a JSON field comparison query (->> =) ordered by the given fields in the
|
/// Retrieve the first document matching a JSON field comparison query (->> =) ordered by the given fields in the
|
||||||
/// document; returns null if not found
|
/// document; returns null if not found
|
||||||
[<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) =
|
||||||
WithProps.Find.FirstByFieldsOrdered<'TDoc>(
|
Find.FirstByFieldsOrdered<'TDoc>(
|
||||||
tableName, howMatched, queryFields, orderFields, Sql.existingConnection conn)
|
tableName, howMatched, queryFields, orderFields, Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Retrieve the first document matching a JSON containment query (@>); returns None if not found
|
/// Retrieve the first document matching a JSON containment query (@>); returns None if not found
|
||||||
[<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) =
|
||||||
WithProps.Find.FirstByContains<'TDoc>(tableName, criteria, Sql.existingConnection conn)
|
Find.FirstByContains<'TDoc>(tableName, criteria, Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Retrieve the first document matching a JSON containment query (@>) ordered by the given fields in the document;
|
/// Retrieve the first document matching a JSON containment query (@>) ordered by the given fields in the document;
|
||||||
/// returns None if not found
|
/// returns None if not found
|
||||||
[<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) =
|
||||||
WithProps.Find.FirstByContainsOrdered<'TDoc>(tableName, criteria, orderFields, Sql.existingConnection conn)
|
Find.FirstByContainsOrdered<'TDoc>(tableName, criteria, orderFields, Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Retrieve the first document matching a JSON Path match query (@?); returns None if not found
|
/// Retrieve the first document matching a JSON Path match query (@?); returns None if not found
|
||||||
[<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) =
|
||||||
WithProps.Find.FirstByJsonPath<'TDoc>(tableName, jsonPath, Sql.existingConnection conn)
|
Find.FirstByJsonPath<'TDoc>(tableName, jsonPath, Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Retrieve the first document matching a JSON Path match query (@?) ordered by the given fields in the document;
|
/// Retrieve the first document matching a JSON Path match query (@?) ordered by the given fields in the document;
|
||||||
/// returns None if not found
|
/// returns None if not found
|
||||||
[<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) =
|
||||||
WithProps.Find.FirstByJsonPathOrdered<'TDoc>(tableName, jsonPath, orderFields, Sql.existingConnection conn)
|
Find.FirstByJsonPathOrdered<'TDoc>(tableName, jsonPath, orderFields, Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Update an entire document by its ID
|
/// Update an entire document by its ID
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline UpdateById(conn, tableName, docId: 'TKey, document: 'TDoc) =
|
static member inline UpdateById(conn, tableName, docId: 'TKey, document: 'TDoc) =
|
||||||
WithProps.Update.byId tableName docId document (Sql.existingConnection conn)
|
Update.byId tableName docId document (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Update an entire document by its ID, using the provided function to obtain the ID from the document
|
/// Update an entire document by its ID, using the provided function to obtain the ID from the document
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline UpdateByFunc(conn, tableName, idFunc: System.Func<'TDoc, 'TKey>, document: 'TDoc) =
|
static member inline UpdateByFunc(conn, tableName, idFunc: System.Func<'TDoc, 'TKey>, document: 'TDoc) =
|
||||||
WithProps.Update.ByFunc(tableName, idFunc, document, Sql.existingConnection conn)
|
Update.ByFunc(tableName, idFunc, document, Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Patch a document by its ID
|
/// Patch a document by its ID
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline PatchById(conn, tableName, docId: 'TKey, patch: 'TPatch) =
|
static member inline PatchById(conn, tableName, docId: 'TKey, patch: 'TPatch) =
|
||||||
WithProps.Patch.byId tableName docId patch (Sql.existingConnection conn)
|
Patch.byId tableName docId patch (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Patch documents using a JSON field comparison query in the WHERE clause (->> =)
|
/// Patch documents using a JSON field comparison query in the WHERE clause (->> =)
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline PatchByFields(conn, tableName, howMatched, fields, patch: 'TPatch) =
|
static member inline PatchByFields(conn, tableName, howMatched, fields, patch: 'TPatch) =
|
||||||
WithProps.Patch.byFields tableName howMatched fields patch (Sql.existingConnection conn)
|
Patch.byFields tableName howMatched fields patch (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Patch documents using a JSON containment query in the WHERE clause (@>)
|
/// Patch documents using a JSON containment query in the WHERE clause (@>)
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline PatchByContains(conn, tableName, criteria: 'TCriteria, patch: 'TPatch) =
|
static member inline PatchByContains(conn, tableName, criteria: 'TCriteria, patch: 'TPatch) =
|
||||||
WithProps.Patch.byContains tableName criteria patch (Sql.existingConnection conn)
|
Patch.byContains tableName criteria patch (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Patch documents using a JSON Path match query in the WHERE clause (@?)
|
/// Patch documents using a JSON Path match query in the WHERE clause (@?)
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline PatchByJsonPath(conn, tableName, jsonPath, patch: 'TPatch) =
|
static member inline PatchByJsonPath(conn, tableName, jsonPath, patch: 'TPatch) =
|
||||||
WithProps.Patch.byJsonPath tableName jsonPath patch (Sql.existingConnection conn)
|
Patch.byJsonPath tableName jsonPath patch (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Remove fields from a document by the document's ID
|
/// Remove fields from a document by the document's ID
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline RemoveFieldsById(conn, tableName, docId: 'TKey, fieldNames) =
|
static member inline RemoveFieldsById(conn, tableName, docId: 'TKey, fieldNames) =
|
||||||
WithProps.RemoveFields.byId tableName docId fieldNames (Sql.existingConnection conn)
|
RemoveFields.byId tableName docId fieldNames (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Remove fields from documents via a comparison on JSON fields in the document
|
/// Remove fields from documents via a comparison on JSON fields in the document
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline RemoveFieldsByFields(conn, tableName, howMatched, fields, fieldNames) =
|
static member inline RemoveFieldsByFields(conn, tableName, howMatched, fields, fieldNames) =
|
||||||
WithProps.RemoveFields.byFields tableName howMatched fields fieldNames (Sql.existingConnection conn)
|
RemoveFields.byFields tableName howMatched fields fieldNames (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Remove fields from documents via a JSON containment query (@>)
|
/// Remove fields from documents via a JSON containment query (@>)
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline RemoveFieldsByContains(conn, tableName, criteria: 'TContains, fieldNames) =
|
static member inline RemoveFieldsByContains(conn, tableName, criteria: 'TContains, fieldNames) =
|
||||||
WithProps.RemoveFields.byContains tableName criteria fieldNames (Sql.existingConnection conn)
|
RemoveFields.byContains tableName criteria fieldNames (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Remove fields from documents via a JSON Path match query (@?)
|
/// Remove fields from documents via a JSON Path match query (@?)
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline RemoveFieldsByJsonPath(conn, tableName, jsonPath, fieldNames) =
|
static member inline RemoveFieldsByJsonPath(conn, tableName, jsonPath, fieldNames) =
|
||||||
WithProps.RemoveFields.byJsonPath tableName jsonPath fieldNames (Sql.existingConnection conn)
|
RemoveFields.byJsonPath tableName jsonPath fieldNames (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Delete a document by its ID
|
/// Delete a document by its ID
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline DeleteById(conn, tableName, docId: 'TKey) =
|
static member inline DeleteById(conn, tableName, docId: 'TKey) =
|
||||||
WithProps.Delete.byId tableName docId (Sql.existingConnection conn)
|
Delete.byId tableName docId (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Delete documents by matching a JSON field comparison query (->> =)
|
/// Delete documents by matching a JSON field comparison query (->> =)
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline DeleteByFields(conn, tableName, howMatched, fields) =
|
static member inline DeleteByFields(conn, tableName, howMatched, fields) =
|
||||||
WithProps.Delete.byFields tableName howMatched fields (Sql.existingConnection conn)
|
Delete.byFields tableName howMatched fields (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Delete documents by matching a JSON containment query (@>)
|
/// Delete documents by matching a JSON containment query (@>)
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline DeleteByContains(conn, tableName, criteria: 'TContains) =
|
static member inline DeleteByContains(conn, tableName, criteria: 'TContains) =
|
||||||
WithProps.Delete.byContains tableName criteria (Sql.existingConnection conn)
|
Delete.byContains tableName criteria (Sql.existingConnection conn)
|
||||||
|
|
||||||
/// Delete documents by matching a JSON Path match query (@?)
|
/// Delete documents by matching a JSON Path match query (@?)
|
||||||
[<Extension>]
|
[<Extension>]
|
||||||
static member inline DeleteByJsonPath(conn, tableName, path) =
|
static member inline DeleteByJsonPath(conn, tableName, path) =
|
||||||
WithProps.Delete.byJsonPath tableName path (Sql.existingConnection conn)
|
Delete.byJsonPath tableName path (Sql.existingConnection conn)
|
||||||
|
@ -528,7 +528,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 WHERE clause (<tt>@></tt>)</summary>
|
/// <summary>Patch documents using a JSON containment query in the <tt>WHERE</tt> clause (<tt>@></tt>)</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>
|
||||||
@ -536,7 +536,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 WHERE clause (<tt>@?</tt>)</summary>
|
/// <summary>Patch documents using a JSON Path match query in the <tt>WHERE</tt> clause (<tt>@?</tt>)</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>
|
||||||
|
@ -726,7 +726,7 @@ module Patch =
|
|||||||
(addFieldParams fields [ jsonParam "@data" patch ])
|
(addFieldParams fields [ jsonParam "@data" patch ])
|
||||||
sqlProps
|
sqlProps
|
||||||
|
|
||||||
/// <summary>Patch documents using a JSON containment query in the WHERE clause (<tt>@></tt>)</summary>
|
/// <summary>Patch documents using a JSON containment query in the <tt>WHERE</tt> clause (<tt>@></tt>)</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>
|
||||||
@ -738,7 +738,7 @@ module Patch =
|
|||||||
[ jsonParam "@data" patch; jsonParam "@criteria" criteria ]
|
[ jsonParam "@data" patch; jsonParam "@criteria" criteria ]
|
||||||
sqlProps
|
sqlProps
|
||||||
|
|
||||||
/// <summary>Patch documents using a JSON Path match query in the WHERE clause (<tt>@?</tt>)</summary>
|
/// <summary>Patch documents using a JSON Path match query in the <tt>WHERE</tt> clause (<tt>@?</tt>)</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>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user