jmoiron / sqlx

general purpose extensions to golang's database/sql
http://jmoiron.github.io/sqlx/
MIT License
16.3k stars 1.09k forks source link

BindNamed() should not be deprecated #906

Open ZiyanK opened 11 months ago

ZiyanK commented 11 months ago

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 commented 9 months ago

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.