ostafen / clover

A lightweight document-oriented NoSQL database written in pure Golang.
MIT License
633 stars 54 forks source link

need update readme #134

Open jyno12 opened 10 months ago

jyno12 commented 10 months ago
import (
  "log"
  "github.com/dgraph-io/badger/v3"
  c "github.com/ostafen/clover"
  badgerstore "github.com/ostafen/store/badger"
)

these example code in readme file cause some error. github.com/ostafen/storedosen't exist now. We can use the code in the db_test file as follows

    "github.com/dgraph-io/badger/v3"
    c "github.com/ostafen/clover/v2"
    badgerstore "github.com/ostafen/clover/v2/store/badger"
ostafen commented 10 months ago

Can you send a PR?

EdwinWalela commented 9 months ago

Running the sample code on the README

import (
    "github.com/dgraph-io/badger/v4"
    c "github.com/ostafen/clover"
    badgerstore "github.com/ostafen/store/badger"
)

func main() {
       // use OpenWithStore() if you want to select a different storage backend
    store, _ := badgerstore.Open(badger.DefaultOptions("").WithInMemory(true)) // opens a badger in memory database
    db, _ := c.OpenWithStore(store)

    defer db.Close() // remember to close the db when you have done
}

Output

main.go:5:2: no required module provides package github.com/ostafen/clover; to add it:
        go get github.com/ostafen/clover
main.go:6:2: no required module provides package github.com/ostafen/store/badger; to add it:

However, changing the import statement to

import (
    "github.com/dgraph-io/badger/v4"
    c "github.com/ostafen/clover/v2"
    badgerstore "github.com/ostafen/clover/v2/store/badger"
)

The packages are imported correctly. I can send in a PR if need be