fn parse_average(pair: Pair<'_, Rule>, mut query: &mut Query) {
    let mut inner = pair.into_inner();
    // parse the mandatory fields.
    let count_attr = inner.next().unwrap().as_str();
    let alias = inner.next().unwrap().as_str();
    let mut average = Average {
        attr: String::from(count_attr),
        alias: String::from(alias),
        by: None,
    };
    // parse if we have any group by.
    match inner.next() {
        Some(pair) => average.by = Some(String::from(pair.as_str())),
        None => {}
    }
    // update the average.
    query.average = Some(average);
    query.aggregation_exist = true;
}
/// parse_average will parse average group by.
parse_average will parse average group by.
parse_average will parse average group by .
fn parse_average(pair: Pair<'_, Rule>, mut query: &mut Query) {
    let mut inner = pair.into_inner();
    // parse the mandatory fields.
    let count_attr = inner.next().unwrap().as_str();
    let alias = inner.next().unwrap().as_str();
    let mut average = Average {
        attr: String::from(count_attr),
        alias: String::from(alias),
        by: None,
    };
    // parse if we have any group by.
    match inner.next() {
        Some(pair) => average.by = Some(String::from(pair.as_str())),
        None => {}
    }
    // update the average.
    query.average = Some(average);
    query.aggregation_exist = true;
}
fn parse_average ( pair : Pair < ' _ , Rule > , mut query : & mut Query ) { let mut inner = pair . into_inner ( ) ; // parse the mandatory fields. let count_attr = inner . next ( ) . unwrap ( ) . as_str ( ) ; let alias = inner . next ( ) . unwrap ( ) . as_str ( ) ; let mut average = Average { attr : String :: from ( count_attr ) , alias : String :: from ( alias ) , by : None , } ; // parse if we have any group by. match inner . next ( ) { Some ( pair ) => average . by = Some ( String :: from ( pair . as_str ( ) ) ) , None => { } } // update the average. query . average = Some ( average ) ; query . aggregation_exist = true ; }
parse_average will parse average group by.
parse_average will parse average group by .
pair
Pair<'_, Rule>
query
&mut Query