Skip to content

Commit

Permalink
feat: support maxdecimaldigits option by geometry type (#7166)
Browse files Browse the repository at this point in the history
* Support maxdecimaldigits option by geometry type

* simplified logic

Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>
  • Loading branch information
alexile and pleerock committed Feb 8, 2021
1 parent 4abbd46 commit d749008
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/query-builder/SelectQueryBuilder.ts
Expand Up @@ -1768,8 +1768,11 @@ export class SelectQueryBuilder<Entity> extends QueryBuilder<Entity> implements

if (this.connection.driver instanceof PostgresDriver)
// cast to JSON to trigger parsing in the driver
selectionPath = `ST_AsGeoJSON(${selectionPath})::json`;

if (column.precision) {
selectionPath = `ST_AsGeoJSON(${selectionPath}, ${column.precision})::json`;
} else {
selectionPath = `ST_AsGeoJSON(${selectionPath})::json`;
}
if (this.connection.driver instanceof SqlServerDriver)
selectionPath = `${selectionPath}.ToString()`;
}
Expand Down

0 comments on commit d749008

Please sign in to comment.