Document Storage on SQLite
Use SQLite3 (version 3.38.2 or higher) as a document database similar to the cosmos sdk, but in-process. This uses the JSON1 extensions that are now part of the core SQLite library, and this will use the FTS5 extensions to provide full text search over those json documents.
using var db = new SqliteConnection($"Data Source=:memory:");
db.Open();
var collection = new DoqCollection<MyClass>(db);
var item1 = new MyClass() { X = 1, Y = "row one" };
collection.Upsert(item1);
var item2 = new MyClass() { X = 1, Y = "row two" };
collection.Upsert(item2);
item1.Y = "change row one";
collection.Upsert(item1);
collection.Delete(item2);
foreach (var item in collection.Items)
{
WriteLine(item.ToJson());
}
// {"key":1,"x":1,"y":"change row one"}
- CRUD
- Linq
- Full text search
collection.Upsert(item1);
INSERT INTO myclass (key, body)
VALUES (1, json('{"key":1,"x":1,"y":"change row one"}'))
ON CONFLICT (key) DO UPDATE SET body = excluded.body
RETURNING key