NAME

DBIx::Quick::Converter - Role to convert fields after database recover and before inserts and updates.

SYNOPSIS

 package MyApp::DB::Converters::DateTime;
 
 use strict;
 use warnings;
 
 use Moo;

 use DateTime::Format::Pg;

 sub to_db {
	shift;
 	return DateTime::Format::Pg->new->format_datetime(shift);
 }

 sub from_db {
	shift;
 	return DateTime::Format::Pg->new->parse_datetime(shift);
 }
 
 with 'DBIx::Quick::Converter';

DESCRIPTION

This is Moo role that must be implemented by objects sent to the converter attribute of the field declaration in DBIx::Quick.

METHODS NEEDED TO BE IMPLEMENTED

to_db

The subroutine that transforms data into the format which you want to store in the database.

Takes one argument.

from_db

The subroutine that transforms the database data into your wanted format in perl, for example a DateTime object.

Takes one argument.