mirror of
https://github.com/typeorm/typeorm.git
synced 2025-12-08 21:26:23 +00:00
docs: fix orderBy of Spatial columns (#10568)
This commit is contained in:
parent
ad5bf11a91
commit
95a7337143
@ -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),
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user