Electron100 / butane

An ORM for Rust with a focus on simplicity and on writing Rust, not SQL
Apache License 2.0
83 stars 11 forks source link

Cfg Attributes on Model Fields Not Properly Handled #150

Open Electron100 opened 8 months ago

Electron100 commented 8 months ago

148 duplicated the Post and PostMetadata model/dataresult types in the blog test, one for if datatime is enabled and one for if it is not. That shouldn't have been necessary -- it should be possible simply to use #cfg attributes on the field. Unfortunately, the model attribute is processed before the cfg attribute and Butane doesn't propagate the cfg properly and ends up creating references to the field that is ultimately omitted. We should check for the cfg attribute and if so propagate it to all references we create to the field.