Comments (14)
Any information regarding this — or about a good workaround?
This is a blocker because, e.g., the following code always returns true:
Expr::col(Column::ExpiresAt).gte(Expr::current_timestamp())
from sea-orm.
I'm not sure how to force SeaORM to save model fields in a different format. You can apply a workaround at the level of your query. Something like this (not tested):
Expr::cust_with_expr("unixepoch(?)", Expr::col(Column::ExpiresAt)).gte(Expr::cust("unixepoch('now')"))
According to the documentation you linked, 2024-07-17T17:02:14.727131+00:00
is a valid time value that should be parsed by unixepoch
, even though the formatting doesn't match the default SQLite formatting.
from sea-orm.
According to the documentation you linked,
2024-07-17T17:02:14.727131+00:00
is a valid time value that should be parsed byunixepoch
, even though the formatting doesn't match the default SQLite formatting.
Where? I cannot find a format with milliseconds and timezones.
The datetime() function returns the date and time formatted as YYYY-MM-DD HH:MM:SS or as YYYY-MM-DD HH:MM:SS.SSS if the subsec modifier is used.
And the problem is, there are other applications which also depend on the same data structure. When now seaORM saves all timestamps in a different format this causes problems or at least confusion.
Where is the format defined? Is it on your side or in sqlx?
from sea-orm.
And the problem is, there are other applications which also depend on the same data structure. When now seaORM saves all timestamps in a different format this causes problems or at least confusion.
Sure, I agree, it would be better if SeaORM used the standard format.
Where is the format defined? Is it on your side or in sqlx?
I'm not a maintainer and I'm not familiar with the lower-level part that interacts with SQLx, so I don't know. I just suggested a quick workaround that doesn't require digging into that. If you need to store the right format, then don't use that workaround. I guess, your options are:
- Waiting for someone to answer your question about the format source.
- Figuring that out yourself.
- Executing additional statements to reformat the dates after SeaORM saves them. ActiveModelBehavior::after_save may be a good place to do that automatically, if N+1s won't be an issue for your use case.
I cannot find a format with milliseconds and timezones.
It's this format with T
and milliseconds:
- YYYY-MM-DDTHH:MM:SS.SSS
The timezone is OK, as the doc says two paragraphs ahead:
Formats 2 through 10 may be optionally followed by a timezone indicator of the form "[+-]HH:MM" or just "Z".
It gives this example:
2013-10-07T08:23:19.120Z
from sea-orm.
Executing additional statements to reformat the dates after SeaORM saves them. ActiveModelBehavior::after_save may be a good place to do that automatically, if N+1s won't be an issue for your use case.
This is not an option, as it only creates preventable load.
I'm not a maintainer and I'm not familiar with the lower-level part that interacts with SQLx, so I don't know.
Ok, thanks anyway and then I hope for an answer from a maintainer or similar.
from sea-orm.
Related Issues (20)
- Clarification on Relationship Generation in sea-orm-cli Based on ForeignKey Constraints
- `find_with_related` implicitly adds ordering on `left.id` HOT 3
- In migration use enumeration
- Expose `order_by_with_nulls` in `QueryOrder` trait HOT 3
- Alter enum column with new type (missing USING)
- sea-orm-cli hard codes schema
- Syntax error when including parenthesis in SeaORM HOT 1
- Calling multiple deletes_many results in an additional 100MB of memory without decreasing it
- serde rename_all not working correctly on ActiveModel HOT 2
- Cursor on joined table
- Cannot use column in a like expression
- sea-orm-cli cannot open SQLite db. HOT 1
- Regression of 1.0.0-rc.6 when inserting with binary column HOT 3
- `ValueTypeErr` crash when using `ArrayType::Decimal` that contains `None` entries
- Generated Rust enum ordering does not match underlying database enum ordering HOT 1
- Postgres: SET TRANSACTION ISOLATION LEVEL & ACCESS MODE could be combined into a single statement
- mismatched types, sqlx_postgres::types::oid::Oid>` (as SQL type `OID`) is not compatible with SQL type `INT4` in PostgreSQL
- Vulnerability in the `rsa` (a recursive dependency of SeaORM) HOT 1
- Issue when using `on_conflict` with sqlite HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sea-orm.