Beispiel #1
0
func AllUrl() []Url {
	c := config.Config_collection(url_collection_name)
	defer c.Close()

	result := []Url{}
	c.Collection.Find(nil).All(&result)
	return result
}
Beispiel #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)
	}
}
Beispiel #3
0
// 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)
	}
}
Beispiel #4
0
// 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
}