what is missing here?
ag0aep6g via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue May 3 09:13:07 PDT 2016
On 03.05.2016 18:03, Jonathan Villa wrote:
> public final class accounts
> {
> public:
> static table_user user;
> }
>
> public final class table_user
> {
> private:
> static uint32 dummy1;
> static string dummy2;
> static DateTime dummy3;
> static ubyte dummy4;
> public:
> static @property auto user_id_t() { return typeof(dummy1); }
> static @property auto name_t() { return typeof(dummy2); }
> static @property auto alias_t() { return typeof(dummy2);}
> static @property auto pers_email_t() { return typeof(dummy2); }
> static @property auto corp_email_t() { return typeof(dummy2); }
> static @property auto password_t() { return typeof(dummy2); }
> static @property auto last_login_t() { return typeof(dummy3); }
> static @property auto active_t() { return typeof(dummy4); }
> static @property auto id_lang_t() { return typeof(dummy4); }
> static @property auto function_t() { return typeof(dummy4); }
> static @property auto register_date_t() { return typeof(dummy3); }
> }
>
> for every property it throws me an error at compile time: type ($) has
> no value.
> I'm trying to do a wrap of a database so when getting a resultset using
> mysql-native I can do
> result.front()[0].get!(accounts.user.user_it_t);
> si it's more readable.
Types are not values. You cannot return a type from a function. Use
aliases instead:
----
alias user_id_t = typeof(dummy1);
alias name_t = typeof(dummy2);
/* ... etc ... */
----
More information about the Digitalmars-d-learn
mailing list