pub async fn add_connection_details<'e>(
    executor: impl Executor<'e, Database = Db>,
    chain_id: &ChainId,
    connection_details: &ConnectionDetails,
) -> Result<()> {
    let connection_details = Json(connection_details);

    let rows_affected =
        sqlx::query("UPDATE chains SET connection_details = $1, updated_at = $2 WHERE id = $3")
            .bind(connection_details)
            .bind(Utc::now())
            .bind(chain_id.to_string())
            .execute(executor)
            .await
            .context("unable to add connection details to chain")?
            .rows_affected();

    ensure!(
        rows_affected == 1,
        "rows_affected should be equal to 1 when adding connection details to chain"
    );

    Ok(())
}
/// Adds connection details for given chain id
Adds connection details for given chain id
Adds connection details for given chain id
pub async fn add_connection_details<'e>(
    executor: impl Executor<'e, Database = Db>,
    chain_id: &ChainId,
    connection_details: &ConnectionDetails,
) -> Result<()> {
    let connection_details = Json(connection_details);
    let rows_affected =
        sqlx::query("UPDATE chains SET connection_details = $1, updated_at = $2 WHERE id = $3")
            .bind(connection_details)
            .bind(Utc::now())
            .bind(chain_id.to_string())
            .execute(executor)
            .await
            .context("unable to add connection details to chain")?
            .rows_affected();
    ensure!(
        rows_affected == 1,
        "rows_affected should be equal to 1 when adding connection details to chain"
    );
    Ok(())
}
pub async fn add_connection_details < ' e > ( executor : impl Executor < ' e , Database = Db > , chain_id : & ChainId , connection_details : & ConnectionDetails , ) -> Result < ( ) > { let connection_details = Json ( connection_details ) ; let rows_affected = sqlx :: query ( " " ) . bind ( connection_details ) . bind ( Utc :: now ( ) ) . bind ( chain_id . to_string ( ) ) . execute ( executor ) . await . context ( " " ) ? . rows_affected ( ) ; ensure ! ( rows_affected 1 " " ) ; Ok ( ( ) ) }
Adds connection details for given chain id
Adds connection details for given chain id
executor
impl Executor<'e, Database = Db>
chain_id
&ChainId
connection_details
&ConnectionDetails
executor
impl Executor<'e, Database = Db>
chain_id
&ChainId
connection_details
&ConnectionDetails