Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(engine): pk uuid #6801

Merged
merged 1 commit into from
Jan 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions engine/gorpmapper/encryption.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,10 @@ func (m *Mapper) getEncryptedSliceData(ctx context.Context, db gorp.SqlExecutor,

// Find the right target against the primary key
primaryKeyReference := reflectFindValueByTag(targetSlice.Interface(), "db", key)

// Check the primary key known the from target slice and from the database
if reflect.DeepEqual(primaryKeyReference, newPk) {
// the pk could be a []uint8. If it's the case, string values are compared
if reflect.DeepEqual(primaryKeyReference, newPk) || primaryKeyReference == fmt.Sprintf("%s", newPk) {
targetSliceFound = true
// Decrypt all the contents
for idx := range mapping.EncryptedFields {
Expand All @@ -327,7 +329,7 @@ func (m *Mapper) getEncryptedSliceData(ctx context.Context, db gorp.SqlExecutor,
}
}
if !targetSliceFound {
return sdk.WithStack(fmt.Errorf("unmatched element with pk %T %v (%v)", newPk, newPk, pks))
return sdk.WithStack(fmt.Errorf("unmatched element with pk type:%T - value:%v - pks:%v", newPk, newPk, pks))
}
}

Expand Down