SORT BY created_at, updated_at which are of type TEXT #26
-
Hello! First of all, thank you for such opportunity to learn how to design better application for better developer experience. Now straight to the point: you store time.Time in database as TEXT, precisely as RFC3339 formatted TEXT. How does the database understand how to sort RFC3339 TEXTs? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hello! Good question. SQLite doesn't have a
If you're using Postgres or MySQL then you can use their |
Beta Was this translation helpful? Give feedback.
Hello! Good question. SQLite doesn't have a
TIMESTAMP
data type but fortunately RFC3339/ISO8601 is naturally lexicographically sortable:If you're using Postgres or MySQL then you can use their
TIMESTAMP
data type directly. Although, if you're using SQLite, it does provide helper functio…