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 u64 serialization of Snowflake for non human-readable serializers #2966

Open
wants to merge 1 commit into
base: current
Choose a base branch
from

Conversation

majkrzak
Copy link

@majkrzak majkrzak commented Sep 1, 2024

Snowflake deserialization uses serde::de::Deserializer deserialize_any method, which may not be provided by some formats and according the documentation should not be relied on. This for example causes UserID fail to serialize with bincode, effectively preventing storing it in native_db.

Currently serde seems not to support easy way to determinate if deserialize_any is supported or not. Although is_human_readable is provided for both Serializer and Deserializer traits.

This PR bypasses requirement of having deserialize_any available, by serializing and deserializing Snowflake values as u64 for non human-readable formats. This additionally optimizes its storage size for such formats.

@github-actions github-actions bot added the model Related to the `model` module. label Sep 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
model Related to the `model` module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant