我正在使用带有 PostGIS 几何列的 PostgreSQL 数据库。
我想配置 Result 类,以便几何列使用 ST_AsEWKT 函数膨胀并使用 ST_GeomFromEWKT 函数放气。
Is there a way to do this so that the "find" method works as normal, and so that the "update" and "create" methods also work as normal. I'd rather not have to write specialized queries for each table, if I can avoid it.
I can use a hack for inflating the column, e.g.
__PACKAGE__->inflate_column( 'geo', {
inflate => sub {
my ($raw_value, $result) = @_;
my $col = $result->result_source->resultset->get_column("geo")->func("ST_AsEWKT");
},
});
but I am unsure how to implement deflation.
Thanks in advance.