3

Currently using db.Update() to update the key-value in boltdb.

err := db.Update(func(tx *bolt.Tx) error {

    b, err := tx.CreateBucket([]byte("widgets"))
    if err != nil {
        return err
    }
    if err := b.Put([]byte("foo"), []byte("bar")); err != nil {
        return err
    }
    return nil
})

How to use db.Batch() operations using go routines?

thwd
  • 23,956
  • 8
  • 74
  • 108
Raunak Dugar
  • 247
  • 3
  • 14

1 Answers1

2

Just call db.Batch() from your goroutines. Batch() was created to be used this way. There is an example in documentation.

Marko Kevac
  • 2,902
  • 30
  • 47