func (me *mysqlTest) TestUpdateReturning() { t := me.T() ds := me.db.From("entry") var id uint32 _, err := ds.Where(goqu.I("int").Eq(11)).Returning("id").Update(map[string]interface{}{"int": 9}).ScanVal(&id) assert.Error(t, err) assert.Equal(t, err.Error(), "goqu: Adapter does not support RETURNING clause") }
func (me *mysqlTest) TestInsertReturning() { t := me.T() ds := me.db.From("entry") now := time.Now() e := entry{Int: 10, Float: 1.000000, String: "1.000000", Time: now, Bool: true, Bytes: []byte("1.000000")} _, err := ds.Returning(goqu.Star()).Insert(e).ScanStruct(&e) assert.Error(t, err) }
// Error asserts that a function returned an error (i.e. not `nil`). // // actualObj, err := SomeFunction() // require.Error(t, err, "An error was expected") // require.Equal(t, err, expectedError) // } func Error(t TestingT, err error, msgAndArgs ...interface{}) { if !assert.Error(t, err, msgAndArgs...) { t.FailNow() } }