Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created February 21, 2022 04:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/72b9781c3e7882cfa2bc3adbdb8c8647 to your computer and use it in GitHub Desktop.
Save parzibyte/72b9781c3e7882cfa2bc3adbdb8c8647 to your computer and use it in GitHub Desktop.
func registrarNuevoPlatillo(platillo Platillo) (int64, error) {
bd, err := obtenerBD()
if err != nil {
return 0, err
}
defer bd.Close()
resultado, err := bd.Exec(`INSERT INTO platillos(nombre, descripcion, precio, foto)
VALUES
(?, ?, ?, ?)`, platillo.Nombre, platillo.Descripcion, platillo.Precio, platillo.Foto)
if err != nil {
return 0, err
}
return resultado.LastInsertId()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment