Masterminds / squirrel

Fluent SQL generation for golang
Other
6.67k stars 458 forks source link

How to reuse same wherePart? #344

Closed gerardhb closed 1 year ago

gerardhb commented 1 year ago

I want to find page list and count with where condtion. but I don't know how to build a wherePart and reuse it in select(columns...) and select(count(*)). I want to build where condition by reflect. but reflection performance is poor. I don't want it to reflect twice.

lann commented 1 year ago

Reflection is not slow compared to database access. That said, you should be able to use Expr for this.

gerardhb commented 1 year ago

Reflection is not slow compared to database access. That said, you should be able to use Expr for this.

thank you reply. Your reply is very useful to me. I solved my question