ostafen / clover

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

Fix auto create db dir #123

Closed Shane-XB-Qian closed 3 months ago

Shane-XB-Qian commented 1 year ago
  1. adding util existing check func
  2. make bbolt.Open() auto create db dir if not exist
  3. adding test for that
  4. modify example for it
Shane-XB-Qian commented 1 year ago

db.Open() said that : // Open opens a new clover database on the supplied path. If such a folder doesn't exist, it is automatically created.


and seems badger would auto do that.

ostafen commented 1 year ago

@Shane-XB-Qian, maybe we can do that in the main Open() function directly, so that we don't have to implement it for each possible storage engine. What do you think?

Shane-XB-Qian commented 1 year ago

that we don't have to implement it for each possible storage engine

yes and no, just because it really different on stores, per a just rough code check seems badger would auto create it by itself, // and if inMemory (it supports) it actually regardingless dir, but bbolt had to do it in user side, so i thought just make sure it do have done/created it.

riebers-m commented 3 months ago

When will this change be merge in the upstream branch? I hit this problem yesterday and found no further information because the Open function says that it will create a new folder if it doesnt exist. Very confusing for people new to clover.