Switch to namespace from module for Sqlite
- Complete C# test migration
This commit is contained in:
parent
6ce619ac60
commit
a6d179d401
|
@ -1,5 +1,4 @@
|
||||||
/// Document store implementation for SQLite
|
namespace BitBadger.Documents.Sqlite
|
||||||
module BitBadger.Documents.Sqlite
|
|
||||||
|
|
||||||
open BitBadger.Documents
|
open BitBadger.Documents
|
||||||
open Microsoft.Data.Sqlite
|
open Microsoft.Data.Sqlite
|
||||||
|
@ -106,11 +105,14 @@ module Results =
|
||||||
ToCustomList<'TDoc>(cmd, fromData<'TDoc>)
|
ToCustomList<'TDoc>(cmd, fromData<'TDoc>)
|
||||||
|
|
||||||
|
|
||||||
/// Execute a non-query command
|
[<AutoOpen>]
|
||||||
let internal write (cmd: SqliteCommand) = backgroundTask {
|
module internal Helpers =
|
||||||
let! _ = cmd.ExecuteNonQueryAsync()
|
|
||||||
()
|
/// Execute a non-query command
|
||||||
}
|
let internal write (cmd: SqliteCommand) = backgroundTask {
|
||||||
|
let! _ = cmd.ExecuteNonQueryAsync()
|
||||||
|
()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Versions of queries that accept a SqliteConnection as the last parameter
|
/// Versions of queries that accept a SqliteConnection as the last parameter
|
||||||
|
@ -373,17 +375,21 @@ module Definition =
|
||||||
use conn = Configuration.dbConn ()
|
use conn = Configuration.dbConn ()
|
||||||
WithConn.Definition.ensureTable name conn
|
WithConn.Definition.ensureTable name conn
|
||||||
|
|
||||||
/// Insert a new document
|
/// Document insert/save functions
|
||||||
[<CompiledName "Insert">]
|
[<AutoOpen>]
|
||||||
let insert<'TDoc> tableName (document: 'TDoc) =
|
module Document =
|
||||||
use conn = Configuration.dbConn ()
|
|
||||||
WithConn.insert tableName document conn
|
/// Insert a new document
|
||||||
|
[<CompiledName "Insert">]
|
||||||
|
let insert<'TDoc> tableName (document: 'TDoc) =
|
||||||
|
use conn = Configuration.dbConn ()
|
||||||
|
WithConn.insert tableName document 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")
|
||||||
[<CompiledName "Save">]
|
[<CompiledName "Save">]
|
||||||
let save<'TDoc> tableName (document: 'TDoc) =
|
let save<'TDoc> tableName (document: 'TDoc) =
|
||||||
use conn = Configuration.dbConn ()
|
use conn = Configuration.dbConn ()
|
||||||
WithConn.save tableName document conn
|
WithConn.save tableName document conn
|
||||||
|
|
||||||
/// Commands to count documents
|
/// Commands to count documents
|
||||||
[<RequireQualifiedAccess>]
|
[<RequireQualifiedAccess>]
|
||||||
|
@ -613,6 +619,7 @@ module Extensions =
|
||||||
open System.Runtime.CompilerServices
|
open System.Runtime.CompilerServices
|
||||||
|
|
||||||
/// C# extensions on the SqliteConnection type
|
/// C# extensions on the SqliteConnection type
|
||||||
|
[<Extension>]
|
||||||
type SqliteConnectionCSharpExtensions =
|
type SqliteConnectionCSharpExtensions =
|
||||||
|
|
||||||
/// Execute a query that returns a list of results
|
/// Execute a query that returns a list of results
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -3,7 +3,7 @@ namespace BitBadger.Documents.Tests;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using static Sqlite;
|
using Sqlite;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A throwaway SQLite database file, which will be deleted when it goes out of scope
|
/// A throwaway SQLite database file, which will be deleted when it goes out of scope
|
||||||
|
|
|
@ -7,7 +7,7 @@ let allTests =
|
||||||
[ CommonTests.all
|
[ CommonTests.all
|
||||||
CommonCSharpTests.Unit
|
CommonCSharpTests.Unit
|
||||||
SqliteTests.all
|
SqliteTests.all
|
||||||
testSequenced SqliteCSharpTests.Integration ]
|
SqliteCSharpTests.All ]
|
||||||
|
|
||||||
[<EntryPoint>]
|
[<EntryPoint>]
|
||||||
let main args = runTestsWithCLIArgs [] args allTests
|
let main args = runTestsWithCLIArgs [] args allTests
|
||||||
|
|
Loading…
Reference in New Issue
Block a user