asdine / storm

Simple and powerful toolkit for BoltDB
MIT License
2.07k stars 139 forks source link

Is there a way to get all the keys from bucket using storm toolkit? #239

Open eschizoid opened 6 years ago

eschizoid commented 6 years ago

I would like to get all the the elements of a bucket without knowing the key.

Something like the following:

https://github.com/bobintornado/boltdb-boilerplate/blob/master/boilerplate.go#L91

asdine commented 5 years ago

You can use the All method: https://github.com/asdine/storm#fetch-all-objects

eschizoid commented 5 years ago

That feature appears not to be working for buckets. I ended up doing something like the following :(

for _, key := range keys {
    var item AnyItem
    err := db.Get("test_bucket", key, &item)
    list := append(list, item)
}
sh0umik commented 5 years ago

Yes there is not All form Bucket its confusing . If I use Get and Set it requires a bucket name . So All method should have a bucket name. Or another Method like AllFromBucket is needed.