Add from_clear to allow emptying current from tables in select statement #716
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Info
Sea-orm does allow to modify the underlying sea-query statements with can be really useful but sea-query itself doesn't have a way to change the table a
SelectStatement
is done. This can be really handy when a database has a few tables that do share the same columns but are separated for other reasons, in my use case I have tables like that: data, data_now, data_1s, data_1m. All of them are identical to each other (data_now does have different PK keys, but that isn't important in my case), with using from_clear I can avoid having separate Entities for each table and avoid a lot of boilerplate when mapping them to a single Grpc struct that my backend outputs.New Features
SelectStatement
from_clear()
with does remove all from statements from itChanges
from_clear()
added toSelectStatement
Let me know if anything more is need in this PR or if you have a better idea to archive what I need for my use case. Or a better name for
from_clear()
because I am myself not that happy with it.