mirror of
https://github.com/directus/directus.git
synced 2026-01-10 11:38:13 -05:00
20 lines
574 B
TypeScript
20 lines
574 B
TypeScript
import type { Knex } from 'knex';
|
|
import { GeometryHelper } from '../types.js';
|
|
|
|
export class GeometryHelperMySQL extends GeometryHelper {
|
|
override collect(table: string, column: string): Knex.Raw {
|
|
return this.knex.raw(
|
|
`concat('geometrycollection(', group_concat(? separator ', '), ')'`,
|
|
this.asText(table, column),
|
|
);
|
|
}
|
|
|
|
override fromText(text: string): Knex.Raw {
|
|
return this.knex.raw('st_geomfromtext(?)', text);
|
|
}
|
|
|
|
asGeoJSON(table: string, column: string): Knex.Raw {
|
|
return this.knex.raw('st_asgeojson(??.??) as ??', [table, column, column]);
|
|
}
|
|
}
|