database icon indicating copy to clipboard operation
database copied to clipboard

Is possible to use Postgresql Jsonb data type with Opis?

Open juninhodeluca opened this issue 3 years ago • 0 comments

Ciao! I have refactoring some old scripts and migrating native PDO queries to Opis. At some point I found a query which looks like that (reduced version to explain):

SELECT c.column1, c.json::jsonb AS raw_data FROM table c

Since I coudn't find onto documentation, I have tryed to do

$this->db->from( [ 'table' => 'c' ])
                ->select( function ($include ) {
                    $include
                        ->column( 'c.column1' )
                        ->column( 'c.json::jsonb', 'raw_data' );
                } )
                ->all();

But, not worked, ofc, otherwise I wouldn't be here asking a help hehe Thank you in advice

juninhodeluca avatar Mar 31 '22 12:03 juninhodeluca