Query Parameters outside the WHERE clause?

Is it possible to use query parameters outside of the WHERE clause? I’m using the Rust SDK, and queries like this:

SELECT foo.* FROM `foo` WHERE typeName=$type_name ORDER BY $order_by

Ignore the $order_by item. Is this a known limitation?

Query parameters can be used any place in the query.
Query paramaters are for values only not for field names or identifiers.
ORDER BY expr, exp2 are meant for expression on field names .
In above case $order_by is value (i.e constant) same across all documents. which means NO-OP. Optimizer detects this removes constants from ORDER BY, eventually it can result in NO ORDER
The following is valid

SELECT  f1 + $f1 AS nf1, 
FROM `foo` 
WHERE typeName=$type_name 
ORDER BY  f2 + $f2

If you are looking ORDER some time fname, some time lname Try this.

SELECT d.*
FROM default AS d
WHERE d.type = $type_name
ORDER BY d.[$ofield];

$ofield must be string that represents field name in the document. (i.e. $ofield = "fname" or "lname")
This dynamic field names. After dot if array brackets present, it evaluates expression  in array brackets, 
if  not a sting raises error. If string convert that into  identifier(field) and uses  that evaluate expression.
 $ofield = "fname"  it becomes d.fname,  $ofield = "lname"  it becomes d.lname

Thanks! That makes sense.