deleting server users now works

This commit is contained in:
George Shaw 2017-12-01 16:17:16 -06:00
parent a12a0e5073
commit b9256cc335
6 changed files with 113 additions and 1 deletions

View file

@ -122,3 +122,20 @@ func (ds *Datastore) Delete(bucket string, key []byte) error {
return tx.Bucket([]byte(bucket)).Delete(key)
})
}
func (ds *Datastore) Count(bucket string) (int, error) {
count := 0
ds.handle.View(func(tx *bolt.Tx) error {
b := tx.Bucket([]byte(bucket))
c := b.Cursor()
for k, _ := c.First(); k != nil; k, _ = c.Next() {
count++
}
return nil
})
return count, nil
}