Add Json throughout Postgres
This commit is contained in:
parent
f7ab1f1445
commit
a363370342
File diff suppressed because it is too large
Load Diff
@ -21,6 +21,40 @@ module Custom =
|
||||
let List<'TDoc>(query, parameters, mapFunc: System.Func<RowReader, 'TDoc>) =
|
||||
WithProps.Custom.List<'TDoc>(query, parameters, mapFunc, fromDataSource ())
|
||||
|
||||
/// <summary>Execute a query that returns a JSON array 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 to extract the document</param>
|
||||
/// <returns>A JSON array of results for the given query</returns>
|
||||
[<CompiledName "FSharpJsonArray">]
|
||||
let jsonArray query parameters mapFunc =
|
||||
WithProps.Custom.jsonArray query parameters mapFunc (fromDataSource ())
|
||||
|
||||
/// <summary>Execute a query that returns a JSON array 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 to extract the document</param>
|
||||
/// <returns>A JSON array of results for the given query</returns>
|
||||
let JsonArray(query, parameters, mapFunc) =
|
||||
WithProps.Custom.JsonArray(query, parameters, mapFunc, fromDataSource ())
|
||||
|
||||
/// <summary>Execute a query, writing its results to the given <c>StreamWriter</c></summary>
|
||||
/// <param name="query">The query to retrieve the results</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="mapFunc">The mapping function to extract the document</param>
|
||||
[<CompiledName "FSharpWriteJsonArray">]
|
||||
let writeJsonArray query parameters writer mapFunc =
|
||||
WithProps.Custom.writeJsonArray query parameters writer mapFunc
|
||||
|
||||
/// <summary>Execute a query, writing its results to the given <c>StreamWriter</c></summary>
|
||||
/// <param name="query">The query to retrieve the results</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="mapFunc">The mapping function to extract the document</param>
|
||||
let WriteJsonArray(query, parameters, writer, mapFunc) =
|
||||
WithProps.Custom.WriteJsonArray(query, parameters, writer, mapFunc, fromDataSource ())
|
||||
|
||||
/// <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>
|
||||
@ -39,6 +73,23 @@ module Custom =
|
||||
query, parameters, mapFunc: System.Func<RowReader, 'TDoc>) =
|
||||
WithProps.Custom.Single<'TDoc>(query, parameters, mapFunc, fromDataSource ())
|
||||
|
||||
/// <summary>Execute a query that returns one or no JSON documents</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 to extract the document</param>
|
||||
/// <returns>The JSON document with the first matching result, or an empty document if not found</returns>
|
||||
[<CompiledName "FSharpJsonSingle">]
|
||||
let jsonSingle query parameters mapFunc =
|
||||
WithProps.Custom.jsonSingle query parameters mapFunc (fromDataSource ())
|
||||
|
||||
/// <summary>Execute a query that returns one or no JSON documents</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 to extract the document</param>
|
||||
/// <returns>The JSON document with the first matching result, or an empty document if not found</returns>
|
||||
let JsonSingle(query, parameters, mapFunc) =
|
||||
WithProps.Custom.JsonSingle(query, parameters, mapFunc, fromDataSource ())
|
||||
|
||||
/// <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>
|
||||
@ -184,7 +235,7 @@ module Exists =
|
||||
WithProps.Exists.byJsonPath tableName jsonPath (fromDataSource ())
|
||||
|
||||
|
||||
/// <summary>Commands to retrieve documents</summary>
|
||||
/// <summary>Commands to retrieve documents as domain objects</summary>
|
||||
[<RequireQualifiedAccess>]
|
||||
module Find =
|
||||
|
||||
@ -473,6 +524,322 @@ module Find =
|
||||
WithProps.Find.FirstByJsonPathOrdered<'TDoc>(tableName, jsonPath, orderFields, fromDataSource ())
|
||||
|
||||
|
||||
/// <summary>Commands to retrieve documents as JSON</summary>
|
||||
[<RequireQualifiedAccess>]
|
||||
module Json =
|
||||
|
||||
/// <summary>Retrieve all documents in the given table as a JSON array</summary>
|
||||
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
|
||||
/// <returns>All documents from the given table as a JSON array</returns>
|
||||
[<CompiledName "All">]
|
||||
let all tableName =
|
||||
WithProps.Json.all tableName (fromDataSource ())
|
||||
|
||||
/// <summary>Write all documents in the given table to the given <c>StreamWriter</c></summary>
|
||||
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
|
||||
/// <param name="writer">The StreamWriter to which the results should be written</param>
|
||||
[<CompiledName "WriteAll">]
|
||||
let writeAll tableName writer =
|
||||
WithProps.Json.writeAll tableName writer (fromDataSource ())
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve all documents in the given table as a JSON array, 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 as a JSON array, ordered by the given fields</returns>
|
||||
[<CompiledName "AllOrdered">]
|
||||
let allOrdered tableName orderFields =
|
||||
WithProps.Json.allOrdered tableName orderFields (fromDataSource ())
|
||||
|
||||
/// <summary>
|
||||
/// Write all documents in the given table to the given <c>StreamWriter</c>, 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="writer">The StreamWriter to which the results should be written</param>
|
||||
/// <param name="orderFields">Fields by which the results should be ordered</param>
|
||||
[<CompiledName "WriteAllOrdered">]
|
||||
let writeAllOrdered tableName writer orderFields =
|
||||
WithProps.Json.writeAllOrdered tableName writer orderFields (fromDataSource ())
|
||||
|
||||
/// <summary>Retrieve a JSON 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>The JSON document if found, an empty JSON document otherwise</returns>
|
||||
[<CompiledName "ById">]
|
||||
let byId<'TKey> tableName (docId: 'TKey) =
|
||||
WithProps.Json.byId tableName docId (fromDataSource ())
|
||||
|
||||
/// <summary>Write a JSON document to the given <c>StreamWriter</c> by its ID</summary>
|
||||
/// <param name="tableName">The table from which a document should be retrieved (may include schema)</param>
|
||||
/// <param name="writer">The StreamWriter to which the results should be written</param>
|
||||
/// <param name="docId">The ID of the document to retrieve</param>
|
||||
[<CompiledName "WriteById">]
|
||||
let writeById<'TKey> tableName writer (docId: 'TKey) =
|
||||
WithProps.Json.writeById tableName writer docId (fromDataSource ())
|
||||
|
||||
/// <summary>Retrieve JSON 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="howMatched">Whether to match any or all of the field conditions</param>
|
||||
/// <param name="fields">The field conditions to match</param>
|
||||
/// <returns>All JSON documents matching the given fields</returns>
|
||||
[<CompiledName "ByFields">]
|
||||
let byFields tableName howMatched fields =
|
||||
WithProps.Json.byFields tableName howMatched fields (fromDataSource ())
|
||||
|
||||
/// <summary>
|
||||
/// Write JSON documents to the given <c>StreamWriter</c> 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="writer">The StreamWriter to which the results should be written</param>
|
||||
/// <param name="howMatched">Whether to match any or all of the field conditions</param>
|
||||
/// <param name="fields">The field conditions to match</param>
|
||||
[<CompiledName "WriteByFields">]
|
||||
let writeByFields tableName writer howMatched fields =
|
||||
WithProps.Json.writeByFields tableName writer howMatched fields (fromDataSource ())
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve JSON documents matching JSON field comparisons (<c>->> =</c>, 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 JSON documents matching the given fields, ordered by the other given fields</returns>
|
||||
[<CompiledName "ByFieldsOrdered">]
|
||||
let byFieldsOrdered tableName howMatched queryFields orderFields =
|
||||
WithProps.Json.byFieldsOrdered tableName howMatched queryFields orderFields (fromDataSource ())
|
||||
|
||||
/// <summary>
|
||||
/// Write JSON documents to the given <c>StreamWriter</c> matching JSON field comparisons (<c>->> =</c>, 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="writer">The StreamWriter to which the results should be written</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>
|
||||
[<CompiledName "WriteByFieldsOrdered">]
|
||||
let writeByFieldsOrdered tableName writer howMatched queryFields orderFields =
|
||||
WithProps.Json.writeByFieldsOrdered tableName writer howMatched queryFields orderFields (fromDataSource ())
|
||||
|
||||
/// <summary>Retrieve JSON 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="criteria">The document to match with the containment query</param>
|
||||
/// <returns>All JSON documents matching the given containment query</returns>
|
||||
[<CompiledName "ByContains">]
|
||||
let byContains tableName (criteria: obj) =
|
||||
WithProps.Json.byContains tableName criteria (fromDataSource ())
|
||||
|
||||
/// <summary>
|
||||
/// Write JSON documents to the given <c>StreamWriter</c> 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="writer">The StreamWriter to which the results should be written</param>
|
||||
/// <param name="criteria">The document to match with the containment query</param>
|
||||
[<CompiledName "WriteByContains">]
|
||||
let writeByContains tableName writer (criteria: obj) =
|
||||
WithProps.Json.writeByContains tableName writer criteria (fromDataSource ())
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve JSON documents matching a JSON containment query (<c>@></c>) 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>
|
||||
[<CompiledName "ByContainsOrdered">]
|
||||
let byContainsOrdered tableName (criteria: obj) orderFields =
|
||||
WithProps.Json.byContainsOrdered tableName criteria orderFields (fromDataSource ())
|
||||
|
||||
/// <summary>
|
||||
/// Write JSON documents to the given <c>StreamWriter</c> matching a JSON containment query (<c>@></c>) 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="writer">The StreamWriter to which the results should be written</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>
|
||||
[<CompiledName "WriteByContainsOrdered">]
|
||||
let writeByContainsOrdered tableName writer (criteria: obj) orderFields =
|
||||
WithProps.Json.writeByContainsOrdered tableName writer criteria orderFields (fromDataSource ())
|
||||
|
||||
/// <summary>Retrieve JSON 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="jsonPath">The JSON Path expression to match</param>
|
||||
/// <returns>All JSON documents matching the given JSON Path expression</returns>
|
||||
[<CompiledName "ByJsonPath">]
|
||||
let byJsonPath tableName jsonPath =
|
||||
WithProps.Json.byJsonPath tableName jsonPath (fromDataSource ())
|
||||
|
||||
/// <summary>
|
||||
/// Write JSON documents to the given <c>StreamWriter</c> 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="writer">The StreamWriter to which the results should be written</param>
|
||||
/// <param name="jsonPath">The JSON Path expression to match</param>
|
||||
[<CompiledName "WriteByJsonPath">]
|
||||
let writeByJsonPath tableName writer jsonPath =
|
||||
WithProps.Json.writeByJsonPath tableName writer jsonPath (fromDataSource ())
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve JSON documents matching a JSON Path match query (<c>@?</c>) 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 JSON documents matching the given JSON Path expression, ordered by the given fields</returns>
|
||||
[<CompiledName "ByJsonPathOrdered">]
|
||||
let byJsonPathOrdered tableName jsonPath orderFields =
|
||||
WithProps.Json.byJsonPathOrdered tableName jsonPath orderFields (fromDataSource ())
|
||||
|
||||
/// <summary>
|
||||
/// Write JSON documents to the given <c>StreamWriter</c> matching a JSON Path match query (<c>@?</c>) 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="writer">The StreamWriter to which the results should be written</param>
|
||||
/// <param name="jsonPath">The JSON Path expression to match</param>
|
||||
/// <param name="orderFields">Fields by which the results should be ordered</param>
|
||||
[<CompiledName "WriteByJsonPathOrdered">]
|
||||
let writeByJsonPathOrdered tableName writer jsonPath orderFields =
|
||||
WithProps.Json.writeByJsonPathOrdered tableName writer jsonPath orderFields (fromDataSource ())
|
||||
|
||||
/// <summary>Retrieve the first JSON 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="howMatched">Whether to match any or all of the field conditions</param>
|
||||
/// <param name="fields">The field conditions to match</param>
|
||||
/// <returns>The first matching JSON document if found, an empty JSON document otherwise</returns>
|
||||
[<CompiledName "FirstByFields">]
|
||||
let firstByFields tableName howMatched fields =
|
||||
WithProps.Json.firstByFields tableName howMatched fields (fromDataSource ())
|
||||
|
||||
/// <summary>
|
||||
/// Write the first JSON document to the given <c>StreamWriter</c> 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="writer">The StreamWriter to which the results should be written</param>
|
||||
/// <param name="howMatched">Whether to match any or all of the field conditions</param>
|
||||
/// <param name="fields">The field conditions to match</param>
|
||||
[<CompiledName "WriteFirstByFields">]
|
||||
let writeFirstByFields tableName writer howMatched fields =
|
||||
WithProps.Json.writeFirstByFields tableName writer howMatched fields (fromDataSource ())
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the first JSON document matching JSON field comparisons (<c>->> =</c>, 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>The first matching JSON document if found, an empty JSON document otherwise</returns>
|
||||
[<CompiledName "FirstByFieldsOrdered">]
|
||||
let firstByFieldsOrdered tableName howMatched queryFields orderFields =
|
||||
WithProps.Json.firstByFieldsOrdered tableName howMatched queryFields orderFields (fromDataSource ())
|
||||
|
||||
/// <summary>
|
||||
/// Write the first JSON document to the given <c>StreamWriter</c> matching JSON field comparisons
|
||||
/// (<c>->> =</c>, 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="writer">The StreamWriter to which the results should be written</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>
|
||||
[<CompiledName "WriteFirstByFieldsOrdered">]
|
||||
let writeFirstByFieldsOrdered tableName writer howMatched queryFields orderFields =
|
||||
WithProps.Json.writeFirstByFieldsOrdered tableName writer howMatched queryFields orderFields (fromDataSource ())
|
||||
|
||||
/// <summary>Retrieve the first JSON 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="criteria">The document to match with the containment query</param>
|
||||
/// <returns>The first matching JSON document if found, an empty JSON document otherwise</returns>
|
||||
[<CompiledName "FirstByContains">]
|
||||
let firstByContains tableName (criteria: obj) =
|
||||
WithProps.Json.firstByContains tableName criteria (fromDataSource ())
|
||||
|
||||
/// <summary>
|
||||
/// Write the first JSON document to the given <c>StreamWriter</c> 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="writer">The StreamWriter to which the results should be written</param>
|
||||
/// <param name="criteria">The document to match with the containment query</param>
|
||||
[<CompiledName "WriteFirstByContains">]
|
||||
let writeFirstByContains tableName writer (criteria: obj) =
|
||||
WithProps.Json.writeFirstByContains tableName writer criteria (fromDataSource ())
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the first JSON document matching a JSON containment query (<c>@></c>) 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>The first matching JSON document if found, an empty JSON document otherwise</returns>
|
||||
[<CompiledName "FirstByContainsOrdered">]
|
||||
let firstByContainsOrdered tableName (criteria: obj) orderFields =
|
||||
WithProps.Json.firstByContainsOrdered tableName criteria orderFields (fromDataSource ())
|
||||
|
||||
/// <summary>
|
||||
/// Write the first JSON document to the given <c>StreamWriter</c> matching a JSON containment query (<c>@></c>)
|
||||
/// 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="writer">The StreamWriter to which the results should be written</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>
|
||||
[<CompiledName "WriteFirstByContainsOrdered">]
|
||||
let writeFirstByContainsOrdered tableName writer (criteria: obj) orderFields =
|
||||
WithProps.Json.writeFirstByContainsOrdered tableName writer criteria orderFields (fromDataSource ())
|
||||
|
||||
/// <summary>Retrieve the first JSON 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="jsonPath">The JSON Path expression to match</param>
|
||||
/// <returns>The first matching JSON document if found, an empty JSON document otherwise</returns>
|
||||
[<CompiledName "FirstByJsonPath">]
|
||||
let firstByJsonPath tableName jsonPath =
|
||||
WithProps.Json.firstByJsonPath tableName jsonPath (fromDataSource ())
|
||||
|
||||
/// <summary>
|
||||
/// Write the first JSON document to the given <c>StreamWriter</c> 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="writer">The StreamWriter to which the results should be written</param>
|
||||
/// <param name="jsonPath">The JSON Path expression to match</param>
|
||||
[<CompiledName "WriteFirstByJsonPath">]
|
||||
let writeFirstByJsonPath tableName writer jsonPath =
|
||||
WithProps.Json.writeFirstByJsonPath tableName writer jsonPath (fromDataSource ())
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the first JSON document matching a JSON Path match query (<c>@?</c>) 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>The first matching JSON document if found, an empty JSON document otherwise</returns>
|
||||
[<CompiledName "FirstByJsonPathOrdered">]
|
||||
let firstByJsonPathOrdered tableName jsonPath orderFields =
|
||||
WithProps.Json.firstByJsonPathOrdered tableName jsonPath orderFields (fromDataSource ())
|
||||
|
||||
/// <summary>
|
||||
/// Write the first JSON document to the given <c>StreamWriter</c> matching a JSON Path match query (<c>@?</c>)
|
||||
/// 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="writer">The StreamWriter to which the results should be written</param>
|
||||
/// <param name="jsonPath">The JSON Path expression to match</param>
|
||||
/// <param name="orderFields">Fields by which the results should be ordered</param>
|
||||
[<CompiledName "WriteFirstByJsonPathOrdered">]
|
||||
let writeFirstByJsonPathOrdered tableName writer jsonPath orderFields =
|
||||
WithProps.Json.writeFirstByJsonPathOrdered tableName writer jsonPath orderFields (fromDataSource ())
|
||||
|
||||
|
||||
/// <summary>Commands to update documents</summary>
|
||||
[<RequireQualifiedAccess>]
|
||||
module Update =
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
open System.IO
|
||||
open System.Text
|
||||
open Npgsql.FSharp
|
||||
|
||||
/// <summary>The type of index to generate for the document</summary>
|
||||
[<Struct>]
|
||||
@ -362,4 +361,3 @@ module Results =
|
||||
/// <param name="sqlProps">The query from which JSON should be extracted</param>
|
||||
let WriteJsonArray(writer, mapFunc: System.Func<RowReader, string>, sqlProps) =
|
||||
writeJsonArray writer mapFunc.Invoke sqlProps
|
||||
|
@ -37,7 +37,7 @@ module Custom =
|
||||
/// <summary>Execute a query that returns a JSON array 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>
|
||||
/// <param name="mapFunc">The mapping function to extract the document</param>
|
||||
/// <param name="sqlProps">The <c>SqlProps</c> to use to execute the query</param>
|
||||
/// <returns>A JSON array of results for the given query</returns>
|
||||
[<CompiledName "FSharpJsonArray">]
|
||||
@ -49,7 +49,7 @@ module Custom =
|
||||
/// <summary>Execute a query that returns a JSON array 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>
|
||||
/// <param name="mapFunc">The mapping function to extract the document</param>
|
||||
/// <param name="sqlProps">The <c>SqlProps</c> to use to execute the query</param>
|
||||
/// <returns>A JSON array of results for the given query</returns>
|
||||
let JsonArray(query, parameters, mapFunc: System.Func<RowReader, string>, sqlProps) =
|
||||
@ -59,7 +59,7 @@ module Custom =
|
||||
/// <param name="query">The query to retrieve the results</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="mapFunc">The mapping function between the document and the domain item</param>
|
||||
/// <param name="mapFunc">The mapping function to extract the document</param>
|
||||
/// <param name="sqlProps">The <c>SqlProps</c> to use to execute the query</param>
|
||||
[<CompiledName "FSharpWriteJsonArray">]
|
||||
let writeJsonArray query parameters writer (mapFunc: RowReader -> string) sqlProps =
|
||||
@ -71,7 +71,7 @@ module Custom =
|
||||
/// <param name="query">The query to retrieve the results</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="mapFunc">The mapping function between the document and the domain item</param>
|
||||
/// <param name="mapFunc">The mapping function to extract the document</param>
|
||||
/// <param name="sqlProps">The <c>SqlProps</c> to use to execute the query</param>
|
||||
let WriteJsonArray(query, parameters, writer, mapFunc: System.Func<RowReader, string>, sqlProps) =
|
||||
writeJsonArray query parameters writer mapFunc.Invoke sqlProps
|
||||
@ -103,7 +103,7 @@ module Custom =
|
||||
/// <summary>Execute a query that returns one or no JSON documents</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>
|
||||
/// <param name="mapFunc">The mapping function to extract the document</param>
|
||||
/// <param name="sqlProps">The <c>SqlProps</c> to use to execute the query</param>
|
||||
/// <returns>The JSON document with the first matching result, or an empty document if not found</returns>
|
||||
[<CompiledName "FSharpJsonSingle">]
|
||||
@ -114,7 +114,7 @@ module Custom =
|
||||
/// <summary>Execute a query that returns one or no JSON documents</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>
|
||||
/// <param name="mapFunc">The mapping function to extract the document</param>
|
||||
/// <param name="sqlProps">The <c>SqlProps</c> to use to execute the query</param>
|
||||
/// <returns>The JSON document with the first matching result, or an empty document if not found</returns>
|
||||
let JsonSingle(query, parameters, mapFunc: System.Func<RowReader, string>, sqlProps) =
|
||||
@ -733,7 +733,6 @@ module Json =
|
||||
/// <param name="tableName">The table from which documents should be retrieved (may include schema)</param>
|
||||
/// <param name="writer">The StreamWriter to which the results should be written</param>
|
||||
/// <param name="sqlProps">The <c>SqlProps</c> to use to execute the query</param>
|
||||
/// <returns>All documents from the given table as a JSON array</returns>
|
||||
[<CompiledName "WriteAll">]
|
||||
let writeAll tableName writer sqlProps =
|
||||
Custom.writeJsonArray (Query.find tableName) [] writer jsonFromData sqlProps
|
||||
@ -757,7 +756,6 @@ module Json =
|
||||
/// <param name="writer">The StreamWriter to which the results should be written</param>
|
||||
/// <param name="orderFields">Fields by which the results should be ordered</param>
|
||||
/// <param name="sqlProps">The <c>SqlProps</c> to use to execute the query</param>
|
||||
/// <returns>All documents from the given table as a JSON array, ordered by the given fields</returns>
|
||||
[<CompiledName "WriteAllOrdered">]
|
||||
let writeAllOrdered tableName writer orderFields sqlProps =
|
||||
Custom.writeJsonArray
|
||||
@ -902,7 +900,7 @@ module Json =
|
||||
writer
|
||||
jsonFromData
|
||||
sqlProps
|
||||
|
||||
|
||||
/// <summary>Retrieve JSON 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="jsonPath">The JSON Path expression to match</param>
|
||||
|
Loading…
x
Reference in New Issue
Block a user