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

clover.Open("path") doesn't make the directory automatically if not found in clover/v2 #158

Open
ahmed-hossam28 opened this issue Sep 23, 2024 · 4 comments

Comments

@ahmed-hossam28
Copy link
Contributor

package main
import (
	//c1 "github.com/ostafen/clover"
	c2 "github.com/ostafen/clover/v2"
        "log"
)
func main() {
	//db1, err := c1.Open("clover-db") // this works fine and create it automatically if not found 
	db2, err := c2.Open("clover-db2")// this will complain that clover-db2 directory not found
	if err != nil {
		log.Fatal(err)
	}
}

Hi, i was trying to use clover a bit for testing purposes but when trying to open database using the first version it works fine and create directory for database automatically.
but when using v2 it doesn't work that way as it doesn't make the directory automatically and gives this error if not created beforehand.
2024/09/23 21:57:23 open clover-db2/data.db: no such file or directory
so i wonder what is the difference between the two versions?

@ostafen
Copy link
Owner

ostafen commented Sep 24, 2024

In the V2, boltdb is used by default. It looks like the bolt driver doesn't automatically create the folder, so just make sure it exists before opening your database

@Shane-XB-Qian
Copy link
Contributor

Shane-XB-Qian commented Sep 24, 2024 via email

@ahmed-hossam28
Copy link
Contributor Author

In the V2, boltdb is used by default. It looks like the bolt driver doesn't automatically create the folder, so just make sure it exists before opening your database

I see, so that's how it works.

@ahmed-hossam28
Copy link
Contributor Author

On 24/09/23 12:11PM, Ahmed Hossam wrote: so i wonder what is the difference between the two versions?
did you update your v2 clover? seems #123 solved for that. 😄

-- shane.xb.qian

@Shane-XB-Qian , how can i do that ? i just did go get github.com/ostafen/clover/v2 wouldn't it get the latest?

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

3 participants