Open
Description
apart from the predefined where clause, it needs somehow to be able to support passing a string containing a filter clause that it's parameters are already resolved prior to the Query function, I proposed a possible solution to be able to declare in the sql definition something like this
-- name: ListOrders :many
select * from order where status = $1 and (@filter::text);
Generated
const listOrders = "select * from order where status = $1 and (@filter::text);"
type ListOrdersParams struct {
Status string
Filter string
}
func (q *Queries) ListOrders(ctx context.Context, arg ListOrdersParams) ([]*ListOrdersRow, error) {
filter:=arg.Filter
if filter=="" {
filter = "1=1"
}
listOrdersWithFilter = strings.Replace(listOrders, "@filter::text", filter, -1)
rows, err := q.db.Query(ctx, listOrdersWithFilter, arg.Status)
...
What database engines need to be changed?
PostgreSQL, MySQL
What programming language backends need to be changed?
Go, Python, Kotlin