Replies: 1 comment 1 reply
-
|
Hi @pietrasm, while we do not provide a first class tool for this specific use case, we do provide the tools necessary for you to store any kind of custom data type in the database. You can define a custom representation that conforms to |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am exploring options for storing a date without a time component. Using
Datenormalized to midnight UTC works but introduces imprecise domain modeling and makes it easy to introduce timezone-related bugs. Normalizing to noon UTC mitigates this to some extent, but it still doesn't seem like the right solution.GRDB has
DatabaseDateComponentswith a.YMDformat, but it seems like it cannot be easily used with swift-structured-queries.A custom solution could be easily implemented using a
structwhich stores the data inYYYY-MM-DDformat asTEXTby conforming it toLosslessStringConvertible.Also, I am looking into storing a day of the week which could be easily stored using an enum backed by
Intor anOptionSetfor a set of weekdays.Is there a recommended pattern for handling data like this? It seems like these requirements are common enough that they could warrant native support in the library.
Beta Was this translation helpful? Give feedback.
All reactions