(t *testing.T)
| 2077 | } |
| 2078 | |
| 2079 | func TestExecUpdateNode(t *testing.T) { |
| 2080 | db, mock, err := sqlmock.New() |
| 2081 | require.NoError(t, err) |
| 2082 | mock.ExpectBegin() |
| 2083 | mock.ExpectExec(escape("UPDATE `users` SET `age` = ?, `name` = ? WHERE `id` = ?")). |
| 2084 | WithArgs(30, "Ariel", 1). |
| 2085 | WillReturnResult(sqlmock.NewResult(1, 1)) |
| 2086 | mock.ExpectCommit() |
| 2087 | err = UpdateNode(context.Background(), sql.OpenDB("", db), &UpdateSpec{ |
| 2088 | Node: &NodeSpec{ |
| 2089 | Table: "users", |
| 2090 | Columns: []string{"id", "name", "age"}, |
| 2091 | ID: &FieldSpec{Column: "id", Type: field.TypeInt, Value: 1}, |
| 2092 | }, |
| 2093 | Fields: FieldMut{ |
| 2094 | Set: []*FieldSpec{ |
| 2095 | {Column: "age", Type: field.TypeInt, Value: 30}, |
| 2096 | {Column: "name", Type: field.TypeString, Value: "Ariel"}, |
| 2097 | }, |
| 2098 | }, |
| 2099 | }) |
| 2100 | require.NoError(t, err) |
| 2101 | } |
| 2102 | |
| 2103 | func TestUpdateNodes(t *testing.T) { |
| 2104 | tests := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…