Class: FactoryHelper::MySQL
- Inherits:
-
Base
- Object
- Base
- FactoryHelper::MySQL
show all
- Defined in:
- lib/factory-helper/my_sql.rb
Overview
Constant Summary
collapse
- INTEGERS =
{
:tinyint => {
false => {:min => -128, :max => 127},
true => {:min => 0, :max => 255},
},
:smallint => {
false => {:min => -32768, :max => 32767},
true => {:min => 0, :max => 65535},
},
:mediumint => {
false => {:min => -8388608, :max => 8388607},
true => {:min => 0, :max => 16777215},
},
:integer => {
false => {:min => -2147483648, :max => 2147483647},
true => {:min => 0, :max => 4294967295},
},
:bigint => {
false => {:min => -9223372036854775808, :max => 9223372036854775807},
true => {:min => 0, :max => 18446744073709551615},
},
}
- ArgumentError =
Class.new(StandardError)
Constants inherited
from Base
Base::Letters, Base::Numbers, Base::ULetters
Class Method Summary
collapse
Methods inherited from Base
bothify, fetch, flexible, letterify, method_missing, numerify, parse, rand_in_range, regexify, translate
Class Method Details
.bigint(opt = {}) ⇒ Object
52
53
54
55
56
|
# File 'lib/factory-helper/my_sql.rb', line 52
def bigint opt= {}
[ integer(opt),
int_with_edge_cases(int_limits_for :bigint, opt),
].sample(:random => FactoryHelper::Config.random)
end
|
.integer(opt = {}) ⇒ Object
Also known as:
int
46
47
48
49
50
|
# File 'lib/factory-helper/my_sql.rb', line 46
def integer opt= {}
[ mediumint(opt),
int_with_edge_cases(int_limits_for :integer, opt),
].sample(:random => FactoryHelper::Config.random)
end
|
.mediumint(opt = {}) ⇒ Object
40
41
42
43
44
|
# File 'lib/factory-helper/my_sql.rb', line 40
def mediumint opt= {}
[ smallint(opt),
int_with_edge_cases(int_limits_for :mediumint, opt),
].sample(:random => FactoryHelper::Config.random)
end
|
.smallint(opt = {}) ⇒ Object
34
35
36
37
38
|
# File 'lib/factory-helper/my_sql.rb', line 34
def smallint opt= {}
[ tinyint(opt),
int_with_edge_cases(int_limits_for :smallint, opt),
].sample(:random => FactoryHelper::Config.random)
end
|
.tinyint(opt = {}) ⇒ Object
29
30
31
32
|
# File 'lib/factory-helper/my_sql.rb', line 29
def tinyint opt= {}
int_sanitize opt
int_with_edge_cases(int_limits_for :tinyint, opt)
end
|