NAME
DBIx::QuickORM::Schema::Table::Column - Metadata for a single table column.
DESCRIPTION
Holds the schema metadata for one column: its name, ordinal position, nullability, identity flag, defaults, type, and storage affinity. The affinity is resolved lazily from an explicit value, a scalar-ref type name, or a type object, and cached.
User-provided columns and introspected columns can be combined with merge, where the other column's values win.
SYNOPSIS
my $col = DBIx::QuickORM::Schema::Table::Column->new(
name => 'id',
order => 1,
type => \'integer',
);
my $affinity = $col->affinity;
ATTRIBUTES
- name
-
The column's ORM (schema) name. Defaults to
db_name. - db_name
-
The column's name in the database. Defaults to
name. - sql_default
-
The column's SQL-level default.
- perl_default
-
A Perl-side default value or generator.
- omit
-
True if the column should be omitted from default fetches.
- order
-
The column's ordinal position in the table.
- nullable
-
True if the column accepts NULL.
- identity
-
True if the column is an identity / auto-increment column.
- generated
-
True if the column's value is computed by the database (a stored or virtual
GENERATEDcolumn). Generated columns are readable on fetch but are excluded fromINSERTandUPDATEcolumn lists, and setting one via the row layer croaks. - affinity
-
Storage affinity; resolved from
typeon demand if not given. - type
-
The column type: a scalar ref naming a SQL type, or a type object.
- created
-
Human-readable note of where the column was defined.
- compiled
-
Cached compiled form of the column.
PUBLIC METHODS
- $name = $col->name
-
The column's ORM (schema) name.
- $name = $col->db_name
-
The column's name in the database.
- $affinity = $col->affinity($dialect)
-
Return the column's storage affinity, resolving and caching it from the type when not set explicitly. Croaks when no affinity is set and none can be derived from the type.
- $col = $col->merge($other, %params)
-
Return a new column combining this column with another (and any extra params), where the other column's values and the params win.
- $copy = $col->clone(%params)
-
Return a copy of this column with any passed params overriding its values.
SOURCE
The source code repository for DBIx::QuickORM can be found at https://github.com/exodist/DBIx-QuickORM.
MAINTAINERS
AUTHORS
COPYRIGHT
Copyright Chad Granum <exodist7@gmail.com>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.