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

feat: add macro to generate ToEncryptable trait #6313

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

dracarys18
Copy link
Member

@dracarys18 dracarys18 commented Oct 14, 2024

Type of Change

  • Enhancement

Description

This PR adds a macro to generate ToEncryptable trait on different types

Motivation and Context

This PR removes the effort of repetitively implementing ToEncryptable trait which is used for batch encryption/decryption in the encryption service by adding a macro which generates code upon deriving it

How did you test it?

THIS CANNOT BE TESTED ON SANDBOX

  • Compiler guided. Since this does not change any core flow
  • Basic test of MerchantCreate and Payments for sanity

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code

@dracarys18 dracarys18 added A-core Area: Core flows S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Oct 14, 2024
@dracarys18 dracarys18 added this to the October 2024 Release milestone Oct 14, 2024
@dracarys18 dracarys18 self-assigned this Oct 14, 2024
@dracarys18 dracarys18 requested review from a team as code owners October 14, 2024 17:27
Copy link

semanticdiff-com bot commented Oct 14, 2024

Review changes with SemanticDiff.

Analyzed 19 of 19 files.

Overall, the semantic diff is 35% smaller than the GitHub diff.

Filename Status
✔️ crates/router_derive/src/lib.rs Analyzed
✔️ crates/router_derive/src/macros.rs Analyzed
✔️ crates/router_derive/src/macros/to_encryptable.rs Analyzed
✔️ crates/router/src/utils.rs 46.03% smaller
✔️ crates/router/src/types/domain/address.rs 25.61% smaller
✔️ crates/router/src/types/domain/event.rs 50.74% smaller
✔️ crates/router/src/core/admin.rs 91.59% smaller
✔️ crates/router/src/core/customers.rs 69.61% smaller
✔️ crates/router/src/core/payouts/helpers.rs 60.27% smaller
✔️ crates/router/src/core/payments/helpers.rs 60.3% smaller
✔️ crates/router/src/core/payments/operations/payment_create.rs 68.4% smaller
✔️ crates/hyperswitch_domain_models/src/customer.rs 38.7% smaller
✔️ crates/hyperswitch_domain_models/src/merchant_connector_account.rs 23.81% smaller
✔️ crates/hyperswitch_domain_models/src/payments.rs 53.23% smaller
✔️ crates/hyperswitch_domain_models/src/payments/payment_intent.rs Analyzed
✔️ crates/diesel_models/src/address.rs 8.86% smaller
✔️ crates/diesel_models/src/events.rs 10.29% smaller
✔️ crates/api_models/src/customers.rs 8.53% smaller
✔️ crates/api_models/src/payments.rs 0.08% smaller

@dracarys18 dracarys18 linked an issue Oct 14, 2024 that may be closed by this pull request
ArjunKarthik
ArjunKarthik previously approved these changes Oct 15, 2024
Copy link
Member

@SanchithHegde SanchithHegde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than that, looks good to me!

crates/router_derive/src/macros/to_encryptable.rs Outdated Show resolved Hide resolved
SanchithHegde
SanchithHegde previously approved these changes Oct 15, 2024
ArjunKarthik
ArjunKarthik previously approved these changes Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core flows S-waiting-on-review Status: This PR has been implemented and needs to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEAT] add a macro to derive ToEncryptable trait
4 participants