docs: fix orderBy of Spatial columns (#10568)

This commit is contained in:
YoungKi Lyu 2023-12-29 19:47:07 +09:00 committed by GitHub
parent ad5bf11a91
commit 95a7337143
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 11 deletions

View File

@ -308,12 +308,10 @@ await dataSource.manager
.where(
"ST_Distance(geom, ST_SetSRID(ST_GeomFromGeoJSON(:origin), ST_SRID(geom))) > 0",
)
.orderBy({
"ST_Distance(geom, ST_SetSRID(ST_GeomFromGeoJSON(:origin), ST_SRID(geom)))":
{
order: "ASC",
},
})
.orderBy(
"ST_Distance(geom, ST_SetSRID(ST_GeomFromGeoJSON(:origin), ST_SRID(geom)))",
"ASC",
)
.setParameters({
// stringify GeoJSON
origin: JSON.stringify(origin),

View File

@ -206,11 +206,10 @@ await getManager()
.createQueryBuilder(Thing, "thing")
// 将字符串化的GeoJSON转换为具有与表规范匹配的SRID的geometry
.where("ST_Distance(geom, ST_SetSRID(ST_GeomFromGeoJSON(:origin), ST_SRID(geom))) > 0")
.orderBy({
"ST_Distance(geom, ST_SetSRID(ST_GeomFromGeoJSON(:origin), ST_SRID(geom)))": {
order: "ASC"
}
})
.orderBy(
"ST_Distance(geom, ST_SetSRID(ST_GeomFromGeoJSON(:origin), ST_SRID(geom)))",
"ASC"
)
.setParameters({
// 字符串化 GeoJSON
origin: JSON.stringify(origin)