storm icon indicating copy to clipboard operation
storm copied to clipboard

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

Open eschizoid opened this issue 5 years ago • 3 comments

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

eschizoid avatar Nov 29 '18 02:11 eschizoid

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

asdine avatar Dec 22 '18 20:12 asdine

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)
}

eschizoid avatar Dec 31 '18 23:12 eschizoid

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.

sh0umik avatar Nov 06 '19 23:11 sh0umik