Create dynamic functions with Macro

Hi @stevengj , I want create functions f2() on a module B, C, D…, but I want define how to create this function at another module A.

Theses modules B, C, D…, uses the same function with the same structure/sequence, but each module have your own implementations of f() function. For example, B can insert an user at DB, C can insert a bank at DB, etc.

@stevengj , the big problem it isn’t generate one function, the real problem is genereate functions for many entities at one call of macro. For example: module B has entities user, sale and payment. I know how to construct these insert functions calling one macro for each entity like:

@create_insert(User, "user")
@create_insert(Sale, "sale")
@create_insert(Payment, "payment")

The problem is:

@create_insert( Dict(User => "user", Sale => "sale", Payment => "payment" ))

I’m trying to do this at webservice REST context to receive requests from the user, but I think is the same problem. At first definition, I simplified the context, because I think the problem happens at multiple contexts and if I coulld define is:

Create a macro that dynamically create k functions by a dictionary/array given at parameter.