Hi I want to make my function more modular and eventually wrap it into a closure.
I currently have this function:
def get_all_perfume_by_name_con_sex(query, name, concentration, gender) do
from p in query,
join: j in Fumigate.Fragrance.PerfumeCompanyJoin, where: p.id == j.perfume_id,
where: [perfume_name: ^name,
concentration: ^concentration,
gender: ^gender
],
select: j.company_id
end
I was curious how to pass a module into a function as a parameter more specifically the Fumigate.Fragrance.PerfumeCompanyJoin
line.
Is this possible?
def get_all_perfume_by_name_con_sex_modulename(query, name, concentration, gender, modulename) do
from p in query,
join: j in modulename, where: p.id == j.perfume_id,
where: [perfume_name: ^name,
concentration: ^concentration,
gender: ^gender
],
select: j.company_id
end
Is something like that possible?
I want to eventually wrap the new function into a closure.
Thanks!