func SearchUser(url string, username string) (User, error) {
	var result User

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

	// Query the DB
	rows, err := connection.Query(`
		SELECT password, wstoken
		FROM moodles
		WHERE url=? AND username=?
	`, url, username)
	if err != nil {
		return result, err
	}
	defer rows.Close()

	// Get and save the first record
	rows.Next()
	err = rows.Scan(&result.Password, &result.Token)

	if err != nil {
		return result, err
	}

	// Add the missing params, this way it will only return a completely filled
	// object when it is successful
	result.URL = url
	result.Username = username

	return result, err
}
// SearchUser gets one user in the database that matches de parameters given
SearchUser gets one user in the database that matches de parameters given
// SearchUser gets one user in the database that matches de parameters given
func SearchUser(url string, username string) (User, error) {
	var result User
	connection, err := db.GetDB()
	if err != nil {
		return result, err
	}
	rows, err := connection.Query(`
		SELECT password, wstoken
		FROM moodles
		WHERE url=? AND username=?
	`, url, username)
	if err != nil {
		return result, err
	}
	defer rows.Close()
	rows.Next()
	err = rows.Scan(&result.Password, &result.Token)
	if err != nil {
		return result, err
	}
	result.URL = url
	result.Username = username
	return result, err
}
func SearchUser ( url string , username string ) ( User , error ) { var result User connection , err := db . GetDB ( ) if err != nil { return result , err } rows , err := connection . Query ( `
		SELECT password, wstoken
		FROM moodles
		WHERE url=? AND username=?
	` , url , username ) if err != nil { return result , err } defer rows . Close ( ) rows . Next ( ) err = rows . Scan ( & result . Password , & result . Token ) if err != nil { return result , err } result . URL = url result . Username = username return result , err }
SearchUser gets one user in the database that matches de parameters given
SearchUser gets one user in the database that matches de parameters given
// Get the connection // Query the DB // Get and save the first record // Add the missing params, this way it will only return a completely filled // object when it is successful