New structure (#7)
This commit is contained in:
parent
3f9fad0e2a
commit
301a4eedda
104 changed files with 326 additions and 280 deletions
18
pkg/models/user_delete.go
Normal file
18
pkg/models/user_delete.go
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
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
|
||||
_, err := x.Id(id).Delete(&User{})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
Reference in a new issue