NAME
DBIO::PostgreSQL::JSONB::Op - JSONB path-extraction operator object built by jsonb()
VERSION
version 0.900000
DESCRIPTION
Operator object representing a text-extraction path into a PostgreSQL JSONB column. You do not construct this class directly — use the jsonb() helper from DBIO::PostgreSQL::JSONB:
use DBIO::PostgreSQL::JSONB qw(jsonb);
my $expr = jsonb('me.data', 'status'); # DBIO::PostgreSQL::JSONB::Op
$rs->search( $expr->eq('active') ); # WHERE (me.data->>'status') = ?
Each comparison method returns a SQL::Abstract literal-with-bind fragment suitable for passing to search().
METHODS
eq
jsonb('me.data', 'status')->eq('active')
# WHERE (me.data->>'status') = ?
ne
jsonb('me.data', 'status')->ne('deleted')
# WHERE (me.data->>'status') != ?
lt
jsonb('me.stats', 'score')->lt(50)
# WHERE (me.stats->>'score') < ?
le
jsonb('me.stats', 'score')->le(100)
# WHERE (me.stats->>'score') <= ?
gt
jsonb('me.stats', 'score')->gt(100)
# WHERE (me.stats->>'score') > ?
ge
jsonb('me.stats', 'score')->ge(100)
# WHERE (me.stats->>'score') >= ?
like
jsonb('me.data', 'name')->like('John%')
# WHERE (me.data->>'name') LIKE ?
ilike
jsonb('me.data', 'name')->ilike('%smith%')
# WHERE (me.data->>'name') ILIKE ?
is_null
jsonb('me.data', 'avatar')->is_null
# WHERE (me.data->>'avatar') IS NULL
Returns a condition fragment that checks whether the path resolves to SQL NULL (i.e. the key is absent or the value is JSON null).
is_not_null
jsonb('me.data', 'email')->is_not_null
# WHERE (me.data->>'email') IS NOT NULL
as_order
$rs->search( {}, { order_by => jsonb('me.score', 'total')->as_order } )
# ORDER BY (me.score->>'total')
Returns a scalar ref suitable for use as an order_by value. Combine with -asc/-desc wrappers as usual:
{ order_by => { -desc => jsonb('me.score', 'total')->as_order } }
# ORDER BY (me.score->>'total') DESC
SEE ALSO
DBIO::PostgreSQL::JSONB — the
jsonb()helper that builds these objects
AUTHOR
DBIO & DBIx::Class Authors
COPYRIGHT AND LICENSE
Copyright (C) 2026 DBIO Authors Portions Copyright (C) 2005-2025 DBIx::Class Authors Based on DBIx::Class, heavily modified.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.