njord-rs / njord

A versatile, feature-rich Rust ORM ⛵
https://njord.rs
BSD 3-Clause "New" or "Revised" License
409 stars 21 forks source link

id field should be possible to set as Option<T> #58

Closed mjovanc closed 6 months ago

mjovanc commented 7 months ago

We need to implement in the procedural macro so that id fields can be used with Option<T> since we want the user to control if they want to populate the id field when doing an INSERT operation. If you want SQlite to handle autoincrement itself, we don't need to add a value to it.

mjovanc commented 7 months ago

When the macro is implemented we need to filter out those who have None as value here:

https://github.com/njord-rs/njord/blob/master/njord/src/sqlite/insert.rs#L32