Пример #1
0
func LongURL(short string, tde *kv.TiedotEngine) (*Shortened, error) {
	// ignore the ID for now, we don't really need it
	out := new(Shortened)
	_, err := tde.Query("short.url").Equals(kv.Path{"Short"}, base62.DecodeString(short)).OneInto(out)
	log.Infof("Read one into %+v error:%v", out, err)
	if err != nil {
		return nil, err
	}
	return out, nil
}
Пример #2
0
func (t *TiedotEngine) AddIndex(collection string, path Path) {
	c := t.tiedot.Use(collection)
	tdPath := strings.Join(path, tiedot.INDEX_PATH_SEP)
	if _, ok := c.SecIndexes[tdPath]; ok {
		log.Infof("Index on path:%v already exists for collection:%s", tdPath, collection)
		return
	}
	log.V(3).Infof("Adding index on path:%v to collection:%s", tdPath, collection)
	err := c.Index(path)
	log.FatalIfErr(err, "Failure creating index on collection:"+collection)
}