NAME
App::Dochazka::REST::Model::Interval - activity intervals data model
VERSION
Version 0.262
SYNOPSIS
use App::Dochazka::REST::Model::Interval;
...
DESCRIPTION
A description of the activity interval data model follows.
Intervals in the database
Activity intervals are stored in the intervals
database table, which has the following structure:
CREATE TABLE intervals (
iid serial PRIMARY KEY,
eid integer REFERENCES employees (eid) NOT NULL,
aid integer REFERENCES activities (aid) NOT NULL,
intvl tsrange NOT NULL,
long_desc text,
remark text,
EXCLUDE USING gist (eid WITH =, intvl WITH &&)
);
Note the use of the tsrange
operator introduced in PostgreSQL 9.2.
In addition to the Interval ID (iid
), which is assigned by PostgreSQL, the Employee ID (eid
), and the Activity ID (aid
), which are provided by the client, an interval can optionally have a long description (long_desc
), which is the employee's description of what she did during the interval, and an admin remark (remark
).
Intervals in the Perl API
In the data model, individual activity intervals (records in the intervals
table) are represented by "interval objects". All methods and functions for manipulating these objects are contained in this module. The most important methods are:
constructor (spawn)
reset (recycles an existing object by setting it to desired state)
insert (inserts object into database)
delete (deletes object from database)
For basic activity interval workflow, see t/010-interval.t
.
EXPORTS
This module provides the following exports:
iid_exists (boolean function)
METHODS
load_by_iid
Boilerplate.
insert
Instance method. Attempts to INSERT a record. Field values are taken from the object. Returns a status object.
update
Instance method. Attempts to UPDATE a record. Field values are taken from the object. Returns a status object.
delete
Instance method. Attempts to DELETE a record. Field values are taken from the object. Returns a status object.
FUNCTIONS
iid_exists
Boolean function
AUTHOR
Nathan Cutler, <presnypreklad@gmail.com>