-
Notifications
You must be signed in to change notification settings - Fork 44
6.删除
afumu edited this page Jun 6, 2023
·
1 revision
resultDb := gplus.DeleteById[User](6)
fmt.Println(resultDb.Error)
fmt.Println(resultDb.RowsAffected)
// DELETE FROM `users` WHERE `id` = 6
resultDb := gplus.DeleteByIds[User]([]int{7, 8, 9})
fmt.Println(resultDb.Error)
fmt.Println(resultDb.RowsAffected)
// DELETE FROM `users` WHERE `id` IN (7,8,9)
query, u := gplus.NewQuery[User]()
query.Eq(&u.Username, "afumu")
resultDb := gplus.Delete[User](query)
fmt.Println(resultDb.Error)
fmt.Println(resultDb.RowsAffected)
// DELETE FROM `users` WHERE username = 'afumu'