On Saturday, 7 March 2020 at 16:30:59 UTC, Robert M. Münch wrote:
Is this possible at all?

You can use an anonymous lambda to build the string in CTFE:

------------------------------------------

struct S {
    int a;
    bool b;
}

import std;

enum string sql = {
    string s = "CREATE TABLE data(";

    static foreach(f; FieldNameTuple!S) {
        s ~= f ~ ",";
    }

        s ~= ");";
    return s;
} ();

pragma(msg, sql);

------------------------------------------

This prints "CREATE TABLE data(a, b);"

Reply via email to