postgis - analyse geo columns, show in map

This commit is contained in:
Jan Prochazka
2022-06-11 22:21:09 +02:00
parent 34496ced0e
commit 2944d0fa39
5 changed files with 78 additions and 12 deletions

View File

@@ -2,6 +2,8 @@ const { driverBase } = global.DBGATE_TOOLS;
const Dumper = require('./Dumper');
const { postgreSplitterOptions } = require('dbgate-query-splitter/lib/options');
const spatialTypes = ['GEOGRAPHY'];
/** @type {import('dbgate-types').SqlDialect} */
const dialect = {
rangeSelect: true,
@@ -78,6 +80,23 @@ const dialect = {
'uuid',
'xml',
],
createColumnViewExpression(columnName, dataType, source, alias) {
if (dataType && spatialTypes.includes(dataType.toUpperCase())) {
return {
exprType: 'call',
func: 'ST_AsText',
alias: alias || columnName,
args: [
{
exprType: 'column',
columnName,
source,
},
],
};
}
},
};
const postgresDriverBase = {