New structure (#7)
This commit is contained in:
19
pkg/models/list_delete.go
Normal file
19
pkg/models/list_delete.go
Normal file
@ -0,0 +1,19 @@
|
||||
package models
|
||||
|
||||
// Delete implements the delete method of CRUDable
|
||||
func (l *List) Delete() (err error) {
|
||||
// Check if the list exists
|
||||
if err = l.GetSimpleByID(); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Delete the list
|
||||
_, err = x.ID(l.ID).Delete(&List{})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Delete all todotasks on that list
|
||||
_, err = x.Where("list_id = ?", l.ID).Delete(&ListTask{})
|
||||
return
|
||||
}
|
Reference in New Issue
Block a user