func SearchMoodle(url string, username string) (InfoMoodle, error) {
	var result InfoMoodle
	result.URL = url
	result.Username = username

	// Get the connection
	connection, err := db.GetDB()
	if err != nil {
		return result, err
	}

	// Query the DB
	rows, err := connection.Query(`
		SELECT id, password, wstoken, location, sitename, firstname, lastname, lang, userid, userpictureurl, previoushash, unhandlednotifications
		FROM moodles
		WHERE url=? AND username=?
	`, url, username)
	if err != nil {
		return result, err
	}
	defer rows.Close()

	// Get and save to the struct
	rows.Next()
	err = rows.Scan(
		&result.ID,
		&result.Password,
		&result.Token,
		&result.Location,
		&result.Sitename,
		&result.Firstname,
		&result.Lastname,
		&result.Lang,
		&result.Userid,
		&result.Userpictureurl,
		&result.Previoushash,
		&result.Unhandlednotifications)

	return result, err
}
// SearchMoodle returns the Moodle that corresponds to the arguments passed
SearchMoodle returns the Moodle that corresponds to the arguments passed
// SearchMoodle returns the Moodle that corresponds to the arguments passed
func SearchMoodle(url string, username string) (InfoMoodle, error) {
	var result InfoMoodle
	result.URL = url
	result.Username = username
	connection, err := db.GetDB()
	if err != nil {
		return result, err
	}
	rows, err := connection.Query(`
		SELECT id, password, wstoken, location, sitename, firstname, lastname, lang, userid, userpictureurl, previoushash, unhandlednotifications
		FROM moodles
		WHERE url=? AND username=?
	`, url, username)
	if err != nil {
		return result, err
	}
	defer rows.Close()
	rows.Next()
	err = rows.Scan(
		&result.ID,
		&result.Password,
		&result.Token,
		&result.Location,
		&result.Sitename,
		&result.Firstname,
		&result.Lastname,
		&result.Lang,
		&result.Userid,
		&result.Userpictureurl,
		&result.Previoushash,
		&result.Unhandlednotifications)
	return result, err
}
func SearchMoodle ( url string , username string ) ( InfoMoodle , error ) { var result InfoMoodle result . URL = url result . Username = username connection , err := db . GetDB ( ) if err != nil { return result , err } rows , err := connection . Query ( `
		SELECT id, password, wstoken, location, sitename, firstname, lastname, lang, userid, userpictureurl, previoushash, unhandlednotifications
		FROM moodles
		WHERE url=? AND username=?
	` , url , username ) if err != nil { return result , err } defer rows . Close ( ) rows . Next ( ) err = rows . Scan ( & result . ID , & result . Password , & result . Token , & result . Location , & result . Sitename , & result . Firstname , & result . Lastname , & result . Lang , & result . Userid , & result . Userpictureurl , & result . Previoushash , & result . Unhandlednotifications ) return result , err }
SearchMoodle returns the Moodle that corresponds to the arguments passed
SearchMoodle returns the Moodle that corresponds to the arguments passed
// Get the connection // Query the DB // Get and save to the struct