Replies: 20 comments 10 replies
-
Hey @langzime, is this a follow up question of |
Beta Was this translation helpful? Give feedback.
-
Yeah, this is the tradeoff. Defining the repeated structs over and over again OR defining repeated struct with macro. Define with macro will improve the readability and avoid repeated code but it's harder to develop upon as not all IDEs are able to expand the macros. |
Beta Was this translation helpful? Give feedback.
-
Yes, i tried it. A lot of macros cause ide very laggy and a lot of extra code |
Beta Was this translation helpful? Give feedback.
-
From my experience, it's just a one-time long compilation as 200+ entities were added at once. Once it's compiled it will never be recompiled on the same machine given the fact that entity file is unchanged. |
Beta Was this translation helpful? Give feedback.
-
I have 500+ ... |
Beta Was this translation helpful? Give feedback.
-
In cases like this, I currently use both mysql_async |
Beta Was this translation helpful? Give feedback.
-
I think there are three options:
|
Beta Was this translation helpful? Give feedback.
-
Thank you very much, I'll try it sometime. |
Beta Was this translation helpful? Give feedback.
-
It's not on our plan. But if you have an good proposal we're willing to consider :D |
Beta Was this translation helpful? Give feedback.
-
Actually, it's possible to have an Entity that has a state, so your Entity is no longer a unit struct, but a |
Beta Was this translation helpful? Give feedback.
-
Although I am not sure are there other blockers to this approach. But yeah at least it was designed that way, the |
Beta Was this translation helpful? Give feedback.
-
From sea-orm/src/entity/base_entity.rs Lines 23 to 24 in 6bc7669 However, when constructing query. It doesn't take Also, sea-orm/src/entity/base_entity.rs Lines 10 to 24 in 6bc7669 |
Beta Was this translation helpful? Give feedback.
-
Then probably a lazy_static with |
Beta Was this translation helpful? Give feedback.
-
This issue is blocking us from using sea ORM when the table_name is set at runtime. We create many SQL tables with the same struct dynamically and we don't know the names of the tables before hand. Setting a variable in Entity won't work as the |
Beta Was this translation helpful? Give feedback.
-
Then probably your best bet for now is using SeaQuery, everything is dynamic there. |
Beta Was this translation helpful? Give feedback.
-
Got a similar issue where I'd like to set the |
Beta Was this translation helpful? Give feedback.
-
Has anyone figured out anything on this? We have the situation where we have a set of tables that are individually generated at runtime with a predetermined naming pattern. I looked into SeaQuery however, |
Beta Was this translation helpful? Give feedback.
-
Oh wow, that’s great news. Not really, once it’s Arced it’ll work as usual
…________________________________
From: Taylor Beever ***@***.***>
Sent: Saturday, April 27, 2024 12:12:12 AM
To: SeaQL/sea-orm ***@***.***>
Cc: Chris Tsang ***@***.***>; Mention ***@***.***>
Subject: Re: [SeaQL/sea-orm] Dynamic Table Name, a lot of tables with the same structure, it is not appropriate to define many structures with macros (Discussion #1202)
@tyt2y3<https:/tyt2y3> the last example I sent compiles and works fwiw. Not sure if I will run into problems later?
—
Reply to this email directly, view it on GitHub<#1202 (reply in thread)>, or unsubscribe<https:/notifications/unsubscribe-auth/AANTHCF4ZXGB73TCXT2IMVLY7LNMZAVCNFSM6AAAAAA2ZD2E5WVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TENBSGA3DG>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
In my case the table name was calculated dynamically at runtime. Entity::from_table("my_table").find() |
Beta Was this translation helpful? Give feedback.
-
Is there any progress? |
Beta Was this translation helpful? Give feedback.
-
Motivation
Proposed Solutions
Additional Information
Beta Was this translation helpful? Give feedback.
All reactions