@@ -796,7 +796,7 @@ fn build_default_impl_fn<'a>(
796796 let fields_to_defaults = column_name_type_nullable
797797 . map ( |name_typ_nullable| {
798798 format ! (
799- " {name}: {typ_default}" ,
799+ " {name}: {typ_default}" ,
800800 name = name_typ_nullable. name,
801801 typ_default = if name_typ_nullable. nullable {
802802 "None"
@@ -807,11 +807,11 @@ fn build_default_impl_fn<'a>(
807807 } )
808808 . collect :: < Vec < String > > ( )
809809 . join ( ",\n " ) ;
810- format ! (
810+ formatdoc ! (
811811 r#"impl Default for {struct_name} {{
812812 fn default() -> Self {{
813813 Self {{
814- {fields_to_defaults}
814+ {fields_to_defaults}
815815 }}
816816 }}
817817}}"#
@@ -824,6 +824,8 @@ pub fn generate_for_table(table: &ParsedTableMacro, config: &GenerationConfig) -
824824 let struct_name = & table. struct_name ;
825825 let table_options = config. table ( & table. name . to_string ( ) ) ;
826826 let generated_columns = table_options. get_autogenerated_columns ( ) ;
827+ println ! ( "struct_name: {}" , struct_name) ;
828+ println ! ( "&table.name: {}" , & table. name) ;
827829 let not_generated = |col : & & ParsedColumnMacro | -> bool {
828830 !generated_columns. contains ( & col. column_name . as_str ( ) )
829831 } ;
@@ -847,11 +849,16 @@ pub fn generate_for_table(table: &ParsedTableMacro, config: &GenerationConfig) -
847849 ret_buffer. push_str (
848850 build_default_impl_fn (
849851 & StructType :: format ( & StructType :: Create , & struct_name) ,
850- create_struct. fields ( ) . iter ( ) . map ( |col| NameTypNullable {
851- name : col. name . to_owned ( ) ,
852- typ : col. base_type . as_str ( ) ,
853- nullable : col. is_optional ,
854- } ) ,
852+ create_struct
853+ . table
854+ . columns
855+ . iter ( )
856+ . filter ( not_generated)
857+ . map ( |col| NameTypNullable {
858+ name : col. column_name . to_string ( ) ,
859+ typ : col. ty . as_str ( ) ,
860+ nullable : col. is_nullable ,
861+ } ) ,
855862 )
856863 . as_str ( ) ,
857864 ) ;
@@ -879,7 +886,7 @@ pub fn generate_for_table(table: &ParsedTableMacro, config: &GenerationConfig) -
879886 table
880887 . columns
881888 . iter ( )
882- . filter ( not_generated)
889+ // .filter(not_generated)
883890 . map ( |col| NameTypNullable {
884891 name : col. name . to_string ( ) . to_owned ( ) ,
885892 typ : col. ty . as_str ( ) ,
0 commit comments