-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Close #238, support batch insert. #285
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
Conversation
usage:
places := []*Place{&place1, &place2}
db.NamedExec("INSERT INTO place (country, telcode) VALUES (:country, :telcode)", places)
|
I would be great to see this added and close #238. |
|
Would also be very useful for us |
|
+1 |
|
+1. We could really use this. |
|
when this feature will be released ? |
|
+1 would be very useful |
|
Would be a great feature to have |
|
+1. Waiting on this. In the meantime I have to use a private fork :(. |
|
++ |
|
+1 |
1 similar comment
|
+1 |
|
@jmoiron Hi, do you have any plans for this feature? |
|
we waiting this feature! |
|
Can we please at least know if there is something else needed to get this merged @jmoiron? |
|
Waiting for merge PLZ 🙏 |
1 similar comment
|
Waiting for merge PLZ 🙏 |
|
@hmgle this is great feature but it missed some tests, do you have plans to add them? |
|
+1 need this feature |
|
+1 |
|
+1 any update on merging this feature? |
|
+1 |
1 similar comment
|
+1 |
|
Is this likely to get merged? Or is the approach recommended by @tanishiking in #238 the recommended way to go? |
|
I like this approach, I will merge it and bump version on sqlx as soon as I can look over this and test it. |
|
@jmoiron Awesome, can lend a hand with the testing if required. |
|
This is how I used it with NamedExec, not much different. |
|
I had problems passing a list of referenced structs which caused sqlx to insert only 1 record without error. Passing non-referenced structs works as usual. I used a local SQLite DB. |
|
@jmoiron Is this feature going to be published with a tag on anytime soon? |
|
good function |
|
Unfortunately I get this error: Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1. Does anyone have a recommendation for debugging this? (The SQL does work if I do a for over the records and execute it individually, but does not work if I pass all the records). Looking into it a bit it might be because my Insert statement looks like this: INSERT INTO table (IP) VALUES (INET6_ATON(:IP)) Edit Update: Altering the regex on line 213 of named.go to be ([^(]?+[^)].) seems to resolve my issue, though it may not be advisable as a patch for everyone. |
|
When is this going to be released? I tried using it in |
|
Also using 1.2.0 and getting the same |
|
the same @jmoiron |
|
same |
|
also here @jmoiron |
|
for anybody looking for a hotfix, it's likely that your try running |
|
Still getting the slice value error on master with postgres |
|
Doesn't seem to work when slice values are |
|
hoping to release soon |
|
after doing this |
|
do you have example on how to do batch insert ? |
|
@dmngu9 The example is in the opening comment on this PR. Just scroll to the top. |
|
Hello. When are you planing to release this feature? |
|
@dmitrychopey If you need this and don't want to wait for a release, use |
|
is it broken? I'm facing the same issue with latest commit, version |
usage:
places := []*Place{&place1, &place2}
db.NamedExec("INSERT INTO place (country, telcode) VALUES (:country, :telcode)", places)