-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing DateTime as Timestamp performance issue
- Loading branch information
Showing
10 changed files
with
63 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use my_postgres::macros::WhereDbModel; | ||
use rust_extensions::date_time::DateTimeAsMicroseconds; | ||
|
||
#[derive(WhereDbModel)] | ||
pub struct FindOlderThanPsqlWhere { | ||
#[operator("<")] | ||
#[sql_type("timestamp")] | ||
#[db_column_name("created_at")] | ||
pub created_at: DateTimeAsMicroseconds, | ||
#[limit] | ||
pub limit: usize, | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use my_postgres::{sql::SqlValues, sql_where::SqlWhereModel}; | ||
use rust_extensions::date_time::DateTimeAsMicroseconds; | ||
|
||
use super::FindOlderThanPsqlWhere; | ||
|
||
#[test] | ||
fn test() { | ||
let where_model = FindOlderThanPsqlWhere { | ||
created_at: DateTimeAsMicroseconds::from_str("2024-05-12T12:34:56.789012").unwrap(), | ||
limit: 10, | ||
}; | ||
|
||
let mut params = SqlValues::new(); | ||
let mut sql = String::new(); | ||
where_model.fill_where_component(&mut sql, &mut params); | ||
|
||
println!("sql: {}", sql); | ||
} | ||
} |