Skip to content

Instantly share code, notes, and snippets.

@mrenvoize
Created January 18, 2017 08:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrenvoize/4f55301453261c7c4c3741de23ae06e6 to your computer and use it in GitHub Desktop.
Save mrenvoize/4f55301453261c7c4c3741de23ae06e6 to your computer and use it in GitHub Desktop.
Boolean Filter for DBIx::Class Result Object
=head1 FILTERED COLUMNS
=head2 suppressed
Type: Boolean
=cut
__PACKAGE__->filter_column(
suppressed => {
filter_to_storage => sub { $_[1] ? 1 : 0 },
filter_from_storage => sub { $_[1] ? Mojo::JSON->true : Mojo::JSON->false }
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment