in reply to Using DBIx Class with json data types

One thing you can do that simplifies part of the problem is use inflation/deflation on the column–

package MySchema::Result::Detail; use JSON::XS; # Class setup, etc. __PACKAGE__->inflate_column( data => { inflate => sub { decode_json( +shift ) }, deflate => sub { # Takes data structure or plain JSON string. my $json = shift; ref $json ? encode_json($json) : $json; }, });

This doesn’t let you search into it though, just makes the transition from JSON to perl data seamless/DWIW. I’m with Corion about searching unstructured data. That said, you can pass literal SQL to DBIC so if Pg lets you do it, you sure can here and you could use resultsets to make it semantic/less-messy in code. I don’t have experience with this to rattle off any snippets today but it sounds like a fun thing to play with.

Update: s/let’s/lets/; # DERP

Replies are listed 'Best First'.
Re^2: Using DBIx Class with json data types
by epoch1 (Acolyte) on May 09, 2016 at 12:53 UTC
    Thanks, this was helpful. I probably wasn't that clear about what I'm trying to achieve, it's a work in progess and I'm working through options.