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

Returning details immediately after inserting into database #21

Open
LawEKS opened this issue Apr 13, 2018 · 0 comments
Open

Returning details immediately after inserting into database #21

LawEKS opened this issue Apr 13, 2018 · 0 comments
Assignees

Comments

@LawEKS
Copy link
Collaborator

LawEKS commented Apr 13, 2018

@hannahcmtucker mentioned in gitter a way to return values from a table after you have inserted into it.

const query = {
  text: `INSERT INTO users(username, password) VALUES($1, $2) RETURNING USERNAME, ID`,
  values: [username, password]
}

We can use this when we are creating a comment. Where we need to get a destination id but have insert a destination if it does not exist in the destinations table.

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

4 participants