Categorygithub.com/albertollamaso/nimbus
modulepackage
0.1.0
Repository: https://github.com/albertollamaso/nimbus.git
Documentation: pkg.go.dev

# README

Nimbus

PkgGoDev

Nimbus is a library for simplify the usage of Badger key-value (KV) database.

Goals of this project

  • Have fun and learn a lot
  • Implement an abstraction of Badger capabilities with little improvements

Usage

Using Nimbus is easy. First, use go get to install the latest version of the library.

go get -u github.com/albertollamaso/nimbus@latest

Next, include Nimbus in your application:

import "github.com/albertollamaso/nimbus"

Examples

  • Add a key value pair
package main

import (
	"fmt"
	"github.com/albertollamaso/nimbus"
)

func main() {

	db, err := nimbus.InitDB("db")
	if err != nil {
		fmt.Println(err)
	}

	defer db.Close()

	err = nimbus.AddKV(db, "[email protected]", "MyWeakPassword")
	if err != nil {
		fmt.Println(err)
	}
}


  • Remove a key value pair
package main

import (
	"fmt"
	"github.com/albertollamaso/nimbus"
)

func main() {

	db, err := nimbus.InitDB("db")
	if err != nil {
		fmt.Println(err)
	}

	defer db.Close()

	err = nimbus.RemoveKV(db, "[email protected]")
	if err != nil {
		fmt.Println(err)
		fmt.Println("couldn't delete key [email protected] that is not in the database")
		fmt.Println("-----------------------------")
	} else {
		fmt.Println("key: [email protected] has been removed")
		fmt.Println("-----------------------------")
	}
}

  • Read the value for a given key
package main

import (
	"fmt"
	"github.com/albertollamaso/nimbus"
)

func main() {

	db, err := nimbus.InitDB("db")
	if err != nil {
		fmt.Println(err)
	}

	defer db.Close()

	value, err := nimbus.ReadKV(db, "[email protected]")
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println("value of [email protected] is: ", value)
	fmt.Println("-----------------------------")
}

  • List all key value pairs from the database
package main

import (
	"fmt"
	"github.com/albertollamaso/nimbus"
)

func main() {

	db, err := nimbus.InitDB("db")
	if err != nil {
		fmt.Println(err)
	}

	defer db.Close()

	valuesAfter, err := nimbus.ListKV(db)
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println("all KV pairs in database are:")
	for k, v := range valuesAfter {
		fmt.Println(k, v)
	}
}

TODO

  • Remove prefix (bulk)
  • Prometheus exporter
  • pub/sub mechanism
  • Message broker implementation like AMQP
  • In-Memory Mode/Diskless Mode
  • Encryption Mode
  • Merge Operations
  • Setting Time To Live(TTL)
  • Support User Metadata on Keys
  • Prefix scans
  • Key-only iteration
  • Stream

Licence

Nimbus is released under the Apache 2.0 license. See LICENSE.txt

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author