Parameterize the SELECT list using the query mod system? #1248
-
Is there a way to parameterize the SELECT list using the query mod system? Example query that needs the SELECT list parameterized: SELECT SIMILARITY(name, $1) AS sim_score
WHERE name % $1
ORDER BY sim_score DESC My real query is a bit more complex then the example above and I would like to use the query mod system rather than raw SQL. However, the It would nice to have a variant like query = append(query, SelectParams("SIMILARITY(name, ?) AS sim_score", search)) Alternatively, does sqlboiler provide any string escape functions? Maybe something like: safeSearch := EscapeString(search)
query = append(query, Select(fmt.Sprintf("SIMILARITY(name, '%s') AS sim_score", safeSearch))) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
As far as I know, SQL itself does not let you parameterize select lists. You can try to test this by using SQLBoiler does not provide any string escape functions by itself. |
Beta Was this translation helpful? Give feedback.
As far as I know, SQL itself does not let you parameterize select lists.
You can try to test this by using
*sql.DB.QueryContext
with your parameters where you want them to be.SQLBoiler does not provide any string escape functions by itself.