diff options
author | Steve Manuel <nilslice@gmail.com> | 2016-10-18 13:39:00 -0700 |
---|---|---|
committer | Steve Manuel <nilslice@gmail.com> | 2016-10-18 13:39:00 -0700 |
commit | 030d3eb0fc6e2cb22d7ba7c1cf1744592deebbf4 (patch) | |
tree | 84efe7666c32c595cd57d931f7ec4a93f3dfe699 | |
parent | 9a77a3614dcd44d90180aa3971d6ca56788b6a0d (diff) |
using ref of post in sort storage and updating db key for stored post
-rw-r--r-- | system/db/content.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/system/db/content.go b/system/db/content.go index a7510ab..35f690f 100644 --- a/system/db/content.go +++ b/system/db/content.go @@ -245,14 +245,14 @@ func SortContent(namespace string) { return err } - // encode to json and store as post.Time():post - for _, post := range posts { - j, err := json.Marshal(post) + // encode to json and store as i-post.Time():post + for i := range posts { + j, err := json.Marshal(posts[i]) if err != nil { return err } - cid := fmt.Sprintf("%d-%d", post.Time(), post.ContentID()) + cid := fmt.Sprintf("%d:%d", i, posts[i].Time()) err = b.Put([]byte(cid), j) if err != nil { err := tx.Rollback() |