Skip to content

Commit

Permalink
fix: use JOIN instead of iterative queries
Browse files Browse the repository at this point in the history
See #2402
  • Loading branch information
aeneasr committed May 13, 2022
1 parent 5277668 commit 0998cfb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion persistence/sql/persister_identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ func (p *Persister) DeleteIdentity(ctx context.Context, id uuid.UUID) error {

func (p *Persister) GetIdentity(ctx context.Context, id uuid.UUID) (*identity.Identity, error) {
var i identity.Identity
if err := p.GetConnection(ctx).Where("id = ? AND nid = ?", id, corp.ContextualizeNID(ctx, p.nid)).First(&i); err != nil {
if err := p.GetConnection(ctx).EagerPreload("VerifiableAddresses", "RecoveryAddresses").Where("id = ? AND nid = ?", id, corp.ContextualizeNID(ctx, p.nid)).First(&i); err != nil {
return nil, sqlcon.HandleError(err)
}

Expand Down

0 comments on commit 0998cfb

Please sign in to comment.