SQL::Tr...ma::View(3)
π SQL::Tr...ma::View(3) β the view object, bestie edition
okay so this is the manpage for SQL::Translator::Schema::View (yes that's the truncated SQL::Tr...ma::View(3) up in the header, it's just shy) from the User Contributed Perl Documentation, and honestly? she's a whole vibe. let's get into it π«Ά
β¨ NAME β¨
SQL::Translator::Schema::View β it's the SQL::Translator view object. that's the whole assignment. π
πΈ SYNOPSIS πΈ
here's how you actually use her, no cap:
use SQL::Translator::Schema::View;
my $view = SQL::Translator::Schema::View->new(
name => 'foo', # name, required
sql => 'select id, name from foo', # SQL for view
fields => 'id, name', # field names in view
);
literally that's it, she's born β¨ (and yeah, name is required, don't forget her government name π)
π¦ DESCRIPTION π¦
"SQL::Translator::Schema::View" is the view object. main character energy, nothing more to explain π
π METHODS π
π new
the object constructor. makes a fresh new view out of thin air:
my $view = SQL::Translator::Schema::View->new;
π§ fields
gets and sets the fields the constraint is on. she accepts a string, a list, or an arrayref; and hands back an array or an array reference. she'll unique the field names and keeps them in order by the first occurrence of a field name β so no dupes, bestie, and order is preserved π
$view->fields('id');
$view->fields('id', 'name');
$view->fields( 'id, name' );
$view->fields( [ 'id', 'name' ] );
$view->fields( qw[ id name ] );
my @fields = $view->fields;
look at all those ways to say the same thing, she's flexible like that π
π tables
gets and sets the tables the SELECT mentions. accepts a string, a list, or an arrayref; returns an array or an array reference. will unique the table names and keep them in order by the first occurrence of a field name (yes, that's what it says, i don't make the rules π« )
$view->tables('foo');
$view->tables('foo', 'bar');
$view->tables( 'foo, bar' );
$view->tables( [ 'foo', 'bar' ] );
$view->tables( qw[ foo bar ] );
my @tables = $view->tables;
β options
gets or appends a list of options on the view. little extras, little garnish π
$view->options('ALGORITHM=UNDEFINED');
my @options = $view->options;
π is_valid
determines whether the view is valid or not. vibe check, basically:
my $ok = $view->is_valid;
π name
get or set the view's name:
my $name = $view->name('foo');
π order
get or set the view's order:
my $order = $view->order(3);
π₯ sql
get or set the view's SQL:
my $sql = $view->sql('select * from foo');
π¦ schema
get or set the view's schema object:
$view->schema( $schema );
my $schema = $view->schema;
get it, set it, she contains multitudes β¨
πΈ equals
determines if this view is the same as another one. twin check π―
my $isIdentical = $view1->equals( $view2 );
π AUTHOR π
Ken Youens-Clark <kclark@cpan.org>. king behavior, we stan π
ok that's the whole page, go build some views bestie, you're gonna slay π β¨
sign-off time π this little icon was brought to you by perl v5.42.0, dated 2024-12-12 β go check the date, it's giving vintage but make it fresh π
π¦ where this page comes from
- opensuse-leap 16.0: perl-SQL-Translator 1.660.0-bp160.1.11 Β· (Artistic-1.0 OR GPL-1.0-or-later) AND GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms