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


In reply to Re: Using DBIx Class with json data types by Your Mother
in thread Using DBIx Class with json data types by epoch1

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.