Hello Team,
I am new to clojure and I wanted to write a function where input from map keys are passed as parameter as input to the sql query.
(def query-body1 "
select first_name, last_name
from ${table_name}
where
person_id=${person_id}
order by ${id}
")
(def query-body2 "
select first_name, last_name
from ${table_name}
where
person_id=${person_id},
and first_name=${first_name},
and last_name=${last_name},
order by ${id}
")
(functiona-name query-body1 (:table_name "Employee", :person_id 123, id: "ABC"))
(functiona-name query-body2 (:table_name "Employee", :person_id 123, :first_name "John", :last_name "David", id: "ABC"))
output should be
select first_name, last_name
from Employee
where
person_id=123,
and first_name=John,
and last_name=David,
order by ${id}
How can I achieve this?
Thanks,
Ganesh N