Skip to content

Commit

Permalink
optimize. (#265)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssuchichen authored Jun 26, 2024
1 parent 2426fe1 commit 3e2caf9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions explorer/src/service/v2/other.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ pub struct AddressCountParams {
pub start_time: Option<i64>,
pub end_time: Option<i64>,
}

#[derive(Serialize, Deserialize)]
pub struct AddressCountResponse {
count: i64,
Expand All @@ -192,10 +193,10 @@ pub async fn get_address_count(

let mut query_params: Vec<String> = vec![];
if let Some(start_time) = params.start_time {
query_params.push(format!("timestamp > {start_time} "));
query_params.push(format!("timestamp >= {start_time} "));
}
if let Some(end_time) = params.end_time {
query_params.push(format!("timestamp < {end_time} "));
query_params.push(format!("timestamp <= {end_time} "));
}

let mut sql_native = "SELECT count(distinct address) FROM native_addrs ".to_string();
Expand Down

0 comments on commit 3e2caf9

Please sign in to comment.