Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BindNamed() should not be deprecated #906

Open
ZiyanK opened this issue Dec 9, 2023 · 1 comment
Open

BindNamed() should not be deprecated #906

ZiyanK opened this issue Dec 9, 2023 · 1 comment

Comments

@ZiyanK
Copy link

ZiyanK commented Dec 9, 2023

I want to be able to use the Named() function for postgresql but the return value only uses the ? bindvar and not '$' bindvar.
BindNamed() allows me to specify the bindvar whichever I prefer.

https://github.com/jmoiron/sqlx/blob/master/named.go#L410

Is there any reason for it to be deprecated?

@jwendel
Copy link

jwendel commented Feb 21, 2024

I believe it's because not all databases support the $ syntax for named bindvars. While ? is support by all DBs. What the Named function provides is just a way for SQLX to do the substitution/ordering of bindvars for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants