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

Cannot get ID after inserting data #925

Open
titans-fangyu opened this issue Oct 27, 2023 · 1 comment
Open

Cannot get ID after inserting data #925

titans-fangyu opened this issue Oct 27, 2023 · 1 comment

Comments

@titans-fangyu
Copy link

When I upgrade github.com/uptrace/bun from v1.0.19 to v1.1.14, the following code no longer works and cannot get the Id after inserting data. this is bug ???

books := []Book{book1, book2}
res, err := db.NewInsert().Model(&books).Exec(ctx)
if err != nil {
panic(err)
}

for _, book := range books {
fmt.Println(book.ID) // book id is scanned automatically
}

@titans-fangyu
Copy link
Author

Id int bun:"id,pk,autoincrement"``
The new version needs to be tagged...

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

No branches or pull requests

1 participant