-
Notifications
You must be signed in to change notification settings - Fork 87
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
format: support formatting time.Time as RFC3339Nano #1063
Comments
Could anyone please have a look at that? |
Updating ogen after a while and realized that |
This is also becoming a higher priority for me. |
Sure, why not. I was thinking of extension like |
@tdakkota that would work too. We actually need nano precision on all our timestamps though, so how would you feel about having both? If you'd rather have only the extension that's fine too as we could just create a custom type with the extension and reference that everywhere we need a timestamp but the former would be a nice touch. |
I am fine with config option. We may add an extension later, if there is some interest to it. |
Would you be in favour of an option that just switches it to nano (i.e. a boolean option), or would you prefer that people can input any format string? |
Friendly bump @tdakkota 🙂 |
A string option seems to be a better solution, since it is useful in case when third-party APIs/client use an odd |
Description
Currently,
date-time
format usesRFC3339
. It would be nice if it were possible to format isRFC3339Nano
, perhaps by adding a customdate-time-nano
format, or adding a generator option. While there is naturally a limit to how many bespoke formats this generator can support, I believe this one is particularly helpful because the default JSON marshaling of Golang fortime.Time
is actuallyRFC3339Nano
, which means that there is some friction in migrating existing codebases to ogen which may be using default JSON marshaling, even via some framework like Gin, and having no way withoutCustomFormat
to reproduce the same behavior with ogen.The text was updated successfully, but these errors were encountered: