Postgres' built-in `lower` in `eq` query ?

Can I do something like this
.eq("username", `lower(${username})`);

or would I need a DB function and call it via rpc to do this?

I've got a unique lower index
CREATE UNIQUE INDEX idx_username ON public.profile(lower(username))
Was this page helpful?