Skip to content

MySQL support for returning auto generated ID on INSERT? #1032

Answered by Jille
mportugal asked this question in Ideas
Discussion options

You must be logged in to vote

For Postgres you can add RETURN id to your query and use :one. For MySQL, use :execresult which makes your query return a sql.Result, which has a LastInsertId() (int64, error) method.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by kyleconroy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
3 participants