![]() |
![]()
| ![]() |
![]()
NAMEDBIx::DBHResolver::Strategy::List - write short description for DBIx::DBHResolver::Strategy::List SYNOPSISuse DBIx::DBHResolver; use DBIx::DBHResolver::Strategy::List; our %BLOOD_TYPES = ( UNKNOWN => 0, A => 1, B => 2, O => 3, AB => 4, ); my $resolver = DBIx::DBHResolver->new; $resolver->config(+{ clusters => +{ BLOOD => +{ node => [ qw/BLOOD_A BLOOD_B BLOOD_O BLOOD_AB_OR_UNKNOWN/ ], strategy => 'List', strategy_config => +{ BLOOD_A => [qw/1/], BLOOD_B => [qw/2/], BLOOD_O => [qw/3/], BLOOD_AB_OR_UNKNOWN => [qw/0 4/] }, } }, connect_info => +{ BLOOD_A => +{ ... }, BLOOD_B => +{ ... }, BLOOD_O => +{ ... }, BLOOD_AB_OR_UNKNOWN => +{ ... }, }, }); my $strategy = 'DBIx::DBHResolver::Strategy::List'; $strategy->connect_info( $resolver, 'BLOOD', $BLOOD_TYPE{A} ); # return BLOOD_A's connect_info $strategy->connect_info( $resolver, 'BLOOD', $BLOOD_TYPE{B} ); # return BLOOD_B's connect_info $strategy->connect_info( $resolver, 'BLOOD', $BLOOD_TYPE{O} ); # return BLOOD_O's connect_info $strategy->connect_info( $resolver, 'BLOOD', $BLOOD_TYPE{AB} ); # return BLOOD_AB_OR_UNKNOWN's connect_info $strategy->connect_info( $resolver, 'BLOOD', $BLOOD_TYPE{UNKNOWN} ); # return BLOOD_AB_OR_UNKNOWN's connect_info DESCRIPTIONThis module is list based sharding strategy. METHODSconnect_info( $resolver, $node_or_cluster, $args )Return connect_info hash ref. resolve( $resolver, $node_or_cluster, $key, $args )Return resolved node_or_cluster name. AUTHORToru Yamaguchi <zigorou@dena.jp<gt> LICENSEThis module is licensed under the same terms as Perl itself. SEE ALSO
|