Skip to content

Commit

Permalink
next steps
Browse files Browse the repository at this point in the history
  • Loading branch information
kuqmua committed Jan 4, 2025
1 parent cf91b4e commit 5dae97a
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,22 @@ commit: 72a7f5c066a08a77fb91e75abee9f6e79e00e2b8
# }
# },
# {
# "ValueIsContainedWithinRange": {
# "logical_operator": "Or",
# "value": [
# 1970,
# 1,
# 0,
# 0,
# 0,
# 0,
# 0,
# 0,
# 0
# ]
# }
# },
# {
# "IsNull": {
# "logical_operator": "Or"
# }
Expand All @@ -204,37 +220,53 @@ commit: 72a7f5c066a08a77fb91e75abee9f6e79e00e2b8
"pg_range_time_offset_date_time_as_ts_tz_range_not_null": {
"logical_operator": "Or",
"value": [
# {
# "Equal": {
# "logical_operator": "Or",
# "value": {
# "start": {
# "Included": [
# 1970,
# 1,
# 0,
# 0,
# 0,
# 0,
# 0,
# 0,
# 0
# ]
# },
# "end": {
# "Included": [
# 1970,
# 1,
# 0,
# 0,
# 0,
# 0,
# 0,
# 0,
# 0
# ]
# }
# }
# }
# },
{
"Equal": {
"ValueIsContainedWithinRange": {
"logical_operator": "Or",
"value": {
"start": {
"Included": [
1970,
1,
0,
0,
0,
0,
0,
0,
0
]
},
"end": {
"Included": [
1990,
1,
0,
0,
0,
0,
0,
0,
0
]
}
}
"value": [
1980,
1,
0,
0,
0,
0,
0,
0,
0
]
}
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4347,7 +4347,7 @@ impl RangeType {
Self::SqlxPostgresTypesPgRangeSqlxTypesChronoNaiveDateTime => quote::quote!{sqlx::types::chrono::NaiveDateTime},
Self::SqlxPostgresTypesPgRangeSqlxTypesChronoNaiveDate => quote::quote!{sqlx::types::chrono::NaiveDate},
Self::SqlxPostgresTypesPgRangeSqlxTypesDecimal => quote::quote!{sqlx::types::Decimal},
Self::SqlxPostgresTypesPgRangeSqlxTypesTimeOffsetDateTime => quote::quote!{SqlxTypesTimeOffsetDateTime},
Self::SqlxPostgresTypesPgRangeSqlxTypesTimeOffsetDateTime => quote::quote!{sqlx::types::time::OffsetDateTime},
}
}
}
Expand Down Expand Up @@ -10013,35 +10013,35 @@ pub fn postgresql_base_type_tokens_where_element_sqlx_postgres_types_pg_range_sq
}
);

// let value_is_contained_within_range_upper_camel_case = naming::ValueIsContainedWithinRangeUpperCamelCase;
// let postgresql_type_tokens_where_element_value_is_contained_within_range_token_stream = generate_postgresql_type_tokens_where_element_variant_token_stream(
// &ident,
// &value_is_contained_within_range_upper_camel_case,
// &is_nullable,
// ShouldWhereElementFieldsBePublic::True,
// &quote::quote!{pub #value_snake_case: #range_type_token_stream},
// &quote::quote!{#value_snake_case: ::core::default::Default::default()},
// &quote::quote!{
// match #increment_snake_case.checked_add(1) {
// Some(#value_snake_case) => {
// *#increment_snake_case = #value_snake_case;
// Ok(format!(
// "{}({} @> ${})",
// &self.logical_operator.to_query_part(is_need_to_add_logical_operator),
// #column_snake_case,
// #increment_snake_case
// ))
// },
// None => Err(crate::#try_generate_bind_increments_error_named_upper_camel_case::#checked_add_upper_camel_case {
// code_occurence: error_occurence_lib::code_occurence!(),
// })
// }
// },
// &quote::quote!{
// #query_snake_case = #query_snake_case.bind(self.#value_snake_case);
// #query_snake_case
// }
// );
let value_is_contained_within_range_upper_camel_case = naming::ValueIsContainedWithinRangeUpperCamelCase;
let postgresql_type_tokens_where_element_value_is_contained_within_range_token_stream = generate_postgresql_type_tokens_where_element_variant_token_stream(
&ident,
&value_is_contained_within_range_upper_camel_case,
&is_nullable,
ShouldWhereElementFieldsBePublic::True,
&quote::quote!{pub #value_snake_case: #range_type_token_stream},
&quote::quote!{#value_snake_case: sqlx::types::time::OffsetDateTime::UNIX_EPOCH},//here
&quote::quote!{
match #increment_snake_case.checked_add(1) {
Some(#value_snake_case) => {
*#increment_snake_case = #value_snake_case;
Ok(format!(
"{}({} @> ${})",
&self.logical_operator.to_query_part(is_need_to_add_logical_operator),
#column_snake_case,
#increment_snake_case
))
},
None => Err(crate::#try_generate_bind_increments_error_named_upper_camel_case::#checked_add_upper_camel_case {
code_occurence: error_occurence_lib::code_occurence!(),
})
}
},
&quote::quote!{
#query_snake_case = #query_snake_case.bind(self.#value_snake_case);
#query_snake_case
}
);

// let contains_another_range_upper_camel_case = naming::ContainsAnotherRangeUpperCamelCase;
// let postgresql_type_tokens_where_element_contains_another_range_token_stream = generate_postgresql_type_tokens_where_element_variant_token_stream(
Expand Down Expand Up @@ -10605,7 +10605,7 @@ pub fn postgresql_base_type_tokens_where_element_sqlx_postgres_types_pg_range_sq
&{
let mut value: std::vec::Vec<&dyn quote::ToTokens> = vec![
&equal_upper_camel_case,
// &value_is_contained_within_range_upper_camel_case,
&value_is_contained_within_range_upper_camel_case,
// &contains_another_range_upper_camel_case,
// &strictly_to_left_of_range_upper_camel_case,
// &strictly_to_right_of_range_upper_camel_case,
Expand All @@ -10625,7 +10625,7 @@ pub fn postgresql_base_type_tokens_where_element_sqlx_postgres_types_pg_range_sq
#maybe_postgresql_type_tokens_where_element_is_null_token_stream

#postgresql_type_tokens_where_element_equal_token_stream
// #postgresql_type_tokens_where_element_value_is_contained_within_range_token_stream
#postgresql_type_tokens_where_element_value_is_contained_within_range_token_stream
// #postgresql_type_tokens_where_element_contains_another_range_token_stream
// #postgresql_type_tokens_where_element_strictly_to_left_of_range_token_stream
// #postgresql_type_tokens_where_element_strictly_to_right_of_range_token_stream
Expand Down

0 comments on commit 5dae97a

Please sign in to comment.