2018-06-10 11:11:41 +02:00
|
|
|
package models
|
|
|
|
|
|
|
|
// DeleteUserByID deletes a user by its ID
|
|
|
|
func DeleteUserByID(id int64, doer *User) error {
|
|
|
|
// Check if the id is 0
|
|
|
|
if id == 0 {
|
|
|
|
return ErrIDCannotBeZero{}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Delete the user
|
2018-10-27 11:33:28 +02:00
|
|
|
_, err := x.Id(id).Delete(&User{})
|
2018-06-10 11:11:41 +02:00
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
return err
|
|
|
|
}
|