fn try_initialize(client: &mut Client, check: &Check) -> bool {
    let mut success = true;
    if !check.enabled {
        info!("skipping disabled query group {}", check.name);
        return success;
    }
    let mz_result = client.batch_execute(&format!(
        "CREATE MATERIALIZED VIEW {} AS {}",
        check.name, check.query
    ));
    match mz_result {
        Ok(_) => info!("installed view {}", check.name),
        Err(err) => {
            let errmsg = err.to_string();
            if !errmsg.ends_with("already exists") {
                success = false;
                warn!("error trying to create view {}: {}", check.name, err);
            } else {
                // this only matters for timeline debugging, in general it is fine
                debug!("view previously installed: {} err={}", check.name, err);
            }
        }
    }
    success
}
/// Try to build the views and sources that are needed for this script
/// This ignores errors (just logging them), and can just be run multiple times.
///
/// # Returns Success: `true` if everything succeed
Try to build the views and sources that are needed for this script
This ignores errors (just logging them), and can just be run multiple times.
Try to build the views and sources that are needed for this script This ignores errors ( just logging them ) and can just be run multiple times .
fn try_initialize(client: &mut Client, check: &Check) -> bool {
    let mut success = true;
    if !check.enabled {
        info!("skipping disabled query group {}", check.name);
        return success;
    }
    let mz_result = client.batch_execute(&format!(
        "CREATE MATERIALIZED VIEW {} AS {}",
        check.name, check.query
    ));
    match mz_result {
        Ok(_) => info!("installed view {}", check.name),
        Err(err) => {
            let errmsg = err.to_string();
            if !errmsg.ends_with("already exists") {
                success = false;
                warn!("error trying to create view {}: {}", check.name, err);
            } else {
                // this only matters for timeline debugging, in general it is fine
                debug!("view previously installed: {} err={}", check.name, err);
            }
        }
    }
    success
}
fn try_initialize ( client : & mut Client , check : & Check ) -> bool { let mut success = true ; if ! check . enabled { info ! ( " " check name ) ; return success ; } let mz_result = client . batch_execute ( & format ! ( " " check name check query ) ) ; match mz_result { Ok ( _ ) => info ! ( " " check name ) , Err ( err ) => { let errmsg = err . to_string ( ) ; if ! errmsg . ends_with ( " " ) { success = false ; warn ! ( " " check name err ) ; } else { // this only matters for timeline debugging, in general it is fine debug ! ( " " check name err ) ; } } } success }
Try to build the views and sources that are needed for this script
This ignores errors (just logging them), and can just be run multiple times.
Try to build the views and sources that are needed for this script This ignores errors ( just logging them ) and can just be run multiple times .
client
&mut Client
check
&Check
client
&mut Client
check
&Check
returns success: `true` if everything succeed
None