From Code to Community: Sponsoring The Perl and Raku Conference 2025 Learn more

NAME

Dancer2::Plugin::FormValidator::Extension::DBIC - Dancer2 FormValidator extension for checking fields existence in table rows.

VERSION

version 1.01

SYNOPSIS

package Validator {
use Moo;
sub profile {
return {
username => [ qw(required unique:User,username) ],
};
};
}

DESCRIPTION

This extension provides validators for checking table rows using DBIC.

Main Plugin: Dancer2::Plugin::FormValidator.

CONFIGURATION

set plugins => {
FormValidator => {
session => {
namespace => '_form_validator'
},
forms => {
login => 'Validator',
},
extensions => {
dbic => {
provider => 'Dancer2::Plugin::FormValidator::Extension::DBIC',
database => 'default' # DBIC database
}
}
},
};

config.yml:

...
plugins:
FormValidator:
session:
namespace: '_form_validator'
extensions:
dbic:
provider: 'Dancer2::Plugin::FormValidator::Extension::DBIC'
database: 'default' # DBIC database
...
...

Dependencies

This package requires Dancer2::Plugin::DBIC.

Validators

exist

exist:source,column

The field under validation must exist within the given database source(table).

unique

unique:source,column

The field under validation must not exist within the given database source(table).

SOURCE CODE REPOSITORY

https://github.com/AlexP007/dancer2-plugin-formvalidator-extension-dbic.

AUTHOR

Alexander Panteleev <alexpan at cpan dot org>.

LICENSE AND COPYRIGHT

This software is copyright (c) 2022 by Alexander Panteleev. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.