本站源代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Mura Li d77176912b Use Go1.11 module (#5743) преди 5 години
..
config Use Go1.11 module (#5743) преди 5 години
store add other session providers (#5963) преди 5 години
.gitignore Use Go1.11 module (#5743) преди 5 години
LICENSE add other session providers (#5963) преди 5 години
README.md Use Go1.11 module (#5743) преди 5 години
README_CN.md Use Go1.11 module (#5743) преди 5 години
batch.go add other session providers (#5963) преди 5 години
binlog.go add other session providers (#5963) преди 5 години
binlog_util.go add other session providers (#5963) преди 5 години
const.go add other session providers (#5963) преди 5 години
doc.go add other session providers (#5963) преди 5 години
dump.go add other session providers (#5963) преди 5 години
info.go add other session providers (#5963) преди 5 години
multi.go add other session providers (#5963) преди 5 години
nodb.go add other session providers (#5963) преди 5 години
nodb_db.go add other session providers (#5963) преди 5 години
replication.go add other session providers (#5963) преди 5 години
scan.go add other session providers (#5963) преди 5 години
t_bit.go add other session providers (#5963) преди 5 години
t_hash.go add other session providers (#5963) преди 5 години
t_kv.go add other session providers (#5963) преди 5 години
t_list.go add other session providers (#5963) преди 5 години
t_set.go add other session providers (#5963) преди 5 години
t_ttl.go add other session providers (#5963) преди 5 години
t_zset.go add other session providers (#5963) преди 5 години
tx.go add other session providers (#5963) преди 5 години
util.go add other session providers (#5963) преди 5 години

README.md

NoDB

中文

Nodb is a fork of ledisdb and shrink version. It’s get rid of all C or other language codes and only keep Go’s. It aims to provide a nosql database library rather than a redis like server. So if you want a redis like server, ledisdb is the best choose.

Nodb is a pure Go and high performance NoSQL database library. It supports some data structure like kv, list, hash, zset, bitmap, set.

Nodb now use goleveldb as backend to store data.

Features

  • Rich data structure: KV, List, Hash, ZSet, Bitmap, Set.
  • Stores lots of data, over the memory limit.
  • Supports expiration and ttl.
  • Easy to embed in your own Go application.

Install

go get github.com/lunny/nodb

Package Example

Open And Select database

import(
  "github.com/lunny/nodb"
  "github.com/lunny/nodb/config"
)

cfg := new(config.Config)
cfg.DataDir = "./"
dbs, err := nodb.Open(cfg)
if err != nil {
  fmt.Printf("nodb: error opening db: %v", err)
}

db, _ := dbs.Select(0)

KV

KV is the most basic nodb type like any other key-value database.

err := db.Set(key, value)
value, err := db.Get(key)

List

List is simply lists of values, sorted by insertion order. You can push or pop value on the list head (left) or tail (right).

err := db.LPush(key, value1)
err := db.RPush(key, value2)
value1, err := db.LPop(key)
value2, err := db.RPop(key)

Hash

Hash is a map between fields and values.

n, err := db.HSet(key, field1, value1)
n, err := db.HSet(key, field2, value2)
value1, err := db.HGet(key, field1)
value2, err := db.HGet(key, field2)

ZSet

ZSet is a sorted collections of values. Every member of zset is associated with score, a int64 value which used to sort, from smallest to greatest score. Members are unique, but score may be same.

n, err := db.ZAdd(key, ScorePair{score1, member1}, ScorePair{score2, member2})
ay, err := db.ZRangeByScore(key, minScore, maxScore, 0, -1)

Thanks

Gmail: siddontang@gmail.com

上海开阖软件有限公司 沪ICP备12045867号-1