File: Gnarly.pm

package info (click to toggle)
libdbix-class-helpers-perl 2.023007-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 792 kB
  • ctags: 294
  • sloc: perl: 3,872; sql: 161; makefile: 7
file content (30 lines) | stat: -rw-r--r-- 716 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package TestSchema::ResultSet::Gnarly;
use strict;
use warnings;

# intentionally not using TestSchema::ResultSet
use parent 'DBIx::Class::ResultSet';

__PACKAGE__->load_components(qw{ Helper::ResultSet::Me Helper::ResultSet::ResultClassDWIM Helper::ResultSet::CorrelateRelationship Helper::ResultSet::SearchOr Helper::ResultSet::NoColumns Helper::ResultSet::Explain });

sub with_id_plus_one {
   my $self = shift;
   my $id = $self->me . 'id';
   $self->search(undef, {
      '+columns' => {
         id_plus_one => \"$id + 1",
      },
   })
}

sub id_plus_two {
   my $self = shift;
   my $id = $self->me . 'id';
   $self->search(undef, {
      '+columns' => {
         plus2 => \"$id + 2",
      },
   })
}

1;