Example #1
0
File: url.go Project: shingara/goup
func AllUrl() []Url {
	c := config.Config_collection(url_collection_name)
	defer c.Close()

	result := []Url{}
	c.Collection.Find(nil).All(&result)
	return result
}
Example #2
0
// Insert this url with url pass in args
// TODO: Need valid Url
func AddCheck(check *Check) {
	c := config.Config_collection(check_collection_name)
	defer c.Close()

	err := c.Collection.Insert(check)
	if err != nil {
		panic(err)
	}
}
Example #3
0
File: url.go Project: shingara/goup
// Insert this url with url pass in args
// TODO: Need valid Url
func AddUrl(url *Url) {
	c := config.Config_collection(url_collection_name)
	defer c.Close()

	err := c.Collection.Insert(url)
	if err != nil {
		panic(err)
	}
}
Example #4
0
File: url.go Project: shingara/goup
// Get the url with this url pass in args
func GetUrl(url string) *Url {
	c := config.Config_collection(url_collection_name)
	defer c.Close()

	result := &Url{}
	err := c.Collection.Find(bson.M{"url": url}).One(&result)
	if err != nil {
		panic(err)
	}
	return result
}