64ec06b4b4
- Use more efficient implementation of the template funcs.
14 lines
435 B
Smarty
14 lines
435 B
Smarty
{{- $tableName := .TableName -}}
|
|
// {{titleCase $tableName}}Delete deletes a single record.
|
|
func {{titleCase $tableName}}Delete(db boil.DB, id int) error {
|
|
if id == nil {
|
|
return nil, errors.New("model: no id provided for {{$tableName}} delete")
|
|
}
|
|
|
|
err := db.Exec("DELETE FROM {{$tableName}} WHERE id=$1", id)
|
|
if err != nil {
|
|
return errors.New("model: unable to delete from {{$tableName}}: %s", err)
|
|
}
|
|
|
|
return nil
|
|
}
|