NAME

FusqlFS::Backend::PgSQL::Role::Base - abstract PostgreSQL configuration complexity for FusqlFS::Backend::PgSQL::Role::* classes

SYNOPSIS

package FusqlFS::Backend::PgSQL::Role::Acl;
use parent 'FusqlFS::Backend::PgSQL::Role::Base';

sub init
{
    my $self = shift;
    my $relkind = shift;
    my @kind = $self->kind($relkind);

    # initialize instance
}

DESCRIPTION

This class hides configuration complexity for FusqlFS::Backend::PgSQL::Role::* family of modules including FusqlFS::Backend::PgSQL::Role::Acl and FusqlFS::Backend::PgSQL::Role::Owner.

Its single method kind() accepts single character argument designating the kind of referenced database artifact and returns a number of configuration parameters to construct correct SQL statements for the artifact's kind. The possible values of this argument are:

r

Table (a.k.a. relation).

i

Table's index.

S

Sequence.

v

View.

_F

Function (a.k.a. stored procedure).

_L

Language.

If list context kind() method returns a list of ($kind, $pfx, $table, $filter) where

$kind

is the name of artifact type, e.g. TABLE, INDEX, SEQUENCE, VIEW, FUNCTION or LANGUAGE,

$pfx

is the prefix for fields in pg_catalog schema's table with data of the artifact type, e.g. rel for pg_class or pro for pg_proc,

$table

is the table in pg_catalog schema with information about artifacts of this kind, e.g. pg_class, pg_proc or pg_language,

$name

is the SQL statement to get artifact's name (usually it's just ${pfx}name, but can be rather different, e.g. in case of functions), use this instead of self-composed name fields in both WHERE and SELECT expressions.

$filter

is the additional WHERE clause for pg_class table to filter data by required relkind field value, contains empty string for tables other than pg_class.

In scalar context this method returns hashref with keys named kind, pfx, table, name, filter and values as described above, so this hashref is usable with FusqlFS::Artifact/hprintf method.