From 9102327b1c48581ecb66f9e34c8af7f9a7537fa6 Mon Sep 17 00:00:00 2001 From: Patrick O'brien Date: Tue, 20 Sep 2016 13:20:00 +1000 Subject: [PATCH] Remove rowsaffected as 0 error --- templates/16_update.tpl | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/templates/16_update.tpl b/templates/16_update.tpl index 3ac7c02..2732466 100644 --- a/templates/16_update.tpl +++ b/templates/16_update.tpl @@ -74,15 +74,11 @@ func (o *{{$tableNameSingular}}) Update(exec boil.Executor, whitelist ... string fmt.Fprintln(boil.DebugWriter, values) } - result, err := exec.Exec(cache.query, values...) + _, err = exec.Exec(cache.query, values...) if err != nil { return errors.Wrap(err, "{{.PkgName}}: unable to update {{.Table.Name}} row") } - if r, err := result.RowsAffected(); err == nil && r != 1 { - return errors.Errorf("failed to update single row, updated %d rows", r) - } - if !cached { {{$varNameSingular}}UpdateCacheMut.Lock() {{$varNameSingular}}UpdateCache[key] = cache @@ -172,14 +168,10 @@ func (o {{$tableNameSingular}}Slice) UpdateAll(exec boil.Executor, cols M) error fmt.Fprintln(boil.DebugWriter, args...) } - result, err := exec.Exec(sql, args...) + _, err := exec.Exec(sql, args...) if err != nil { return errors.Wrap(err, "{{.PkgName}}: unable to update all in {{$varNameSingular}} slice") } - if r, err := result.RowsAffected(); err == nil && r != ln { - return errors.Errorf("failed to update %d rows, only affected %d", ln, r) - } - return nil }