P41.NoSQLite 0.3.0-beta.0

This is a prerelease version of P41.NoSQLite.
dotnet add package P41.NoSQLite --version 0.3.0-beta.0                
NuGet\Install-Package P41.NoSQLite -Version 0.3.0-beta.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="P41.NoSQLite" Version="0.3.0-beta.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add P41.NoSQLite --version 0.3.0-beta.0                
#r "nuget: P41.NoSQLite, 0.3.0-beta.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install P41.NoSQLite as a Cake Addin
#addin nuget:?package=P41.NoSQLite&version=0.3.0-beta.0&prerelease

// Install P41.NoSQLite as a Cake Tool
#tool nuget:?package=P41.NoSQLite&version=0.3.0-beta.0&prerelease                

NoSQLite: NoSQL on top of SQLite

Release NuGet MIT License

A thin wrapper above sqlite using the JSON1 apis turn it into a NOSQL database.

This library references and uses SQLitePCLRaw.bundle_e_sqlite3 version 2.1.2 and later witch ensures that the JSON1 APIS are present.

The library executes Batteries.Init(); for you when a connection is first initialized.

Getting Started

Create an instance of NoSQLiteConnection.

var connection = new NoSQLiteConnection(
    "path to database file", // Required
    json_options)            // Optional JsonSerializerOptions

The connection configures the PRAGMA journal_mode to be WAL

The connection manages an sqlite3 object when initialized. You should always dispose it when you are done so that the databases flashes WAL files but you can also ignore it ¯\ (ツ)/¯.

Tables

You get a table using connection.GetTable() you can optionaly provide a table name or leave it as it is to get the default documents table.

Tables are created if they do not exist.

Tables are managed by their connections so you don't have to worry about disposing. If you request a table multiple times (eg: the same name) you will always get the same Instance.

Document Management

Example class that will be used below:

public class Person
{
    public string Name { get; set; }
    public string Surname { get; set; }
    public string? Description { get; set; }
}
var connection = new NoSQLiteConnection("path to database file", "json options or null");
var docs = connection.GetTable();

Create/Update documents.

Creating or Updating a document happens from the same Insert method, keep in mind that this always replaces the document with the new one.

var panos = new Person
{
    Name = "panoukos",
    Surname = "41",
    Description = "C# dev"
}

docs.Insert("panos", panos); // If it exists it is now replaced/updated.

Get documents.

var doc = docs.Get<Person>("panos"); // Get the document or null.
Delete documents.
docs.Remove("panos"); // Will remove the document.
docs.Remove("panos"); // Will still succeed even if the document doesn't exist.

Build

To build this project .NET 7 is needed.

Contribute

Contributions are welcome and appreciated, before you create a pull request please open a GitHub Issue to discuss what needs changing and or fixing if the issue doesn't exist!

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.3.0-beta.0 97 7/15/2023
0.3.0-beta.-1 90 7/14/2023
0.2.0-beta.3 91 4/27/2023
0.2.0-beta.1 111 11/12/2022
0.1.0-beta.8 133 10/19/2022
0.1.0-beta.4 113 10/14/2022
0.1.0-beta.3 108 10/13/2022
0.1.0-beta.1 144 9/22/2022