| 1 | package Data::Sah::Type::Sortable; | ||
| 2 | |||
| 3 | 59 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 59 | ▶ | use Data::Sah::Util::Role 'has_clause'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 59 | ▶ | use Role::Tiny; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 59 | requires 'superclause_sortable'; | |
| 9 | |||
| 10 | has_clause 'min', | ||
| 11 | v => 2, | ||
| 12 | tags => ['constraint'], | ||
| 13 | schema => ['_same', {req=>1}], | ||
| 14 | allow_expr => 1, | ||
| 15 | 370 | ▶ | code => sub { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 16 | 370 | my ($self, $cd) = @_; | |
| 17 | 370 | $self->superclause_sortable('min', $cd); | |
| 18 | }, | ||
| 19 | 59 | ; | |
| 20 | has_clause 'xmin', | ||
| 21 | v => 2, | ||
| 22 | tags => ['constraint'], | ||
| 23 | schema => ['_same', {req=>1}], | ||
| 24 | allow_expr => 1, | ||
| 25 | 128 | ▶ | code => sub { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 26 | 128 | my ($self, $cd) = @_; | |
| 27 | 128 | $self->superclause_sortable('xmin', $cd); | |
| 28 | }, | ||
| 29 | 59 | ; | |
| 30 | has_clause 'max', | ||
| 31 | v => 2, | ||
| 32 | prio => 51, | ||
| 33 | tags => ['constraint'], | ||
| 34 | schema => ['_same', {req=>1}], | ||
| 35 | allow_expr => 1, | ||
| 36 | 237 | ▶ | code => sub { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 37 | 237 | my ($self, $cd) = @_; | |
| 38 | 237 | $self->superclause_sortable('max', $cd); | |
| 39 | }, | ||
| 40 | 59 | ; | |
| 41 | has_clause 'xmax', | ||
| 42 | v => 2, | ||
| 43 | prio => 51, | ||
| 44 | tags => ['constraint'], | ||
| 45 | schema => ['_same', {req=>1}], | ||
| 46 | allow_expr => 1, | ||
| 47 | 174 | ▶ | code => sub { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 48 | 174 | my ($self, $cd) = @_; | |
| 49 | 174 | $self->superclause_sortable('xmax', $cd); | |
| 50 | }, | ||
| 51 | 59 | ; | |
| 52 | has_clause 'between', | ||
| 53 | v => 2, | ||
| 54 | tags => ['constraint'], | ||
| 55 | schema => ['array', {req=>1, len=>2, elems=>[ | ||
| 56 | ['_same', {req=>1}], | ||
| 57 | ['_same', {req=>1}], | ||
| 58 | ]}], | ||
| 59 | allow_expr => 1, | ||
| 60 | 1752 | ▶ | code => sub { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 61 | 1752 | my ($self, $cd) = @_; | |
| 62 | 1752 | $self->superclause_sortable('between', $cd); | |
| 63 | }, | ||
| 64 | 59 | ; | |
| 65 | has_clause 'xbetween', | ||
| 66 | v => 2, | ||
| 67 | tags => ['constraint'], | ||
| 68 | schema => ['array', {req=>1, len=>2, elems=>[ | ||
| 69 | ['_same', {req=>1}], | ||
| 70 | ['_same', {req=>1}], | ||
| 71 | ]}], | ||
| 72 | allow_expr => 1, | ||
| 73 | 168 | ▶ | code => sub { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 74 | 168 | my ($self, $cd) = @_; | |
| 75 | 168 | $self->superclause_sortable('xbetween', $cd); | |
| 76 | }, | ||
| 77 | 59 | ; | |
| 78 | |||
| 79 | 59 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |
| 80 | 59 | our $DATE = '2024-02-16'; # DATE | |
| 81 | 59 | our $DIST = 'Data-Sah'; # DIST | |
| 82 | 59 | our $VERSION = '0.917'; # VERSION | |
| 83 | |||
| 84 | 59 | 1; | |
| 85 | # ABSTRACT: Role for sortable types | ||
| 86 | |||
| 87 | __END__ | ||