I want to transmit the class name and the member name in the method

Brian zoujiaqing at gmail.com
Fri Jan 5 21:46:27 UTC 2018


On Friday, 5 January 2018 at 15:38:17 UTC, Binghoo Dang wrote:
> On Friday, 5 January 2018 at 07:40:14 UTC, Brian wrote:
>> I think code style like:
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>
>> struct User
>> {
>>     int id;
>>     string name;
>>     string email;
>> }
>>
>> class ORM
>> {
>> }
>>
>> auto db = new ORM;
>> auto users = 
>> db.select(User).where(email.like("*@hotmail.com")).limit(10);
>>
>> foreach(user; users)
>> {
>>     writeln("user: " + user.name + "\n");
>> }
>>
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>
>> this rust code is support it:
>> https://github.com/diesel-rs/diesel/blob/master/examples/postgres/all_about_updates/src/lib.rs
>
> there's entity library exist in D Dub, which is an ORM 
> framework, you may read the code for reference:
>
> https://code.dlang.org/packages/entity

Yes, [entity] is my team's project, I want it to be simpler :)


More information about the Digitalmars-d-learn mailing list