diff options
Diffstat (limited to 'system/db/query.go')
-rw-r--r-- | system/db/query.go | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/system/db/query.go b/system/db/query.go index 06e9c62..fd526f8 100644 --- a/system/db/query.go +++ b/system/db/query.go @@ -160,6 +160,21 @@ func Get(target string) ([]byte, error) { // GetAll retrives all items from the database within the provided namespace func GetAll(namespace string) [][]byte { + var posts [][]byte + store.View(func(tx *bolt.Tx) error { + b := tx.Bucket([]byte(namespace)) - return nil + len := b.Stats().KeyN + posts = make([][]byte, 0, len) + + b.ForEach(func(k, v []byte) error { + posts = append(posts, v) + + return nil + }) + + return nil + }) + + return posts } |