summaryrefslogtreecommitdiff
path: root/system/db/content.go
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2016-12-06 15:08:22 -0800
committerSteve Manuel <nilslice@gmail.com>2016-12-06 15:08:22 -0800
commit650b67e118c6672c65f1b0fab684695284127e9b (patch)
treedebc6a1d90a38e80f839643ce35f98ec89498dd8 /system/db/content.go
parent054f01662788fb3bb7fd2808980e59c3a918e9e3 (diff)
substituting "_{specifier}" => "__{specifier}" so users can add their own types with "_" as a separator and not face conflicts
Diffstat (limited to 'system/db/content.go')
-rw-r--r--system/db/content.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/system/db/content.go b/system/db/content.go
index ef74091..74a77ec 100644
--- a/system/db/content.go
+++ b/system/db/content.go
@@ -39,11 +39,11 @@ func SetContent(target string, data url.Values) (int, error) {
}
func update(ns, id string, data url.Values) (int, error) {
- var specifier string // i.e. _pending, _sorted, etc.
- if strings.Contains(ns, "_") {
- spec := strings.Split(ns, "_")
+ var specifier string // i.e. __pending, __sorted, etc.
+ if strings.Contains(ns, "__") {
+ spec := strings.Split(ns, "__")
ns = spec[0]
- specifier = "_" + spec[1]
+ specifier = "__" + spec[1]
}
cid, err := strconv.Atoi(id)
@@ -82,11 +82,11 @@ func update(ns, id string, data url.Values) (int, error) {
func insert(ns string, data url.Values) (int, error) {
var effectedID int
- var specifier string // i.e. _pending, _sorted, etc.
- if strings.Contains(ns, "_") {
- spec := strings.Split(ns, "_")
+ var specifier string // i.e. __pending, __sorted, etc.
+ if strings.Contains(ns, "__") {
+ spec := strings.Split(ns, "__")
ns = spec[0]
- specifier = "_" + spec[1]
+ specifier = "__" + spec[1]
}
err := store.Update(func(tx *bolt.Tx) error {
@@ -328,7 +328,7 @@ func Query(namespace string, opts QueryOptions) (int, [][]byte) {
// Should be called from a goroutine after SetContent is successful
func SortContent(namespace string) {
// only sort main content types i.e. Post
- if strings.Contains(namespace, "_") {
+ if strings.Contains(namespace, "__") {
return
}
@@ -354,7 +354,7 @@ func SortContent(namespace string) {
// store in <namespace>_sorted bucket, first delete existing
err := store.Update(func(tx *bolt.Tx) error {
- bname := []byte(namespace + "_sorted")
+ bname := []byte(namespace + "__sorted")
err := tx.DeleteBucket(bname)
if err != nil {
return err