mirror of
https://github.com/donl/gPanel.git
synced 2026-06-30 06:12:06 -06:00
deleting server users now works
This commit is contained in:
parent
a12a0e5073
commit
b9256cc335
6 changed files with 113 additions and 1 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue