Add case-insensitive ordering
This commit is contained in:
@@ -401,10 +401,13 @@ module Query =
|
||||
{ it with Name = parts[0] }, Some $" {parts[1]}"
|
||||
else it, None)
|
||||
|> Seq.map (fun (field, direction) ->
|
||||
match dialect, field.Name.StartsWith "n:" with
|
||||
| PostgreSQL, true -> $"({ { field with Name = field.Name[2..] }.Path PostgreSQL})::numeric"
|
||||
| SQLite, true -> { field with Name = field.Name[2..] }.Path SQLite
|
||||
| _, _ -> field.Path dialect
|
||||
if field.Name.StartsWith "n:" then
|
||||
let f = { field with Name = field.Name[2..] }
|
||||
match dialect with PostgreSQL -> $"({f.Path PostgreSQL})::numeric" | SQLite -> f.Path SQLite
|
||||
elif field.Name.StartsWith "i:" then
|
||||
let p = { field with Name = field.Name[2..] }.Path dialect
|
||||
match dialect with PostgreSQL -> $"LOWER({p})" | SQLite -> $"{p} COLLATE NOCASE"
|
||||
else field.Path dialect
|
||||
|> function path -> path + defaultArg direction "")
|
||||
|> String.concat ", "
|
||||
|> function it -> $" ORDER BY {it}"
|
||||
|
||||
Reference in New Issue
Block a user