Let’s say I have an API that updates user information. The parameters passed in different scenarios are also different, and only passed in some places.Name, sex, there are places are passed onName, height, weight,
conn.query('UPDATE user SET xx=? , xx=? , xx=? WHERE xxx=? AND status=0', [xx, xx, xx, xxx], ...
If I don’t want to pass
if-elseRespectively execute different
conn.queryHow do I put different situations
updateAll written to one
No. even if you write if else, you don’t have many lines of code. if else you write ifelse in js or sql.