Dynamic filter and map function

What is solution for dynamic SQL we generate, for instance consider a filter form which has all fields that user can filter ( customer name, tel, address, state,…)
in sql world I would generate a dynamic sql condition part by fields that user has filled out.

select *
from x
where [condition1] and [condition2] and [condition3]

conditions are optional and will be concatenate in runtime.
consider the number of options is predefined for example there are only 3 options which can participate in condition part and options are not infinite.
what is the best solution for these kind of situation?

[duplicated and best continued in the mobile section]
https://www.couchbase.com/forums/t/dynamic-key-generation-in-map-function?source_topic_id=3995