-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
T-langRelevant to the language team, which will review and decide on the RFC.Relevant to the language team, which will review and decide on the RFC.
Description
Issue by s-panferov
Monday Oct 20, 2014 at 18:12 GMT
For earlier discussion, see rust-lang/rust#18191
This issue was labelled with: B-RFC in the Rust repository
I started to write some simple ORM for test purposes and i'm very interested in ability to make some dynamic code generation that could replace Ruby's method_missing.
Pseudo-code to illustrate the idea:
impl UserModel {
pub fn macro_method (find_by, $($field_name:ident)_and_+) (&self, $($field_value:expr),+) -> SelectQuery {
self.select_all().where_(
$(
self.$field_name().is($field_value),
)
)
}
}
let query = user_model.find_by_id!(100u);
let query = user_model.find_by_first_name_and_last_name!("Luke", "Skywalker");What do you think about that? I you not interested please close this issue and never mind.
kennytm and lilith
Metadata
Metadata
Assignees
Labels
T-langRelevant to the language team, which will review and decide on the RFC.Relevant to the language team, which will review and decide on the RFC.