Giter Club home page Giter Club logo

ejdb2-csharp's Introduction

EJDB2 .NET binding

Embeddable JSON Database engine http://ejdb.org .NET binding (.NET Standard 2.0).

See https://github.com/Softmotions/ejdb/blob/master/README.md

For API usage examples take a look into examples and tests.

Minimal example

var options = new EJDB2OptionsBuilder("example.db")
    .Truncate().GetOptions();

using var db = new EJDB2(options);

long id = db.Put("parrots", "{\"name\":\"Bianca\", \"age\": 4}");
Console.WriteLine("Bianca record: {0}", id);

id = db.Put("parrots", "{\"name\":\"Darko\", \"age\": 8}");
Console.WriteLine("Darko record: {0}", id);

db.CreateQuery("@parrots/[age > :age]").SetLong("age", 3)
    .Execute((docId, doc) => {
        Console.WriteLine("Found {0}: {1}", docId, doc);
        return 1;
    });
    
// see also JQLExtensions in examples project
var query = db.CreateQuery("@parrots/[age > :age]").SetLong("age", 3);
await foreach (var (docId, doc) in query.ToAsyncEnumerable())
{
    Console.WriteLine("Found {0}: {1}", docId, doc);
}

Supported platforms

  • Linux x64
  • Windows x64

How to build it manually

Linux

git clone https://github.com/kmvi/ejdb2-csharp
cd ejdb2-csharp
dotnet build

Windows

  • Clone ejdb repo
  • Apply the patch:
diff --git a/cmake/Modules/AddIOWOW.cmake b/cmake/Modules/AddIOWOW.cmake
index ce674bc8..ed034e06 100644
--- a/cmake/Modules/AddIOWOW.cmake
+++ b/cmake/Modules/AddIOWOW.cmake
@@ -19,13 +19,13 @@ endif()
 if (IOS)
   set(BYPRODUCT "${CMAKE_BINARY_DIR}/lib/libiowow-1.a")
 else()
-  set(BYPRODUCT "${CMAKE_BINARY_DIR}/src/extern_iowow-build/src/libiowow-1.a")
+  set(BYPRODUCT "${CMAKE_BINARY_DIR}/src/extern_iowow-build/src/libiowow.dll.a")
 endif()

 set(CMAKE_ARGS  -DOWNER_PROJECT_NAME=${PROJECT_NAME}
                 -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
                 -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}
-                -DBUILD_SHARED_LIBS=OFF
+                -DBUILD_SHARED_LIBS=ON
                 -DBUILD_EXAMPLES=OFF)

 foreach(extra CMAKE_TOOLCHAIN_FILE
  • Build both EJDB2 and iowow as shared libraries (guide)
  • Build ejdb2-csharp:
git clone https://github.com/kmvi/ejdb2-csharp
cd ejdb2-csharp
dotnet build

Run example

Windows only: copy libejdb2.dll and libiowow.dll in examples\bin\{Configuration}\net5.0 directory.

cd examples
dotnet run

Run tests

Windows only: copy libejdb2.dll and libiowow.dll in tests\bin\{Configuration}\net5.0 directory.

cd tests
dotnet test

ejdb2-csharp's People

Contributors

kmvi avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

achoy

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.