Version 2.1 #41

Merged
danieljsummers merged 123 commits from version-2.1 into main 2024-03-27 00:13:28 +00:00
3 changed files with 14 additions and 6 deletions
Showing only changes of commit dee2222eb1 - Show all commits

View File

@ -14,11 +14,7 @@ type PostgresData(log: ILogger<PostgresData>, ser: JsonSerializer) =
/// Create any needed tables
let ensureTables () = backgroundTask {
// Set up the PostgreSQL document store
Configuration.useSerializer
{ new IDocumentSerializer with
member _.Serialize<'T>(it: 'T) : string = Utils.serialize ser it
member _.Deserialize<'T>(it: string) : 'T = Utils.deserialize ser it
}
Configuration.useSerializer (Utils.createDocumentSerializer ser)
let! tables =
Custom.list "SELECT tablename FROM pg_tables WHERE schemaname = 'public'" []

View File

@ -15,7 +15,9 @@ type SQLiteData(conn: SqliteConnection, log: ILogger<SQLiteData>, ser: JsonSeria
/// Create tables (and their associated indexes) if they do not exist
let ensureTables () = backgroundTask {
Configuration.useSerializer (Utils.createDocumentSerializer ser)
let! tables = conn.customList<string> "SELECT name FROM sqlite_master WHERE type = 'table'" [] _.GetString(0)
let needsTable table =

View File

@ -50,6 +50,16 @@ let serialize<'T> ser (item: 'T) =
let deserialize<'T> (ser: JsonSerializer) value =
JsonConvert.DeserializeObject<'T>(value, Json.settings ser)
open BitBadger.Documents
/// Create a document serializer using the given JsonSerializer
let createDocumentSerializer ser =
{ new IDocumentSerializer with
member _.Serialize<'T>(it: 'T) : string = serialize ser it
member _.Deserialize<'T>(it: string) : 'T = deserialize ser it
}
open Microsoft.Extensions.Logging
/// Log a migration step