Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using badger as shown in readme does not work #154

Open
l0ngest opened this issue Sep 3, 2024 · 1 comment
Open

using badger as shown in readme does not work #154

l0ngest opened this issue Sep 3, 2024 · 1 comment

Comments

@l0ngest
Copy link

l0ngest commented Sep 3, 2024

Hi there, thanks in advance for your time. Looking at this part of the readme:

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

...

// by default, Bolt will be used internally
db, _ := c.Open("clover-db")

// 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

I have copy-pasted this exactly, but on this line:
store, _ := badgerstore.Open(badger.DefaultOptions("").WithInMemory(true)) // opens a badger in memory database

I get this error:
"Cannot use 'badger.DefaultOptions("").WithInMemory(true)' (type "github.com/dgraph-io/badger/v4".Options) as the type "github.com/dgraph-io/badger/v3".Options"

It appears that if I use badger v3 it works; however, given that the readme example uses badger v4 I spent a while thinking I've done something wrong. Is badger v4 not supported?

@ostafen
Copy link
Owner

ostafen commented Sep 3, 2024

Are you sure you are pulling the latest version?
Clover is using badger v4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants