Creating Result and ResultSet classes with Moo?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Creating Result and ResultSet classes with Moo?

Robert Rothenberg
Hi All,

Is there a way to declare Result and ResultSet classes using Moo?
Specifically, I'm looking for something that provides functions for
declaring columns, e.g.

  has_column id => (
    isa => Int,
    autoincrement => 1,
  );

I'm aware of DBIx::Class::MooseColumns, but that uses Moose.

Thanks,
Rob

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Creating Result and ResultSet classes with Moo?

Marco
Excerpts from Robert Rothenberg's message of 2015-10-14 15:10:24 -0300:

> Hi All,
>
> Is there a way to declare Result and ResultSet classes using Moo?
> Specifically, I'm looking for something that provides functions for
> declaring columns, e.g.
>
>   has_column id => (
>     isa => Int,
>     autoincrement => 1,
>   );
>
> I'm aware of DBIx::Class::MooseColumns, but that uses Moose.
>
> Thanks,
> Rob
>

Short answer: no.

But, you can easily write one. Although, I don't understand your reasons
to prefer Moo* declarations (Type checking maybe ?).

You may want to wrap DBIx class with Moo* using an attribute trait, so you
can make your Moo* Classes to delegate to a DBIx classes.
Is not exactly a clever thing to do anyway, because at the end you are
gonna need some code to auto create the DBIX class from your attributes,
or even worse manual write the DBIx class underlining it.

The other option is to completely rewrite DBIx with Moo*.

--
Marco Arthur @ (M)arco Creatives

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Creating Result and ResultSet classes with Moo?

Dmitry Latin
In reply to this post by Robert Rothenberg
If you just need "moosefied" declaration syntax, then look
DBIx::Class::Candy secondary API
https://metacpan.org/pod/DBIx::Class::Candy#SECONDARY-API

On 14 October 2015 at 21:10, Robert Rothenberg <[hidden email]> wrote:

> Hi All,
>
> Is there a way to declare Result and ResultSet classes using Moo?
> Specifically, I'm looking for something that provides functions for
> declaring columns, e.g.
>
>   has_column id => (
>     isa => Int,
>     autoincrement => 1,
>   );
>
> I'm aware of DBIx::Class::MooseColumns, but that uses Moose.
>
> Thanks,
> Rob
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive: http://www.grokbase.com/group/dbix-class@...



--
//wbr, Dmitry L.

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...
Loading...