Datacenter build and management service
https://github.com/joyent/conch-api/blob/master/lib/Conch/DB/Helper/ResultSet/ResultsExist.pm
A component for Conch::DB::ResultSet classes that provides the exists
method.
See also DBIx::Class::Helper::ResultSet::Shortcut::ResultsExist.
This code is postgres-specific but may work on other databases as well.
__PACKAGE__->load_components('+Conch::DB::Helper::ResultSet::ResultsExist');
Efficiently determines if a result exists, without needing to do a ->count
.
Essentially does:
select * from ( select exists (select 1 from ... your query ... ) ) as _existence_subq;
Returns a value that you can treat as a boolean.
Copyright Joyent, Inc.
This Source Code Form is subject to the terms of the Mozilla Public License, v.2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://www.mozilla.org/en-US/MPL/2.0/.