fix response and sql request
This commit is contained in:
parent
8b0efd16fe
commit
3369c6f084
1 changed files with 2 additions and 1 deletions
|
@ -15,6 +15,7 @@ struct Request {
|
||||||
|
|
||||||
#[derive(Serialize, FromRow)]
|
#[derive(Serialize, FromRow)]
|
||||||
struct Response {
|
struct Response {
|
||||||
|
timestamp: i64,
|
||||||
uuid: String,
|
uuid: String,
|
||||||
message: String,
|
message: String,
|
||||||
}
|
}
|
||||||
|
@ -44,7 +45,7 @@ pub async fn res(
|
||||||
return Ok(error);
|
return Ok(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
let row = sqlx::query_as("SELECT timestamp, (uuid AS VARCHAR), message FROM channel ORDERED BY timestamp DESC LIMIT $1 OFFSET $2")
|
let row = sqlx::query_as("SELECT timestamp, CAST(uuid AS VARCHAR), message FROM channel ORDER BY timestamp DESC LIMIT $1 OFFSET $2")
|
||||||
.bind(request.amount)
|
.bind(request.amount)
|
||||||
.bind(request.start)
|
.bind(request.start)
|
||||||
.fetch_all(&data.pool)
|
.fetch_all(&data.pool)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue