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

Use String instead of JsonNode for Jsonb snapshot in Entities #148

Open
yuanchen233 opened this issue Oct 3, 2024 · 0 comments
Open

Use String instead of JsonNode for Jsonb snapshot in Entities #148

yuanchen233 opened this issue Oct 3, 2024 · 0 comments

Comments

@yuanchen233
Copy link
Collaborator

All snapshots in database are saved as Jsonb, there are currently two types in Kotlin that can be saved directly as Jsonb, String and jackson.databind.JsonNode. We should switch to String for snapshots in all entity class.

Reasons:

  1. JsonNode will validate the data and ensure a valid json when being created, but we have core/kotlin serializer handles it.
  2. JsonNode is slow, as each json key-value pair is saved as a node. The process time to create a JsonNode increases significantly as the size of snapshot increases.
  3. JsonNode provides the passibility to work with the key-value pairs it contains. However, there are limited usage for this is webservices currently, and we should convert the snapshots into its corresponding domain/datatype before we work with them, or access them directly through database.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant