diff options
author | Steve <nilslice@gmail.com> | 2017-01-02 11:58:56 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-02 11:58:56 -0800 |
commit | 6f0d53777bcc792099113c7dbd1e5f0b012be562 (patch) | |
tree | c148636f245bb1efd4ce5b1f597519038da9816c /system/db/content.go | |
parent | 806fdbe1e8839feb1bcc4e5e07aa7c144a429901 (diff) | |
parent | ae7d01f3aae28797f3b9ebc67be843763a02da6d (diff) |
Merge pull request #27 from ponzu-cms/ponzu-dev
[core] HTTP/2 Server Push for referenced items, Hideable interface
Diffstat (limited to 'system/db/content.go')
-rw-r--r-- | system/db/content.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/system/db/content.go b/system/db/content.go index 8bc76a6..dc4477f 100644 --- a/system/db/content.go +++ b/system/db/content.go @@ -229,11 +229,11 @@ func Content(target string) ([]byte, error) { // ContentBySlug does a lookup in the content index to find the type and id of // the requested content. Subsequently, issues the lookup in the type bucket and -// returns the data at that ID or nil if nothing exists. -func ContentBySlug(slug string) ([]byte, error) { +// returns the the type and data at that ID or nil if nothing exists. +func ContentBySlug(slug string) (string, []byte, error) { val := &bytes.Buffer{} + var t, id string err := store.View(func(tx *bolt.Tx) error { - var t, id string b := tx.Bucket([]byte("__contentIndex")) idx := b.Get([]byte(slug)) @@ -256,10 +256,10 @@ func ContentBySlug(slug string) ([]byte, error) { return nil }) if err != nil { - return nil, err + return t, nil, err } - return val.Bytes(), nil + return t, val.Bytes(), nil } // ContentAll retrives all items from the database within the provided namespace |