Create dynamic functions with Macro

You could define a single function, e.g.

insert_process_request(r::Request, T::Type) =
       insert_process_request_highorder(r, request_string[T], 
         get_post_data_user, connect_with_db_module_B, 
         process_user_request, close_db_connection_module_B!)

where request_string is a dictionary mapping request types to strings.

(You could also use other abstractions. If you really want to dispatch on the request types, then the request types could be singleton instances of subtypes of an AbstractRequestType, with a method request_string(request_type) that returns the string.)

1 Like