215 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
2
votes
0
answers
67
views
How to fetch/store related structs by ID with SQLx
Let's say I have two structs:
pub struct Employee {
pub id: u64,
pub name: String,
pub team: Team
}
pub struct Team {
pub id: u64,
pub name: String
}
I also have a sqlite3 ...
0
votes
1
answer
146
views
A repository generic over an sqlx executor in Rust
There's a use case in my application where I need to write to 2 repositories and make sure that either both of the writes succeed or neither of them does. To be more precise, it's the user ...
0
votes
2
answers
111
views
SqliteRow doesn't implement Debug
Using rust sqlx sqlx = { version = "0.8.6", features = ["sqlite", "runtime-tokio", "macros"] } .
I am using a SQLite Db for my application. After making a db ...
1
vote
1
answer
346
views
How to use postgis geography type with sqlx
I work with geospatial data and want to put it into a (postgres) database with the postgis plugin installed.
I know I need the geozero, geo and sqlx crate and also found an example here under PostGis ...
1
vote
0
answers
135
views
How to implement a transactional event bus?
I’m building an event-sourcing framework and want to create an event bus that carries a database transaction through its publish/subscribe flow.
Users subscribe to events by implementing an ...
0
votes
1
answer
148
views
sqlx fails with "unsupported data type DecimalN"
I have been trying to find a good way to create an express.js like backend using Rust. Everything seems to be going really well except for the fact that I can't find a good way connect and query a SQL ...
2
votes
1
answer
315
views
Query bypassing SQLx compile-time checks for missing NOT NULL column
Query bypassing SQLx compile-time checks for missing NOT NULL column
Background
I've recently added a new required column to my database but I'm noticing that my SQLx query is still compiling ...
1
vote
1
answer
269
views
Rename enum value for use with sqlx in query
I'm using Postgres. I want to store char in the a column that will give the "type" of the row. But I also want the code to be more expressive, so I don't want to create enums with char ...
0
votes
0
answers
69
views
How to read data from multiple tables returned by MySQL in Rust?
I'm trying to run a stored procedure of MySQL DB.
I'm able to handle when the SP returns only one table as a result.
But when multiple tables are being returned as a result, then I am facing issues.
...
1
vote
1
answer
114
views
Lifetime issues in async transaction wrapper with closures in Rust [duplicate]
I'm working on a Rust project using the repository pattern and want to implement a transaction execution wrapper to handle commit/rollback functionality. However, I'm facing difficulties managing ...
0
votes
1
answer
219
views
Is it possible to perform database IO asyncrhonously (async IO) using SQLX in Rust?
I am seeing pretty poor performance with some code which moves data from one datastore to a SQL database.
Currently I manage to process about 200 messages / second.
I initially wrote this utility in ...
1
vote
2
answers
213
views
How to pass `sqlx::Executor` to nested futures
I'm trying to make functions work with both PgPool and PgTransaction. The PgExecutor seems to be meant for this. But I can't understand how to pass it around. It's implemented for PgPool, which is ...
0
votes
0
answers
385
views
Generic database connection in Tauri using Rust
As a Tauri and Rust beginner, I am trying to develop a basic Tauri 2 application with React and Typescript frontend and Rust backend.
I want a basic database manager-like app, where users can enter ...
1
vote
0
answers
189
views
How to correctly query Postgres database with type annotations using sqlx QueryBuilder?
I am trying to query Postgresql using sqlx QueryBuilder, but annotating the query has me completely stumped.
The relevant part of my code is:
let mut builder = query_builder::QueryBuilder::new("...
0
votes
1
answer
130
views
How to use a Transaction with a lifetime specified with the Query's execute function?
I wanted to modify my code to bulk insert rows in a transaction instead of row by row.
I know this isn't the fastest way to insert data in a PostgreSQL database but that's not the point of the ...