Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created February 21, 2022 04:48
Embed
What would you like to do?
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