GithubHelp home page GithubHelp logo

uretgec / mydb Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 26 KB

Boltdb and Sniper based simple disk with in memory storage unit

License: MIT License

Go 100.00%
bbolt boltdb sniper sniperdb databases storage-api

mydb's Introduction

MYDB

It is a storage package containing both in-memory and file-type databases that you can use to hold simple data.

Use:

  • bbolt: go.etcd.io/bbolt
  • sniper: github.com/recoilme/sniper

NOTE:

If use only boltdb, all key-value data are at in-memory and saves all data to snapshot file for recovery

If use only sniperdb, all index data are at in-memory and save all key-value data to file (multiple files) sniperdb have to use bboltdb index for list, prevlist, exist methods

You can use both db together without any problems.

## Examples

Example use go to mydb-server repository -> (https://github.com/uretgec/mydb-server)

Methods

	NewStore(bucketList, indexList []string, path string, dbName string, readOnly bool)
	CloseStore()
	SyncStore()

	Set(bucketName []byte, k []byte, data []byte) ([]byte, error)
	Get(bucketName []byte, k []byte) ([]byte, error)
	MGet(bucketName []byte, keys ...[]byte) (interface{}, error)
	List(bucketName []byte, cursor []byte, perpage int) ([]string, error)
	PrevList(bucketName []byte, cursor []byte, perpage int) ([]string, error)
	Delete(bucketName []byte, k []byte) error

	KeyExist(bucketName []byte, k []byte) (bool, error)
	ValueExist(bucketName []byte, v []byte) (bool, error)

	HasBucket(bucketName []byte) bool
	StatsBucket(bucketName []byte) int
	ListBucket(bucketName []byte) int
	DeleteBucket(bucketName []byte) int

	Backup(path, filename string) error
	Restore(path, filename string) error

Install

go get  github.com/uretgec/mydb

TODO

  • Add new examples

Links

Bbolt (https://github.com/etcd-io/bbolt)

Sniper (https://github.com/recoilme/sniper)

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.