- Notifications
You must be signed in to change notification settings - Fork 954
Open
Labels
Description
the order by clause in the :many definition query should be set dynamically
-- name: ListOrders :many select * from order where status = $1 order by @orderBy::text;
Generated
const listOrders = "select * from order where status = $1 order by @orderBy::text"
type ListOrdersParams struct { Status string OrderBy string }
func (q *Queries) ListOrders(ctx context.Context, arg ListOrdersParams) ([]*ListOrdersRow, error) { orderBy:=arg.OrderBy if orderBy=="" { orderBy= "0" } listOrdersWithOrderBy = strings.Replace(listOrders, "@orderBy::text", orderBy, -1) rows, err := q.db.Query(ctx, listOrdersWithOrderBy, arg.Status) ...
What database engines need to be changed?
PostgreSQL, MySQL
What programming language backends need to be changed?
Go, Python, Kotlin
matbur, piotrekmonko, silver-brother, YamiOdymel, mfridman and 25 more