Skip to content

Ability to change macros namespace #3943

@bobozaur

Description

@bobozaur

I have found these related issues/pull requests

N/A

Description

Proc macros that SQLx provides are hardcoded to look for paths in the ::sqlx namespace.

It would be great to be able to configure that somehow, so that external drivers could re-export the sqlx API yet be more independent in the sense that using them would not require having the sqlx crate in the namespace. Moreover, external drivers could even have the ability to customize various aspects of the framework by extending the vanilla sqlx implementations, like the ty_match module.

Prefered solution

Probably the way to go is to extend the proc macros core functions in sqlx-macros-core so that they take a namespace argument.

The only workaround to this situation right now is to either do something like extern crate sqlx_external as sqlx; to provide the expected namespace or use a different name in Cargo.toml and making use of the package key. But both would prevent users of external drivers to use both those and sqlx itself.

Is this a breaking change? Why or why not?

Should not be. Nothing would change for sqlx direct users. This is meant to be a customization available to 3rd party driver developers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions