From 59d4c986211e45bba7f76ce2115481308e1c215c Mon Sep 17 00:00:00 2001 From: black Date: Sun, 23 Apr 2023 17:22:24 +0800 Subject: [PATCH] format --- association.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/association.go b/association.go index e17f863d..89103fd1 100644 --- a/association.go +++ b/association.go @@ -98,6 +98,7 @@ func (association *Association) Replace(values ...interface{}) error { for _, ref := range rel.References { updateMap[ref.ForeignKey.DBName] = nil } + association.Error = association.DB.UpdateColumns(updateMap).Error } case schema.HasOne, schema.HasMany: @@ -197,8 +198,7 @@ func (association *Association) Delete(values ...interface{}) error { switch rel.Type { case schema.BelongsTo: - model := reflect.New(rel.Schema.ModelType).Interface() - tx := association.DB.Model(model) + tx := association.DB.Model(reflect.New(rel.Schema.ModelType).Interface()) _, pvs := schema.GetIdentityFieldValuesMap(association.DB.Statement.Context, reflectValue, rel.Schema.PrimaryFields) if pcolumn, pvalues := schema.ToQueryValues(rel.Schema.Table, rel.Schema.PrimaryFieldDBNames, pvs); len(pvalues) > 0 {