I am using a PostgreSQL database with PostGIS geometry columns.
I would like to configure the Result classes so that geometry columns are inflated using the ST_AsEWKT function and deflated using the ST_GeomFromEWKT function.
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.