-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] Inverse of Get/Select? #912
Comments
Implicit field names for insert statements sounds nice, but creating tables from structs sounds like an ORM feature. Also creating such function(that creates CREATE TABLE statements) requires some way of setting all the field properties that user wants per field or just setting some defaults and expect users to modify the statement, or expect them to modify table fields in another query(ALTER TABLE or st). It all seems like a lot of trouble to automate something that people usually need to customize for themselves in my opinion. ps: Have you seen gorm? it has both these features and works great if you like the model first approach. |
So you might be interested in the insert statement feature?
Do you have any particular thoughts on that or should I just prepare a PR
and send you?
…On Wed, Feb 28, 2024, 06:51 TLW ***@***.***> wrote:
Implicit field names for insert statements sounds nice, but creating
tables from structs sounds like an ORM feature.
Also creating such function(that creates CREATE TABLE statements) requires
some way of setting all the field properties that user wants per field or
just setting some defaults and expect users to modify the statement, or
expect them to modify table fields in another query(ALTER TABLE or st).
It all seems like a lot of trouble to automate something that people
usually need to customize for themselves in my opinion.
—
Reply to this email directly, view it on GitHub
<#912 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAB25MG7BAQPLD66NLWMFLYV3AVNAVCNFSM6AAAAABDCQS5BSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRYGI4DEMZRGM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
@zond not a maintainer just wanted to weigh in... |
Fair enough :)
…On Wed, Feb 28, 2024, 12:23 TLW ***@***.***> wrote:
So you might be interested in the insert statement feature? Do you have
any particular thoughts on that or should I just prepare a PR and send you?
… <#m_-117507800482917100_>
On Wed, Feb 28, 2024, 06:51 TLW *@*.*> wrote: Implicit field names for
insert statements sounds nice, but creating tables from structs sounds like
an ORM feature. Also creating such function(that creates CREATE TABLE
statements) requires some way of setting all the field properties that user
wants per field or just setting some defaults and expect users to modify
the statement, or expect them to modify table fields in another query(ALTER
TABLE or st). It all seems like a lot of trouble to automate something that
people usually need to customize for themselves in my opinion. — Reply to
this email directly, view it on GitHub <#912 (comment)
<#912 (comment)>>, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/AAAB25MG7BAQPLD66NLWMFLYV3AVNAVCNFSM6AAAAABDCQS5BSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRYGI4DEMZRGM
<https://github.com/notifications/unsubscribe-auth/AAAB25MG7BAQPLD66NLWMFLYV3AVNAVCNFSM6AAAAABDCQS5BSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRYGI4DEMZRGM>
. You are receiving this because you authored the thread.Message ID: @.*>
not a maintainer... just wanted to weigh in 🙃
—
Reply to this email directly, view it on GitHub
<#912 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAB25PYBGFROU5TZBCDTX3YV4HSTAVCNFSM6AAAAABDCQS5BSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRYG43TKMBVHA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I find it amazingly useful to just call Get or Select instead of having to recursively loop through my struct fields and assign to them myself.
But it's equally annoying to loop through them to build an INSERT or UPDATE.
Is it feasible to create functions that does this in sqlx? If you think so, please give me advice about how you think it ought to work and I'll give it a shot.
Another useful thing along the same lines would be something that created a CREATE TABLE statement for a struct, possibly with CREATE INDEX statements where needed. Would that be feasible and valuable?
The text was updated successfully, but these errors were encountered: