1SQL::Translator::FilterU:s:eNramCeosn(t3r)ibuted Perl DoScQuLm:e:nTtraatnisolnator::Filter::Names(3)
2
3
4

NAME

6       SQL::Translator::Filter::Names - Tweak the names of schema objects.
7

SYNOPSIS

9         #! /usr/bin/perl -w
10         use SQL::Translator;
11
12         # Lowercase all table names and upper case the first letter of all field
13         # names. (MySql style!)
14         #
15         my $sqlt = SQL::Translator->new(
16             filename => \@ARGV,
17             from     => 'MySQL',
18             to       => 'MySQL',
19             filters => [
20               Names => {
21                   'tables' => 'lc',
22                   'fields' => 'ucfirst',
23               },
24             ],
25         ) || die "SQLFairy error : ".SQL::Translator->error;
26         print($sqlt->translate) || die "SQLFairy error : ".$sqlt->error;
27

DESCRIPTION

29       Tweak the names of schema objects by providing functions to filter the
30       names from the given into the desired forms.
31

SEE ALSO

33       perl(1), SQL::Translator
34
35       Name Groups
36           Define a bunch of useful groups to run the name filters over. e.g.
37           all, fkeys, pkeys etc.
38
39       More Functions
40           e.g. camelcase, titlecase, single word etc.  Also a way to pass in
41           a regexp.
42
43           May also want a way to pass in arguments for the func e.g. prefix.
44
45       Multiple Filters on the same name (filter order)?
46           Do we actually need this, you could just run lots of filters. Would
47           make adding func args to the interface easier.
48
49               filters => [
50                   [ 'Names', { all => 'lc' } ],
51                   [ 'Names', {
52                       tables => 'lc',
53                       fields => 'ucfirst',
54                   } ],
55               ],
56
57           Mind you if you could give the filter a list this wouldn't be a
58           problem!
59
60               filters => [
61                   [ 'Names',
62                       all    => 'lc'
63                       fields => 'ucfirst',
64                   ],
65               ],
66
67           Which is nice. Might have to change the calling conventions for
68           filters.  Would also provide an order to run the filters in rather
69           than having to hard code it into the filter it's self.
70
71
72
73perl v5.32.0                      2020-09-14 SQL::Translator::Filter::Names(3)
Impressum