From d95ad7b49d6fc20a821175af3c13de6df3908589 Mon Sep 17 00:00:00 2001 From: greencoda Date: Wed, 8 May 2024 02:15:02 +0200 Subject: [PATCH] Add public BuildCondition method for associations --- association.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/association.go b/association.go index 7c93ebea..3f9c738b 100644 --- a/association.go +++ b/association.go @@ -41,6 +41,16 @@ func (db *DB) Association(column string) *Association { return association } +func (association *Association) BuildCondition() *DB { + if association.Error != nil { + tx := association.DB + tx.Error = association.Error + return tx + } + + return association.buildCondition() +} + func (association *Association) Unscoped() *Association { return &Association{ DB: association.DB,