pub fn upsert_healthy_address(
        conn: &PgConnection,
        asset_group_id: i32,
        address: &str,
    ) -> Result<(), Error> {
        let new_service = NewService {
            asset_group_id,
            name: address,
            address,
            health_status: HealthStatus::Healthy,
            service_type: ServiceType::Input,
            ..Default::default()
        };
        diesel::insert_into(services::table)
            .values(new_service)
            .on_conflict(services::address)
            .do_update()
            .set(services::health_status.eq(HealthStatus::Healthy))
            .execute(conn)?;
        Ok(())
    }
/// Given an address, if a service with that address already exists, create it.
/// Otherwise update it's connection status to healthy.
Given an address, if a service with that address already exists, create it.
Otherwise update it's connection status to healthy.
Given an address if a service with that address already exists create it . Otherwise update it ' s connection status to healthy .
pub fn upsert_healthy_address(
        conn: &PgConnection,
        asset_group_id: i32,
        address: &str,
    ) -> Result<(), Error> {
        let new_service = NewService {
            asset_group_id,
            name: address,
            address,
            health_status: HealthStatus::Healthy,
            service_type: ServiceType::Input,
            ..Default::default()
        };
        diesel::insert_into(services::table)
            .values(new_service)
            .on_conflict(services::address)
            .do_update()
            .set(services::health_status.eq(HealthStatus::Healthy))
            .execute(conn)?;
        Ok(())
    }
pub fn upsert_healthy_address ( conn : & PgConnection , asset_group_id : i32 , address : & str , ) -> Result < ( ) , Error > { let new_service = NewService { asset_group_id , name : address , address , health_status : HealthStatus :: Healthy , service_type : ServiceType :: Input , .. Default :: default ( ) } ; diesel :: insert_into ( services :: table ) . values ( new_service ) . on_conflict ( services :: address ) . do_update ( ) . set ( services :: health_status . eq ( HealthStatus :: Healthy ) ) . execute ( conn ) ? ; Ok ( ( ) ) }
Given an address, if a service with that address already exists, create it.
Given an address if a service with that address already exists create it .
conn
&PgConnection
asset_group_id
i32
address
&str
conn
&PgConnection
asset_group_id
i32
address
&str