Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
```code|q
'id,city,country' |> importRequestParams
var limit = qs.limit ?? 100
var sql = 'select Id, CompanyName, ContactName, ContactTitle, City, Country from Customer'
#if !PathArgs.isEmpty()
`${sql} where Id = @id` |> dbSingle({ id: PathArgs[0] }) |> return
/if
var filters = []
'Id = @id' |> ifExists(id) |> addTo => filters
'City = @city' |> ifExists(city) |> addTo => filters
'Country = @country' |> ifExists(country) |> addTo => filters
#if !filters.isEmpty()
sql = `${sql} WHERE ${filters.join(' AND ')}`
/if
sql = `${sql} ORDER BY CompanyName ${sqlLimit(limit)}`
sql |> dbSelect({ id, city, country }) |> return
```