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

Provide a way to serialize DateTime using millis or micros #153

Open
robertcoltheart opened this issue Apr 4, 2024 · 2 comments
Open

Provide a way to serialize DateTime using millis or micros #153

robertcoltheart opened this issue Apr 4, 2024 · 2 comments
Labels
add docs Extend readme or documentation

Comments

@robertcoltheart
Copy link
Contributor

Describe the solution you'd like
We have a need to serialize DateTime values as a millis logical type, not micros, which is the default. There isn't a way to select a different logical type that I can see.

Describe implementation idea
Perhaps a LogicalTypeAttribute with a way to select a specific logical type for a property would be the way to go? I'm not sure what other mechanism could solve this, though you may perhaps have some ideas.

@AdrianStrugala
Copy link
Owner

Hey,
Maybe it would make sense to create a fully flexible AvroTypeAttribute. I will check out the options.
Best,
Adrian

@AdrianStrugala AdrianStrugala added the feature New feature or request label Apr 5, 2024
@AdrianStrugala
Copy link
Owner

Hello @robertcoltheart

Thank you for your contribution. The new feature is available from v.3.4.7 of AvroConvert.
Example usage:

    public class TypeAttributeClass
    {
        [AvroType(AvroTypeRepresentation.Double)]
        public int Int;

        [AvroType(AvroTypeRepresentation.TimestampMilliseconds)]
        public DateTime DateTime;
    }

Regards,
Adrian

@AdrianStrugala AdrianStrugala reopened this May 8, 2024
@AdrianStrugala AdrianStrugala added add docs Extend readme or documentation and removed feature New feature or request labels May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add docs Extend readme or documentation
Projects
None yet
Development

No branches or pull requests

2 participants