---
name: "Class::DBI::ColumnGrouper"
section: "3pm"
platform: "linux"
package: "libclass-dbi-perl"
version: "3.0.17-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Class::DBI::ColumnGrouper"
---

# Class::DBI::ColumnGrouper(3pm)

Columns and Column Groups

## NAME

Class::DBI::ColumnGrouper - Columns and Column Groups

## SYNOPSIS

```
        my $colg = Class::DBI::ColumnGrouper->new;
           $colg->add_group(People => qw/star director producer/);
        my @cols = $colg->group_cols($group);
        my @all            = $colg->all_columns;
        my @pri_col        = $colg->primary;
        my @essential_cols = $colg->essential;
```

## DESCRIPTION

Each Class::DBI class maintains a list of its columns as class data. This provides an interface to that. You probably don't want to be dealing with this directly.

## METHODS

### new

```
        my $colg = Class::DBI::ColumnGrouper->new;
```

A new blank ColumnnGrouper object.

### clone

```
        my $colg2 = $colg->clone;
```

Clone an existing ColumnGrouper.

### add\_column / find\_column

```
        $colg->add_column($name);
        my Class::DBI::Column $col = $colg->find_column($name);
```

Add or return a Column object for the given column name.

### add\_group

```
        $colg->add_group(People => qw/star director producer/);
```

This adds a list of columns as a column group.

### group\_cols / groups\_for

```
        my @colg = $cols->group_cols($group);
        my @groups = $cols->groups_for(@cols);
```

This returns a list of all columns which are in the given group, or the groups a given column is in.

### columns\_in

```
        my @cols = $colg->columns_in(@groups);
```

This returns a list of all columns which are in the given groups.

### all\_columns

```
        my @all = $colg->all_columns;
```

This returns a list of all the real columns.

### primary

```
        my $pri_col = $colg->primary;
```

This returns a list of the columns in the Primary group.

### essential

```
        my @essential_cols = $colg->essential;
```

This returns a list of the columns in the Essential group.
