JSONSchema/Default/MySQL.pm

filter: Statementstmt 100% 13 / 13 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 100% 18 / 18 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« JSONSchema/Type/MySQL.pm ↑ Summary
1 package DBIx::Result::Convert::JSONSchema::Default::MySQL;
2  
3 =head1 NAME
4  
5 DBIx::Result::Convert::JSONSchema::Default::MySQL - Mapping of MySQL field type lengths
6  
7 =head1 VERSION
8  
9 0.01
10  
11 =head1 SYNOPSIS
12  
13 use DBIx::Result::Convert::JSONSchema::Default::MySQL;
14 my $lenght_map = DBIx::Result::Convert::JSONSchema::Default::MySQL->get_length_map;
15  
16 =head1 DESCRIPTION
17  
18 This module defines default field lengths of MySQL database field types.
19  
20 =cut
21  
22 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 4 our $VERSION = '0.01';
26  
27 4 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
28  
29  
30 4 Readonly my %LENGTH_MAP => (
31 char => [ 0, 1 ],
32 varchar => [ 0, 255 ],
33 binary => [ 0, 255 ],
34 varbinary => [ 0, 255 ],
35 blob => [ 0, 65_535 ],
36 text => [ 0, 65_535 ],
37 mediumtext => [ 0, 16_777_215 ],
38 tinytext => [ 0, 255 ],
39 date => [ 10, 10 ],
40 datetime => [ 19, 19 ],
41 timestamp => [ 19, 19 ],
42 time => [ 8, 8 ],
43 year => [ 4, 4 ],
44 integer => {
45 signed => [ -2_147_483_648, 2_147_483_647 ],
46 unsigned => [ 0, 4_294_967_295 ],
47 },
48 smallint => {
49 signed => [ -32_768, 32_767 ],
50 unsigned => [ 0, 65_535 ],
51 },
52 tinyint => {
53 signed => [ -128, 127 ],
54 unsigned => [ 0, 255 ],
55 },
56 mediumint => {
57 signed => [ -8_388_608, 8_388_607 ],
58 unsigned => [ 0, 16_777_215 ],
59 },
60 bigint => {
61 signed => [ (2**63) * -1, (2**63) - 1 ],
62 unsigned => [ 0, (2**64) - 1 ],
63 },
64 bit => {
65 signed => [ 0, 1 ],
66 unsigned => [ 0, 1 ],
67 },
68 );
69  
70 =head2 C<get_length_map>
71  
72 Static method on class that returns field length mapping.
73  
74 my $lenght_map = DBIx::Result::Convert::JSONSchema::Default::MySQL->get_length_map;
75  
76 =cut
77  
78 6 ▶sub get_length_map { \%LENGTH_MAP }
Subroutine get_length_map: called CC=1 SCAR=0.0
Pod documented
79  
80 =head1 AUTHOR
81  
82 malishew - C<malishew@cpan.org>
83  
84 =head1 LICENSE
85  
86 This library is free software; you can redistribute it and/or modify it under
87 the same terms as Perl itself. If you would like to contribute documentation
88 or file a bug report then please raise an issue / pull request:
89  
90 https://github.com/Humanstate/p5-dbix-result-convert-jsonschema
91  
92 =cut
93  
94 4 1;
« JSONSchema/Type/MySQL.pm ↑ Summary