(If you give me a quick feedback to this or any issue, I will fix them with pleasure, especially ones like this that need more time than skill :D)
Here is an example of what I did for the Quest insertion query:
for i in 0..3 {
let quest_id = match sqlx::query_scalar!(
"INSERT INTO QUEST (monster, location, length) VALUES \
($1, $2, $3) returning ID",
139,
1,
60,
)
.fetch_one(&mut *tx)
.await {
Ok(quest_id) => quest_id, // AAAAAAAAAAAAAAAAAAAAAAAAAA this is probably bullshit, right? not sure how to handle this case, otherwise I would have already made a PR xd
Err(e) => {
println!("Error inserting quest: {:?}", e);
_ = tx.rollback().await;
return INTERNAL_ERR;
}
};
quests[i] = quest_id;
}
Was previously:
for i in 0..3 {
let Ok(quest_id) = sqlx::query_scalar!(
"INSERT INTO QUEST (monster, location, length) VALUES \
($1, $2, $3) returning ID",
139,
1,
60,
)
.fetch_one(&mut *tx)
.await
else {
_ = tx.rollback().await;
return INTERNAL_ERR;
};
quests[i] = quest_id;
}
(If you give me a quick feedback to this or any issue, I will fix them with pleasure, especially ones like this that need more time than skill :D)
Here is an example of what I did for the Quest insertion query:
Was previously: