示例#1
0
//Get returns rawnodelist associated with datfile
//if not found returns def
func Get(datfile string, def node.Slice) node.Slice {
	str := GetNodestrSliceInTable(datfile)
	if str == nil {
		return def
	}
	return node.NewSlice(str)
}
示例#2
0
//getAllNodes returns all nodes in table.
func getAllNodes() node.Slice {
	var r []string
	err := db.DB.View(func(tx *bolt.Tx) error {
		var err error
		r, err = db.KeyStrings(tx, "lookupA")
		return err
	})
	if err != nil {
		log.Print(err)
		return nil
	}
	return node.NewSlice(r)
}