Update to new doc library

Still need to remove deprecated calls
This commit is contained in:
2024-08-19 20:30:33 -04:00
parent f4be57b665
commit cd450a05e5
15 changed files with 83 additions and 63 deletions
+5 -4
View File
@@ -229,6 +229,7 @@ let webLogParam (webLogId: WebLogId) =
open BitBadger.Documents
open BitBadger.Documents.Sqlite
open BitBadger.Documents.Sqlite.Compat
open BitBadger.Documents.Sqlite.WithConn
/// Functions for manipulating documents
@@ -243,11 +244,11 @@ module Document =
/// A SELECT query to count documents for a given web log ID
let countByWebLog table =
$"{Query.Count.all table} WHERE {whereByWebLog}"
Query.statementWhere (Query.count table) whereByWebLog
/// A query to select from a table by the document's ID and its web log ID
let selectByIdAndWebLog table =
$"{Query.Find.byId table} AND {whereByWebLog}"
Query.statementWhere (Query.find table) $"""{Query.whereById "@id"} AND {whereByWebLog}"""
/// A query to select from a table by its web log ID
let selectByWebLog table =
@@ -255,7 +256,7 @@ module Document =
/// Count documents for the given web log ID
let countByWebLog table (webLogId: WebLogId) conn = backgroundTask {
let! count = Count.byField table (Field.EQ "WebLogId" (string webLogId)) conn
let! count = Count.byFields table Any [ Field.EQ "WebLogId" (string webLogId) ] conn
return int count
}
@@ -265,7 +266,7 @@ module Document =
/// Find documents for the given web log
let findByWebLog<'TDoc> table (webLogId: WebLogId) conn =
Find.byField<'TDoc> table (Field.EQ "WebLogId" (string webLogId)) conn
Find.byFields<'TDoc> table Any [ Field.EQ "WebLogId" (string webLogId) ] conn
/// Functions to support revisions