44 questions
2
votes
1
answer
81
views
How to run async function in sync in tokio runtime?
I would like to initialize SeaOrm database connection in sync for easier usage inside application and testing, but not sure how to do it without error. I'm fine with any type of blocking as this ...
-3
votes
0
answers
50
views
How to convert the results of an 'execute_unprepared' from sea_orm into a useable hashmap or vec?
I'm still quite new to Rust, and just for integrity checking, I'm wanting to check some values of what should be a list of tables versus the action tables.
For this, I have a sea_orm connection.
fn ...
0
votes
0
answers
44
views
Selecting a dynamically supplied table name using Sea Orm in Rust
I'm still very new to Rust & Sea Orm, but that's what the current project I'm working in is.
I'm working on a database focused on users (that's updatable by more than just the Rust/SeaOrm app).
...
4
votes
2
answers
114
views
How to find out exact return type of the RANK() window function in MySQL and MariaDB?
I am accessing a MySQL and MariaDB database using Rust with SeaORM, and my query includes the RANK() window function.
In MySQL, I can fetch the rank column value using u32 (unsigned integer),
In ...
0
votes
1
answer
36
views
RANK() Always Returns 0 in SeaORM Query
I am using SeaORM in a Rust project and trying to retrieve ranked user balances using MySQL’s RANK() OVER (ORDER BY ...). However, the rank field always returns 0 for all rows.
Rust Code:
#[allow(...
0
votes
1
answer
82
views
How to mock COUNT query result in sea-orm MockDatabase for testing?
I'm trying to test a function that checks if a space exists in the database using sea-orm's MockDatabase. The function performs a COUNT query, but my test is failing.
Here's my repository code:
pub ...
0
votes
1
answer
131
views
Failed installing sea-orm-cli in Ubuntu because of missing openssl-sys
I tried to install sea-orm-cli but an error occurred. Probably because sea-orm-cli cannot find paths and link OpenSSL.
error: failed to run custom build command for `openssl-sys v0.9.104`
Caused by:
...
1
vote
0
answers
222
views
How to use subquery statements in Entity::find of SeaORM?
I want to use Rust's SeaORM to implement the following SQL code: SELECT grade, ARRAY_AGG(DISTINCT student) FROM (SELECT id, grade, student FROM math_class ORDER BY id DESC LIMIT 10000) AS ...
0
votes
1
answer
212
views
SeaOrm connection for Sqlx
I am using a SeaOrm v1.0.0 connection with Sqlx v0.8.0. This was working just fine until I upgraded to the latest version.
Now I get error:
error[E0277]: the trait bound `&sea_orm::sqlx::Pool<...
1
vote
1
answer
181
views
sea-orm for Postgres generating cast syntax for enum value and it doesn't work
I am trying to insert a record into Postgresql using sea-orm. I have enabled sqlx-logging to see why the insertion is crashing. Here is what I find.
[2024-08-03T07:33:35Z DEBUG sea_orm::driver::...
-3
votes
1
answer
211
views
Generic args in patterns require turbofish syntax - how to make it for Vec of tuples?
Let's say I have this code:
async fn get_product_data(product_id: Uuid) -> () {
let product_with_skus: Vec<(product::Model, Vec<sku::Model>)> = Product::find_by_id(product_id)
...
0
votes
1
answer
748
views
Implementing an Enum as a PostgreSQL Column using SeaORM
I'm currently stuck on how to make one of my columns be an Enum of different payment types (Cash, Credit, Debit, etc.)
This is what I currently have for the table where manager is a reference to ...
2
votes
1
answer
1k
views
Write a m-to-m relation in sea-orm migration
I'm trying to create a many-to-many relationship in a SeaORM migration, but I'm facing an issue where the generated Related trait doesn't include the via method despite my attempts.
Context:
I've ...
1
vote
2
answers
514
views
SeaORM Query Error: no column found for name: A_
This builds the correct query in terms of SQL (from what I can see in the tracer).
However I get error Query Error: no column found for name: A_barcode
MvB::find()
.find_with_related(MvA)
...
0
votes
1
answer
265
views
"no method named `paginate` found for struct `sea_orm::Select` in the current scope"
I am using a generic function for my findAll on all of my entities. Now that I try to implement pagination it can't find the method paginate.
I assume I am missing some generic parameters.
This is my ...