Skip to content

Commit

Permalink
Query formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
td202 committed Nov 20, 2024
1 parent 27c915d commit 57f8e7e
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 12 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 28 additions & 6 deletions backend-rust/src/graphql_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,14 @@ impl BaseQuery {
let mut row_stream = sqlx::query_as!(
Block,
"SELECT * FROM (
SELECT hash, height, slot_time, block_time, finalization_time, baker_id, \
total_amount
SELECT
hash,
height,
slot_time,
block_time,
finalization_time,
baker_id,
total_amount
FROM blocks
WHERE height > $1 AND height < $2
ORDER BY
Expand Down Expand Up @@ -1196,8 +1202,16 @@ impl Block {
async fn query_by_height(pool: &PgPool, height: BlockHeight) -> ApiResult<Self> {
sqlx::query_as!(
Block,
"SELECT hash, height, slot_time, block_time, finalization_time, baker_id, \
total_amount FROM blocks WHERE height=$1",
"SELECT
hash,
height,
slot_time,
block_time,
finalization_time,
baker_id,
total_amount
FROM blocks
WHERE height=$1",
height
)
.fetch_optional(pool)
Expand All @@ -1208,8 +1222,16 @@ impl Block {
async fn query_by_hash(pool: &PgPool, block_hash: BlockHash) -> ApiResult<Self> {
sqlx::query_as!(
Block,
"SELECT hash, height, slot_time, block_time, finalization_time, baker_id, \
total_amount FROM blocks WHERE hash=$1",
"SELECT
hash,
height,
slot_time,
block_time,
finalization_time,
baker_id,
total_amount
FROM blocks
WHERE hash=$1",
block_hash
)
.fetch_optional(pool)
Expand Down

0 comments on commit 57f8e7e

Please sign in to comment.