Is it possible to get the name of a table at runtime? #4796
Unanswered
ThomasVille
asked this question in
Q&A
Replies: 1 comment 2 replies
-
|
This information is currently not exposed in such a way. It would be interesting to learn more about your use-case to understand if we should expose this information or if this is already covered by another API. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Backend
SQLite
Diesel version
2.2.12
Diesel Features
sqlite, uuid, returning_clauses_for_sqlite_3_35, chrono
Operating System Version
Ubuntu 25.04 x86_64 GNU/Linux 6.14.0-32-generic
Third party libraries
No response
What do you want to do?
I'm trying to get the name of a table declared using the DSL like in the
getting_started_step_1example statically at runtime.I didn't find anything in the
self::schema::postsmodule so I looked at the expanded code of the example withcargo expand --liband the only string for"posts"I found is an internal one that I'm likely not supposed to be able to access:I already looked at the documentation, the feature flags, the code of
dieseland didn't find any solution.Ideally I'd like to do something like:
And it would print:
Compile time error
No response
What code do you already have?
So that I could get the name of the table with:
Thanks to everyone reading my post.
Beta Was this translation helpful? Give feedback.
All reactions