Genie Discord forum
Hey everyone, is it possible with the new Reactive API to use a macro to reuse a block of fields for multiple models?
For example, can I create a macro somehow that will pass
universalfield1::String = "field1" universalfield2::String = "field2" universalfield3::String = "field3"
@vars Model1 begin @universalFieldsMacro # ??? field4::String = "field4" end
and also elsewhere into this:
@vars Model2 begin @universalFieldsMacro # ??? field5::String = "field5" end
I can't seem to crack it. I had something working before moving to the new API but I don't know enough about metaprogramming to adjust. Is it possible? Is there a better way?
you could try putting all universalfield strings into a UniversalFields struct, and then use that within @vars