Skip to content

Commit

Permalink
Update query
Browse files Browse the repository at this point in the history
  • Loading branch information
gianalarcon committed Feb 27, 2024
1 parent 6e58205 commit 7e09a0c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions crates/torii/grpc/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,10 @@ impl DojoWorld {
async fn events_all(&self, limit: u32, offset: u32) -> Result<Vec<proto::types::Event>, Error> {
let query = r#"
SELECT keys, data, transaction_hash
FROM events
FROM events DESC
LIMIT ? OFFSET ?
"#.to_string();
"#
.to_string();

Check warning on line 136 in crates/torii/grpc/src/server/mod.rs

View check run for this annotation

Codecov / codecov/patch

crates/torii/grpc/src/server/mod.rs#L130-L136

Added lines #L130 - L136 were not covered by tests

let row_events: Vec<(String, String, String)> =
sqlx::query_as(&query).bind(limit).bind(offset).fetch_all(&self.pool).await?;
Expand Down Expand Up @@ -279,9 +280,10 @@ impl DojoWorld {
let events_query = r#"
SELECT keys, data, transaction_hash
FROM events
WHERE keys LIKE ?
WHERE keys LIKE ? DESC
LIMIT ? OFFSET ?

Check warning on line 284 in crates/torii/grpc/src/server/mod.rs

View check run for this annotation

Codecov / codecov/patch

crates/torii/grpc/src/server/mod.rs#L279-L284

Added lines #L279 - L284 were not covered by tests
"#.to_string();
"#
.to_string();

let row_events: Vec<(String, String, String)> = sqlx::query_as(&events_query)
.bind(&keys_pattern)
Expand Down Expand Up @@ -493,7 +495,7 @@ impl DojoWorld {
}
}

fn process_event_field(data: &String) -> Vec<Vec<u8>> {
fn process_event_field(data: &str) -> Vec<Vec<u8>> {
data.trim_end_matches('/').split('/').map(|s| s.to_owned().into_bytes()).collect()

Check warning on line 499 in crates/torii/grpc/src/server/mod.rs

View check run for this annotation

Codecov / codecov/patch

crates/torii/grpc/src/server/mod.rs#L498-L499

Added lines #L498 - L499 were not covered by tests
}

Expand Down

0 comments on commit 7e09a0c

Please sign in to comment.