1SQL::Translator::Types(U3s)er Contributed Perl DocumentatSiQoLn::Translator::Types(3)
2
3
4

NAME

6       SQL::Translator::Types - Type checking functions
7

SYNOPSIS

9           package Foo;
10           use Moo;
11           use SQL::Translator::Types qw(schema_obj enum);
12
13           has foo => ( is => 'rw', isa => schema_obj('Trigger') );
14           has bar => ( is => 'rw', isa => enum([qw(baz quux quuz)], {
15               msg => "Invalid value for bar: '%s'", icase => 1,
16           });
17

DESCRIPTIONS

19       This module exports functions that return coderefs suitable for Moo
20       "isa" type checks.  Errors are reported using "throw" in
21       SQL::Translator::Utils.
22

FUNCTIONS

24   schema_obj($type)
25       Returns a coderef that checks that its arguments is an object of the
26       class "SQL::Translator::Schema::$type".
27
28   enum(\@strings, [$msg | \%parameters])
29       Returns a coderef that checks that the argument is one of the provided
30       @strings.
31
32       Parameters
33
34       msg sprintf string for the error message.  If no other parameters are
35           needed, this can be provided on its own, instead of the %parameters
36           hashref.  The invalid value is passed as the only argument.
37           Defaults to "Invalid value: '%s'".
38
39       icase
40           If true, folds the values to lower case before checking for
41           equality.
42
43       allow_undef
44           If true, allow "undef" in addition to the specified strings.
45
46       allow_false
47           If true, allow any false value in addition to the specified
48           strings.
49
50
51
52perl v5.32.0                      2020-09-14         SQL::Translator::Types(3)
Impressum