-
-
17 May 2022 10:49:29 UTC
- Distribution: DBIx-Class
- Source (raw)
- Pod Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Repository
- Issues (121)
- Testers (240 / 1 / 0)
- Kwalitee
Bus factor: 1- % Coverage
- License: perl_5
- Perl: v5.8.1
- Activity
24 month- Tools
- Download (858.78KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 210 contributors-
mst: Matt S Trout (project founder - original idea, architecture and implementation)
-
castaway: Jess Robinson (lions share of the reference documentation and manuals)
-
abraxxa: Alexander Hartmaier
-
acca: Alexander Kuznetsov
-
acme: Leon Brocard
-
aherzog: Adam Herzog
-
Alexander Keusch
-
alexrj: Alessandro Ranellucci
-
alnewkirk: Al Newkirk
-
Altreus: Alastair McGowan-Douglas
-
amiri: Amiri Barksdale
-
amoore: Andrew Moore
-
Andrew Mehta
-
andrewalker: Andre Walker
-
andyg: Andy Grundman
-
ank: Andres Kievsky
-
arc: Aaron Crane
-
arcanez: Justin Hunter
-
ash: Ash Berlin
-
bert: Norbert Csongrádi
-
bfwg: Colin Newell
-
blblack: Brandon L. Black
-
bluefeet: Aran Deltac
-
boghead: Bryan Beeley
-
bphillips: Brian Phillips
-
brd: Brad Davis
-
Brian Kirkbride
-
bricas: Brian Cassidy
-
brunov: Bruno Vecchi
-
caelum: Rafael Kitover
-
caldrin: Maik Hentsche
-
chorny: Alexandr Ciornii
-
cj: C.J. Adams-Collier
-
claco: Christopher H. Laco
-
clkao: CL Kao
- Ctrl-O http://ctrlo.com/
-
da5id: David Jack Olrik
-
dams: Damien Krotkine
-
dandv: Dan Dascalescu
-
dariusj: Darius Jokilehto
-
davewood: David Schmidt
-
daxim: Lars Dɪᴇᴄᴋᴏᴡ 迪拉斯
-
dduncan: Darren Duncan
-
debolaz: Anders Nor Berle
-
dew: Dan Thomas
-
dim0xff: Dmitry Latin
-
dkubb: Dan Kubb
-
dnm: Justin Wheeler
-
dpetrov: Dimitar Petrov
-
Dr^ZigMan: Robert Stone
-
dsteinbrunner: David Steinbrunner
-
duncan_dmg: Duncan Garland
-
dwc: Daniel Westermann-Clark
-
dyfrgi: Michael Leuchtenburg
-
edenc: Eden Cardim
- Eligo http://eligo.co.uk/
-
ether: Karen Etheridge
-
evdb: Edmund von der Burg
-
faxm0dem: Fabien Wernli
-
felliott: Fitz Elliott
-
fgabolde: Fabrice Gabolde
-
freetime: Bill Moseley
-
frew: Arthur Axel "fREW" Schmidt
-
gbjk: Gareth Kirwan
-
geotheve: Georgina Thevenet
-
Getty: Torsten Raudssus
-
goraxe: Gordon Irving
-
gphat: Cory G Watson
- Grant Street Group http://www.grantstreet.com/
-
gregoa: Gregor Herrmann
-
groditi: Guillermo Roditi
-
gshank: Gerda Shank
-
guacamole: Fred Steinberg
-
Haarg: Graham Knop
-
hobbs: Andrew Rodland
-
Ian Wells
-
idn: Ian Norton
-
ilmari: Dagfinn Ilmari Mannsåker
-
ingy: Ingy döt Net
-
initself: Mike Baas
-
ironcamel: Naveed Massjouni
-
jasonmay: Jason May
-
jawnsy: Jonathan Yu
-
jegade: Jens Gassmann
-
jeneric: Eric A. Miller
-
jesper: Jesper Krogh
-
Jesse Sheidlower
-
jgoulah: John Goulah
-
jguenther: Justin Guenther
-
jhannah: Jay Hannah
-
jmac: Jason McIntosh
-
jmmills: Jason M. Mills
-
jnapiorkowski: John Napiorkowski
-
Joe Carlson
-
jon: Jon Schutz
-
Jordan Metzmeier
-
jshirley: J. Shirley
- kaare: Kaare Rasmussen
-
kd: Kieren Diment
-
kentnl: Kent Fredric
-
kkane: Kevin L. Kane
-
konobi: Scott McWhirter
-
lejeunerenard: Sean Zellmer
-
leont: Leon Timmermans
-
littlesavage: Alexey Illarionov
-
lukes: Luke Saunders
-
marcus: Marcus Ramberg
-
mateu: Mateu X. Hunter
-
Matt LeBlanc
-
Matt Sickler
- mattlaw: Matt Lawrence
-
mattp: Matt Phillips
-
mdk: Mark Keating
-
melo: Pedro Melo
-
metaperl: Terrence Brannon
-
michaelr: Michael Reddick
-
milki: Jonathan Chu
-
minty: Murray Walker
-
mithaldu: Christian Walde
-
mjemmeson: Michael Jemmeson
- mna: Maya
-
mo: Moritz Onken
-
moltar: Roman Filippov
-
moritz: Moritz Lenz
-
mrf: Mike Francis
-
mstratman: Mark A. Stratman
-
ned: Neil de Carteret
-
nigel: Nigel Metheringham
-
ningu: David Kamholz
-
Nniuq: Ron "Quinn" Straight"
-
norbi: Norbert Buchmuller
-
nothingmuch: Yuval Kogman
-
nuba: Nuba Princigalli
-
Numa: Dan Sully
-
oalders: Olaf Alders
-
Olly Betts
-
osfameron: Hakim Cassimally
-
ovid: Curtis "Ovid" Poe
-
oyse: Øystein Torget
-
paulm: Paul Makepeace
-
penguin: K J Cheetham
-
perigrin: Chris Prather
-
Peter Siklósi
-
Peter Valdemar Mørch
-
peter: Peter Collingbourne
-
phaylon: Robert Sedlacek
-
plu: Johannes Plunien
-
pmooney: Paul Mooney
-
Possum: Daniel LeWarne
-
pplu: Jose Luis Martinez
-
quicksilver: Jules Bean
-
racke: Stefan Hornburg
-
rafl: Florian Ragwitz
-
rainboxx: Matthias Dietrich
-
rbo: Robert Bohne
-
rbuels: Robert Buels
-
rdj: Ryan D Johnson
-
Relequestual: Ben Hutton
-
renormalist: Steffen Schwigon
-
rjbs: Ricardo Signes
-
Robert Krimen
-
Robert Olson
-
robkinyon: Rob Kinyon
-
Roman Ardern-Corris
-
ruoso: Daniel Ruoso
-
Sadrak: Felix Antonius Wilhelm Ostmann
- sc_: Just Another Perl Hacker
-
schwern: Michael G Schwern
-
Scott R. Godin
-
scotty: Scotty Allen
-
semifor: Marc Mims
-
Simon Elliott
-
SineSwiper: Brendan Byrd
-
skaufman: Samuel Kaufman
-
solomon: Jared Johnson
-
spb: Stephen Bennett
-
Squeeks
-
srezic: Slaven Rezic
-
sszabo: Stephan Szabo
-
Stephen Peters
-
stonecolddevin: Devin Austin
-
talexb: Alex Beamish
-
tamias: Ronald J Kimball
-
TBSliver: Tom Bloor
-
teejay: Aaron Trevena
-
theorbtwo: James Mastros
-
Thomas Kratz
-
timbunce: Tim Bunce
-
tinita: Tina Mueller
- Todd Lipcon
-
Tom Hukins
-
tommy: Tommy Butler
-
tonvoon: Ton Voon
-
triode: Pete Gamache
-
typester: Daisuke Murase
-
uree: Oriol Soriano
-
uwe: Uwe Voelker
-
vanstyn: Henry Van Styn
-
victori: Victor Igumnov
-
wdh: Will Hawes
-
wesm: Wes Malone
-
willert: Sebastian Willert
-
wintermute: Toby Corkindale
-
wreis: Wallace Reis
-
x86-64
-
xenoterracide: Caleb Cushing
-
xmikew: Mike Wisener
-
yrlnry: Mark Jason Dominus
-
zamolxes: Bogdan Lucaciu
-
Zefram: Andrew Main
- Dependencies
- Class::Accessor::Grouped
- Class::C3::Componentised
- Class::Inspector
- Config::Any
- Context::Preserve
- DBI
- Data::Dumper::Concise
- Devel::GlobalDestruction
- Hash::Merge
- MRO::Compat
- Module::Find
- Moo
- Path::Class
- SQL::Abstract::Classic
- Scope::Guard
- Sub::Name
- Text::Balanced
- Try::Tiny
- namespace::clean
- Reverse dependencies
- CPAN Testers List
- Dependency graph
- NAME
- SYNOPSIS
- DESCRIPTION
- METHODS
- SEE ALSO
- INHERITED METHODS
- FURTHER QUESTIONS?
- COPYRIGHT AND LICENSE
NAME
DBIx::Class::InflateColumn - Automatically create references from column data
SYNOPSIS
# In your table classes __PACKAGE__->inflate_column('column_name', { inflate => sub { my ($raw_value_from_db, $result_object) = @_; ... }, deflate => sub { my ($inflated_value_from_user, $result_object) = @_; ... }, });
DESCRIPTION
This component translates column data into references, i.e. "inflating" the column data. It also "deflates" references into an appropriate format for the database.
It can be used, for example, to automatically convert to and from DateTime objects for your date and time fields. There's a convenience component to actually do that though, try DBIx::Class::InflateColumn::DateTime.
It will handle all types of references except scalar references. It will not handle scalar values, these are ignored and thus passed through to SQL::Abstract::Classic. This is to allow setting raw values to "just work". Scalar references are passed through to the database to deal with, to allow such settings as
\'year + 1'
and\'DEFAULT'
to work.If you want to filter plain scalar values and replace them with something else, see DBIx::Class::FilterColumn.
METHODS
inflate_column
Instruct DBIx::Class to inflate the given column.
In addition to the column name, you must provide
inflate
anddeflate
methods. Theinflate
method is called when you access the field, while thedeflate
method is called when the field needs to used by the database.For example, if you have a table
events
with a timestamp field namedinsert_time
, you could inflate the column in the corresponding table class using something like:__PACKAGE__->inflate_column('insert_time', { inflate => sub { my ($insert_time_raw_value, $event_result_object) = @_; DateTime->from_epoch( epoch => $insert_time_raw_value ); }, deflate => sub { my ($insert_time_dt_object, $event_result_object) = @_; $insert_time_dt_object->epoch; }, });
The coderefs you set for inflate and deflate are called with two parameters, the first is the value of the column to be inflated/deflated, the second is the result object itself.
In this example, calls to an event's
insert_time
accessor return a DateTime object. This DateTime object is later "deflated" back to the integer epoch representation when used in the database layer. For a much more thorough handling of the above example, please see DBIx::Class::DateTime::Epochget_inflated_column
my $val = $obj->get_inflated_column($col);
Fetch a column value in its inflated state. This is directly analogous to "get_column" in DBIx::Class::Row in that it only fetches a column already retrieved from the database, and then inflates it. Throws an exception if the column requested is not an inflated column.
set_inflated_column
my $copy = $obj->set_inflated_column($col => $val);
Sets a column value from an inflated value. This is directly analogous to "set_column" in DBIx::Class::Row.
store_inflated_column
my $copy = $obj->store_inflated_column($col => $val);
Sets a column value from an inflated value without marking the column as dirty. This is directly analogous to "store_column" in DBIx::Class::Row.
SEE ALSO
- DBIx::Class::Core - This component is loaded as part of the
core
DBIx::Class components; generally there is no need to load it directly
INHERITED METHODS
- DBIx::Class::Row
-
copy, delete, discard_changes, get_column, get_columns, get_dirty_columns, get_from_storage, get_inflated_columns, has_column_loaded, in_storage, inflate_result, insert, insert_or_update, is_changed, is_column_changed, make_column_dirty, new, register_column, result_source, set_column, set_columns, set_inflated_columns, store_column, throw_exception, update, update_or_insert
FURTHER QUESTIONS?
Check the list of additional DBIC resources.
COPYRIGHT AND LICENSE
This module is free software copyright by the DBIx::Class (DBIC) authors. You can redistribute it and/or modify it under the same terms as the DBIx::Class library.
Module Install Instructions
To install DBIx::Class, copy and paste the appropriate command in to your terminal.
cpanm DBIx::Class
perl -MCPAN -e shell install DBIx::Class
For more information on module installation, please visit the detailed CPAN module installation guide.