mojolicious / mojo-pg

Mojolicious :heart: PostgreSQL
https://metacpan.org/release/Mojo-Pg
Artistic License 2.0
101 stars 46 forks source link

Large Objects (feature request) #11

Closed avkhozov closed 8 years ago

avkhozov commented 8 years ago

Are there any plans to create a interface for postgres large object?

kraih commented 8 years ago

No plans.

avkhozov commented 8 years ago

A patch would be welcome? :)

kraih commented 8 years ago

Don't know, never used that part of the API.

shadowcat-mst commented 8 years ago

@avkhozov Perhaps if you proposed an interface or at least a feature set it would be easier to figure out if it's going to be a good idea?

avkhozov commented 8 years ago

I think access to large object data (Mojo::Pg::LO or Mojo::Pg::File) must have an interface similar to IO::File. Thus it can be used in conjunction with Mojo::Asset::File and conveniently serve static files using reply->asset helper or using slurp to processing data in memory.

avkhozov commented 8 years ago

Some interfaces in ruby: https://github.com/diogob/carrierwave-postgresql/blob/master/lib/carrierwave/storage/postgresql_lo.rb http://deveiate.org/code/pg/PG/Connection.html#method-i-lo_close

shadowcat-mst commented 8 years ago

The first one appears to be rails-specific and just being -just- file-like enough for an upload handler.

The second one appears to be entirely equivalent to calling the originally existing DBD::Pg methods.

Have you looked at the DBD::Pg API that already exists? Given that, what, specifically, are you proposing Mojo::Pg provides that you don't already have?

"I think X must have an interface like Y" needs to be backed up with sufficient use cases to justify the extra complexity, especially given there's an already-extant interface you could, y'know, just call :)