//AddTX saves tag strings. func AddTX(tx *bolt.Tx, thread string, tag []string) error { for _, t := range tag { if err := db.PutMap(tx, "usertag", []byte(thread), t); err != nil { return err } if err := db.PutMap(tx, "usertagTag", []byte(t), thread); err != nil { return err } } return nil }
//AppendToTableTX add node n to table if it is allowd and list doesn't have it. func AppendToTableTX(tx *bolt.Tx, datfile string, n *node.Node) { if !appendable(datfile, n) { return } err := db.PutMap(tx, "lookupT", []byte(datfile), n.Nodestr) if err != nil { log.Print(err) } err = db.PutMap(tx, "lookupA", []byte(n.Nodestr), datfile) if err != nil { log.Print(err) } }
//AddString adds tags to datfile from tagstrings. func AddString(tx *bolt.Tx, datfile string, vals []string) { for _, v := range vals { if !tag.IsOK(v) { continue } if err := db.PutMap(tx, "sugtag", []byte(datfile), v); err != nil { log.Print(err) } } }