douzhuo8312
2012-05-08 04:55
浏览 225
已采纳

如何在Go中使用LevelDB?

From http://code.google.com/p/leveldb/, it seems not explicit or easy to use LevelDB with Go. But I really want to know how to use it in Go.

Could anyone give me a clue?

图片转代码服务由CSDN问答提供 功能建议

来自 http://code.google.com/p/leveldb/ ,将LevelDB与Go一起使用似乎并不明显或不容易。 但是我真的很想知道如何在Go中使用它。

有人可以给我一个线索吗?

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

3条回答 默认 最新

  • dtnnpt11795 2012-05-08 06:05
    已采纳

    Use leveldb-go, ported by the Go Authors.

    打赏 评论
  • dongqian8265 2012-10-25 01:27

    Use levigo - a Golang wrapper around the C++ version of LevelDB.

    The file levigo/leveldb_test.go gives you an example of how to use levigo.

    打赏 评论
  • dongsicheng5262 2015-10-21 05:04

    Here is a Go implementation of LevelDB https://github.com/syndtr/goleveldb

    Here is how to use it:

    go get github.com/syndtr/goleveldb/leveldb
    

    Create or open database:

    db, err := leveldb.OpenFile("path/to/db", nil)
    ...
    defer db.Close()
    ...
    

    Read or modify the database content:

    data, err := db.Get([]byte("key"), nil)
    ...
    err = db.Put([]byte("key"), []byte("value"), nil)
    ...
    err = db.Delete([]byte("key"), nil)
    ...
    
    打赏 评论

相关推荐 更多相似问题