PrePAN

Sign in to PrePAN

DBIx::DA A CRUD wrapper for databasess

Good

Synopsis

A common CRUD interface for any DB platform

my $nongo = DBIx::DA->new(...
my $oracle = DBIx::DA->new(...

$mongo->update(...)
$oracle->update(...)

etc

Let me expand on that as like one of the commenter says it is not much to go on.

Lets make a better example.  DA (just the name for now) would be used to create the abstract data acces layer something like this perhaps

package xxx::address
use DA:::SQL
sub _init {

   my $self = shift;
   $self->add_table({name=>'address'});
   $self->add_fields([{name=>'id'},
                      {name=>'street'},
                      {name=>'city'},
                      {name=>'postal_code'},
                      {name=>'region_id'},
   ...


package xxx::invoice
use DA::NOSQL
sub _init {
   my $self = shift;
   $self->doucment(name=>'invoice');
   $self->add_nodes([first_name,last_name])
   $self->add_document({name=>ship_to,
                                        nodes=>[name,street,street}),
   ...


I would then use these in another class like this

my $address = xxx::address->new({user_id=1});
my $shipping = $address->retrieve();

my $invoice = xxx::invoice->new();
 $invoice->update({ship_to=>$shipping})

or something much like that so i guess it is looking like a Data access object

Description

I am right now looking to put it in a differnt namespace.

As I have come to relaise that DBIx is not the place for it as it does not extend DBI at all or wrap very muuch.

Perhaps becuse is will have many Modules under it does it need its own Brand?

DA::*

DataAccessor::*

Accessor::*

Was thinking of thinking of sticking it under

DB::*

but that is suppose to be for Debug (tough most of the moduels in that space have to do with DB)

Data::*

might not be a good place as that really deals with the data itself not a DB

Any suggestions??

Comments

Why not put it under Database::*? There are similar enough dists in there such as Database::Wrapper so it seems like a prime candidate.
Your synopsis and git repo don't really give enough of an overview to offer specific advice. What does Data Accessor mean in your context? Is it the programming design pattern (https://en.wikipedia.org/wiki/Data_access_object) or is it supposed to be a copy of an interface from a different language?

But, your module does use DBI, so being under DBIx isn't much of a problem considering all the other modules people have placed under it. ::DA isn't very useful, but if the module is a generic CRUD interface as you say, why not DBIx::CRUD? Please read https://pause.perl.org/pause/query?ACTION=pause_namingmodules if you haven't already. Don't create a new top-level namespace. DB:: is for the perl debugger. Data:: is too generic.
Ok updated the Synopsys a bti hope that helps

Please sign up to post a review.