Version 4 #6
|
@ -308,6 +308,11 @@ module Query =
|
||||||
let parts = it.Name.Split ' '
|
let parts = it.Name.Split ' '
|
||||||
{ it with Name = parts[0] }, Some $" {parts[1]}"
|
{ it with Name = parts[0] }, Some $" {parts[1]}"
|
||||||
else it, None)
|
else it, None)
|
||||||
|> Seq.map (fun (field, direction) -> field.Path dialect + defaultArg direction "")
|
|> Seq.map (fun (field, direction) ->
|
||||||
|
let path =
|
||||||
|
if dialect = PostgreSQL && field.Name.StartsWith "n:" then
|
||||||
|
$"({ { field with Name = field.Name[2..] }.Path dialect})::numeric"
|
||||||
|
else field.Path dialect
|
||||||
|
path + defaultArg direction "")
|
||||||
|> String.concat ", "
|
|> String.concat ", "
|
||||||
|> function it -> $" ORDER BY {it}"
|
|> function it -> $" ORDER BY {it}"
|
||||||
|
|
|
@ -602,12 +602,12 @@ let integrationTests =
|
||||||
Expect.equal results [] "There should have been no documents returned"
|
Expect.equal results [] "There should have been no documents returned"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
testList "allOrdered" [
|
ftestList "allOrdered" [
|
||||||
ptestTask "succeeds when ordering numerically" {
|
testTask "succeeds when ordering numerically" {
|
||||||
use db = PostgresDb.BuildDb()
|
use db = PostgresDb.BuildDb()
|
||||||
do! loadDocs ()
|
do! loadDocs ()
|
||||||
|
|
||||||
let! results = Find.allOrdered<JsonDocument> PostgresDb.TableName [ Field.EQ "NumValue" 0 ]
|
let! results = Find.allOrdered<JsonDocument> PostgresDb.TableName [ Field.Named "n:NumValue" ]
|
||||||
Expect.hasLength results 5 "There should have been 5 documents returned"
|
Expect.hasLength results 5 "There should have been 5 documents returned"
|
||||||
Expect.equal
|
Expect.equal
|
||||||
(results |> List.map _.Id |> String.concat "|")
|
(results |> List.map _.Id |> String.concat "|")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user