Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

Commit

Permalink
Fixing reading propertyType as Option
Browse files Browse the repository at this point in the history
  • Loading branch information
amigin committed Sep 20, 2022
1 parent 6591637 commit e7ba678
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/fn_impl_update/fn_update.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
use crate::reflection::StructProperty;
use crate::reflection::{PropertyType, StructProperty};

pub fn fn_update(result: &mut String, fields: &[StructProperty]) {
for property in fields {
if property.has_ignore_if_null_attr() {
if let PropertyType::OptionOf(sub_ty) = &property.ty {
result.push_str("if let Some(sql_value) = self.");
result.push_str(&property.name);

if sub_ty.is_string() {
result.push_str(".as_ref()");
}

result.push_str("{");
crate::postgres_utils::read_value(result, property, "value");
result.push_str("sql_builder.append_field(\"");
Expand Down

0 comments on commit e7ba678

Please sign in to comment.