You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Alright, I want to propose a new, drastic feature. Just wanted to throw the idea out there. I've seen other ORMs in Rust, but nothing like this idea.
There is a Rust lib out there called Pest (https://pest.rs/), the concept is super interesting.
The concept is you have a grammar file the defines what you're parsing and map it to a struct at compile time.
The grammar file essentially is compiled with the code:
Then we could have as complex of a query as we want abstracted into it's own isolated sql directory/file and usage of that query could be like this:
fnmain(){let url = "mysql://njord_user:njord_password@localhost:3306/njord_db";letmut conn = mysql::open(url).unwrap();letmut params = HashMap::new();
params.insert("name_limited".to_string(),"Eros".to_string());let query_results = near_earth_objects::NeoParser::params(params).exec(&mut conn);// If you want them converted to actual defined structslet results:Vec<NearEarthObjects> = query_results.convert()}
Thoughts?
The text was updated successfully, but these errors were encountered:
Alright, I want to propose a new, drastic feature. Just wanted to throw the idea out there. I've seen other ORMs in Rust, but nothing like this idea.
There is a Rust lib out there called Pest (https://pest.rs/), the concept is super interesting.
The concept is you have a grammar file the defines what you're parsing and map it to a struct at compile time.
The grammar file essentially is compiled with the code:
They then implemented a macro which pulls that file in at compile time, parses it, and in this case
tokenizes it.
What if we take a similar approach:
Then we could have as complex of a query as we want abstracted into it's own isolated sql directory/file and usage of that query could be like this:
Thoughts?
The text was updated successfully, but these errors were encountered: