denismitr / lemon

LemonDB embedded document oriented database in GO

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LemonDB

Work in Progress

Attention! The project is under intensive development. The API can still change without backwards compatibility.

A document oriented database which can store strings, BLOBs and JSON documents (as tagged structs or bytes or JSON strings) and is meant for local (non distributed) usage as it stores everything in one file or can work fully in memory. Ideally suits cli or desktop applications, non distributed pipelines or testing frameworks.

All data is stored on disk in format based on RESP encoding. But it is not exactly RESP.

LemonDB supports transactions. Reads are concurrent and writes are executed under exclusive lock.

Primary keys

Keys can contain any alpha-numeric characters, dashes and underscored. : can be used as key segments separators to be used in pattern matching - like user:*. Also, it helps correct sorting when some segments of a key are integer numbers. Like user:123:products

Tags (secondary indexes)

Any document can be tagged by an arbitrary number of tags. Queries can use these tags for filtering and sorting of results.

Tags in LemonDB are basically secondary indexes of 4 basic types float64, int, string, boolean.

Usage

Create/open a lemonDB database file

db, closer, err := lemon.Open("./mydb.ldb")
if err != nil {
	// handle
}

defer func() {
    if err := closer(); err != nil {
        log.Println(err)
    }
}()

if you pass lemon.InMemory as the first argument to lemon.Open database will work purely as in memory database and will not persist anything to disk.

Road map

  • Github Actions
  • Lazy load values
  • Storage cache buffer
  • LemonDB server
  • lemonDB Raft

About

LemonDB embedded document oriented database in GO


Languages

Language:Go 72.0%Language:HTML 27.6%Language:Makefile 0.3%