Skip to content

Instantly share code, notes, and snippets.

@kitz99
Created June 22, 2018 08:47
Show Gist options
  • Save kitz99/24738df4ba8b31f979b2c79e8c67bc60 to your computer and use it in GitHub Desktop.
Save kitz99/24738df4ba8b31f979b2c79e8c67bc60 to your computer and use it in GitHub Desktop.
func createRecord(post Post) error {
qryString := fmt.Sprintf(
"INSERT INTO posts (name, category, author, created_at, updated_at) VALUES ('%s', '%s', '%s', NOW(), NOW())",
post.Name, post.Category, post.Author)
_, err := roachConnection.Exec(qryString)
return err
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment