Query with conditional logic

Hello,
I would like to build a query, whose logic depends on a specific field. For example, I have data like this:

username: Name1
description: desc1

username: Name2
info: info1

I would like to build a query that matches for "desc1" if username=="Name1" and "info1" if username=="Name2".

What functionality could I employ to achieve this or something similar?