entc/gen: move sql-update-one to sqlgraph

This commit is contained in:
Ariel Mashraki
2019-12-18 19:25:46 +02:00
parent 1bbe460259
commit 7fde9b7642
53 changed files with 8834 additions and 7859 deletions

View File

@@ -885,8 +885,9 @@ func TestUpdateNode(t *testing.T) {
},
prepare: func(mock sqlmock.Sqlmock) {
mock.ExpectBegin()
// Clear the "partner" and "spouse 2" from 1's column, and set "spouse 3".
mock.ExpectExec(escape("UPDATE `users` SET `partner_id` = NULL, `spouse_id` = NULL, `spouse_id` = ? WHERE `id` = ?")).
// Clear the "partner" from 1's column, and set "spouse 3".
// "spouse 2" is implicitly removed when setting a different foreign-key.
mock.ExpectExec(escape("UPDATE `users` SET `partner_id` = NULL, `spouse_id` = ? WHERE `id` = ?")).
WithArgs(3, 1).
WillReturnResult(sqlmock.NewResult(1, 1))
// Clear the "partner_id" column from previous 1's partner.