Commit | Line | Data |
a19bdae0 |
1 | NAME |
2 | DBIx::Class::UUIDColumns - Implicit uuid columns |
3 | |
4 | SYNOPSIS |
5 | In your DBIx::Class table class: |
6 | |
7 | __PACKAGE__->load_components(qw/UUIDColumns ... Core/); |
8 | __PACKAGE__->uuid_columns('artist_id'); |
9 | |
10 | Note: The component needs to be loaded *before* Core. |
11 | |
12 | DESCRIPTION |
13 | This DBIx::Class component resembles the behaviour of Class::DBI::UUID, |
14 | to make some columns implicitly created as uuid. |
15 | |
16 | When loaded, "UUIDColumns" will search for a suitable uuid generation |
17 | module from the following list of supported modules: |
18 | |
19 | Data::UUID |
20 | APR::UUID* |
21 | UUID |
22 | Win32::Guidgen |
23 | Win32API::GUID |
24 | |
25 | If no supporting module can be found, an exception will be thrown. |
26 | |
27 | *APR::UUID will not be loaded under OpenBSD due to an as yet |
28 | unidentified XS issue. |
29 | |
30 | If you would like to use a specific module, you can set "uuid_class": |
31 | |
32 | __PACKAGE__->uuid_class('::Data::UUID'); |
33 | __PACKAGE__->uuid_class('MyUUIDGenerator'); |
34 | |
35 | METHODS |
36 | get_uuid |
37 | Returns a uuid string from the current uuid_maker. |
38 | |
39 | insert |
40 | Inserts a new uuid string into each column in "uuid_columns". |
41 | |
42 | uuid_columns |
43 | Takes a list of columns to be filled with uuids during insert. |
44 | |
45 | __PACKAGE__->uuid_columns('artist_id'); |
46 | |
47 | uuid_class |
48 | Takes the name of a UUIDMaker subclass to be used for uuid value |
49 | generation. This can be a fully qualified class name, or a shortcut name |
50 | starting with :: that matches one of the available |
51 | DBIx::Class::UUIDColumns::UUIDMaker subclasses: |
52 | |
53 | __PACKAGE__->uuid_class('CustomUUIDGenerator'); |
54 | # loads CustomeUUIDGenerator |
55 | |
56 | __PACKAGE__->uuid_class('::Data::UUID'); |
57 | # loads DBIx::Class::UUIDMaker::Data::UUID; |
58 | |
59 | Note that "uuid_class" checks to see that the specified class isa |
60 | DBIx::Class::UUIDColumns::UUIDMaker subclass and throws and exception if |
61 | it isn't. |
62 | |
63 | uuid_maker |
64 | Returns the current UUIDMaker instance for the given module. |
65 | |
66 | my $uuid = __PACKAGE__->uuid_maker->as_string; |
67 | |
68 | SEE ALSO |
69 | DBIx::Class::UUIDColumns::UUIDMaker |
70 | |
71 | AUTHOR |
72 | Chia-liang Kao <clkao@clkao.org> |
73 | |
74 | CONTRIBUTERS |
75 | Chris Laco <claco@chrislaco.com> |
76 | |
77 | LICENSE |
78 | You may distribute this code under the same terms as Perl itself. |
79 | |