Skip to content

memmaker/go-ejdb2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Wrapper / Bindings for EJDB

I found this neat little embeddable DB and wanted to use it in go.

Requirements

Make sure you have the dev headers of ejdb.

cgo will be looking for these header files during compilation:

  • stdlib.h
  • ejdb2/ejdb2.h
  • ejdb2/iowow/iwkv.h

Add to your project

go get github.com/memmaker/go-ejdb2/v2

Example usage

package main

import (
    "fmt"
    "github.com/memmaker/go-ejdb2/v2"
)

func main() {
    db := ejdb2.EJDB{}
    db.Open("test.database")
    defer db.Close()
    db.EnsureCollection("users")
    id := db.PutNew("users", `{"name": "John", "age": 30}`)
    fmt.Println("New record ID:", id)
    user := db.GetByID("users", id)
    fmt.Println(user)
}

Documentation

Please refer to the ejdb2 documentation for more information:

About

A simple wrapper around EJDB2 for go

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages