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

make it be a sql template #65

Open
fxk2006 opened this issue Oct 22, 2019 · 1 comment
Open

make it be a sql template #65

fxk2006 opened this issue Oct 22, 2019 · 1 comment

Comments

@fxk2006
Copy link

fxk2006 commented Oct 22, 2019

hi,I want make it be a best sql template like this:
step1: define a sql template text
select *
from table
where name=#name
@if age>0 {
and age=#age
or name=#name
@}

step2: when I give one param "name" with value "John",after call your quilktemplate,return a preparedstatment string sql, and a paramslist
select * from table where name=? , [ John]

when I give two params "name=John" and "age=12",it should be like this:

select * from table where name=? and age=? or name=?, [John, 12, John]

I think it should be very usefull.
thanks

@andys
Copy link

andys commented Dec 30, 2021

@fxk2006 Have you tried sqlc ? It does this kind of thing but with many more useful features

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