Skip to content

Commit

Permalink
fix(gorm-chain) Fix gorm Model.Save chain issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmetcanozcan committed Sep 6, 2024
1 parent 115da23 commit 99aee02
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/orm/repository/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 99aee02

Please sign in to comment.