logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

PGObject::Util::DBMethod - Declarative stored procedure <-> object mappings for the PGObject Framework

Acknowledgements

Author

       Chris Travers, "<chris.travers at gmail.com>"

Bugs

       Please report any bugs or feature requests to "bug-pgobject-util-dbmethod at rt.cpan.org", or through the
       web interface  at  <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=PGObject-Util-DBMethod>.   I  will  be
       notified, and then you'll automatically be notified of progress on your bug as I make changes.

Export

       This exports only dbmethod, which it always exports.

Name

       PGObject::Util::DBMethod - Declarative stored procedure <-> object mappings for the PGObject Framework

Subroutines/Methods

dbmethod
       use as dbmethod (name => (default_arghash))

       For example:

         package MyObject;
         use PGObject::Utils::DBMethod;

         dbmethod save => (
                                        strict_args => 0,
                                           funcname => 'save_user',
                                         funcschema => 'public',
                                               args => { admin => 0 },
         );
         $MyObject->save(args => {username => 'foo', password => 'bar'});

       Special arguments are:

       arg_lit
           It  set  must  point to a hashref.  Used to allow mapping of function arguments to arg hash elements.
           If this is set then funcname, funcschema, etc, cannot be overwritten on the call.

       strict_args
           If true, args override args provided by user.

       returns_objects
           If true, bless returned hashrefs before returning them.

       merge_back
           If true, merges the first record back to the $self at the end before returning,  and  returns  $self.
           Note  this is a copy only one layer deep which is fine for the use case of merging return values from
           the database into the current object.

Support

       You can find documentation for this module with the perldoc command.

           perldoc PGObject::Util::DBMethod

       You can also look for information at:

       •   RT: CPAN's request tracker (report bugs here)

           <http://rt.cpan.org/NoAuth/Bugs.html?Dist=PGObject-Util-DBMethod>

       •   AnnoCPAN: Annotated CPAN documentation

           <http://annocpan.org/dist/PGObject-Util-DBMethod>

       •   CPAN Ratings

           <http://cpanratings.perl.org/d/PGObject-Util-DBMethod>

       •   Search CPAN

           <http://search.cpan.org/dist/PGObject-Util-DBMethod/>

Synopsis

       Without PGObject::Util::DBobject, you would:

           sub mymethod {
               my ($self) = @_;
               return $self->call_dbmethod(funcname => 'foo');
           }

       With this you'd do this instead:

           dbmethod mymethod => (funcname => 'foo');

Version

       Version 1.01.000

See Also