Skip to content
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

feat: allow []exp.UpdateExpression as Set values. #389

Merged
merged 1 commit into from
Dec 14, 2023

Conversation

kvii
Copy link
Contributor

@kvii kvii commented Aug 3, 2023

Usually, a update looks like this:

sql, _, _ := goqu.Update("items").Set(
	goqu.Record{"name": "Test", "address": "111 Test Addr"},
).ToSQL()

Then you will get:

UPDATE "items" SET "address"='111 Test Addr',"name"='Test'

Note the fields are sorted.

And now we can update like this:

sql, _, _ := goqu.Update("items").Set([]exp.UpdateExpression{
	goqu.C("name").Set("Test"),
	goqu.C("address").Set("111 Test Addr"),
}).ToSQL()

Then you will get:

UPDATE "items" SET "name"='Test',"address"='111 Test Addr'

Note that the field "name" is now in front of the field "address".

@iredmail
Copy link

iredmail commented Aug 3, 2023

Is this project dead? No code commits for nearly 2 years.

@lefinal
Copy link

lefinal commented Dec 13, 2023

Is this project dead? No code commits for nearly 2 years.

I thought so. I tried to contact @doug-martin via email but no response. Strangely, there is a commit from 3 weeks ago. @funkyshu do you have any information regarding this as you made the commits?

@funkyshu funkyshu merged commit 58b19cc into doug-martin:master Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants