From 99aee02b1f16674aaa7dc51de5a6295c7fc9c1b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmetcan=20=C3=96ZCAN?= Date: Fri, 6 Sep 2024 14:00:06 +0300 Subject: [PATCH] fix(gorm-chain) Fix gorm Model.Save chain issue --- modules/orm/repository/repository.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/orm/repository/repository.go b/modules/orm/repository/repository.go index 52fecca..352eac0 100644 --- a/modules/orm/repository/repository.go +++ b/modules/orm/repository/repository.go @@ -62,12 +62,12 @@ func (r *repository[Id, T]) Update(ctx context.Context, q query.Query, update an } func (r *repository[Id, T]) Save(ctx context.Context, t *T) (*T, error) { - err := r.Context(ctx).Clauses(clause.Returning{}).Save(t).Error + err := r.gp.Get(ctx).Clauses(clause.Returning{}).Save(t).Error return t, err } func (r *repository[Id, T]) SaveAll(ctx context.Context, ts []*T) error { - return r.Context(ctx).Save(ts).Error + return r.gp.Get(ctx).Save(ts).Error } func (r *repository[Id, T]) DeleteByID(ctx context.Context, id Id) error {