Open thomcc opened 2 years ago
A rough cut of this is https://github.com/thomcc/pgx/tree/attr-pg_guard. For some reason, it hits linker errors in other functions -- it's likely this approach is slightly too clever.
I have other things I wanted to work on today, so I'll come back to this later (maybe later today or tomorrow).
As an update, this works on the top level but the wrapper still seems to wonkify the argument if any attempt to apply attributes to the arguments (like cfg, in https://github.com/tcdi/pgx/pull/800) is done.
In https://github.com/tcdi/pgx/pull/793#issuecomment-1285718887 I wanted to do
But couldn't because
#[pg_guard]
doesn't preserve attributes. It would be relatively simple to preserve them here: https://github.com/tcdi/pgx/blob/98ff0729c24f415b84814eb6c539d387146e4326/pgx-utils/src/rewriter.rs#L109-L111, although perhaps there's an argument that some should go on the parent (like#[doc]
).This is a pretty small nit, so I'm punting on it for now, but wanted to file the issue so I could come back to it later.