Skip to content

Commit

Permalink
Add info on how to list existing buckets
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikKalkoken committed Aug 25, 2024
1 parent 6e354be commit 32eef50
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,17 @@ guarantee that they exist for future transactions.

To delete a bucket, simply call the `Tx.DeleteBucket()` function.

You can also iterate over all existing buckets with `Tx.forEach()`:

```go
db.View(func(tx *bolt.Tx) error {
tx.ForEach(func(name []byte, b *bolt.Bucket) error {
fmt.Println(string(name))
return nil
})
return nil
})
```

### Using key/value pairs

Expand Down

0 comments on commit 32eef50

Please sign in to comment.