Module: Cassandra::Types
Defined Under Namespace
Classes: Ascii, Bigint, Blob, Boolean, Counter, Custom, Date, Decimal, Double, Float, Inet, Int, List, Map, Set, Smallint, Text, Time, Timestamp, Timeuuid, Tinyint, Tuple, UserDefined, Uuid, Varint
Instance Method Summary collapse
-
#ascii ⇒ Cassandra::Types::Ascii
Ascii type.
-
#bigint ⇒ Cassandra::Types::Bigint
Bigint type.
-
#blob ⇒ Cassandra::Types::Blob
Blob type.
-
#boolean ⇒ Cassandra::Types::Boolean
Boolean type.
-
#counter ⇒ Cassandra::Types::Counter
Counter type.
-
#custom(name) ⇒ Cassandra::Types::Custom
Custom type.
-
#date ⇒ Cassandra::Types::Date
Date type.
-
#decimal ⇒ Cassandra::Types::Decimal
Decimal type.
-
#double ⇒ Cassandra::Types::Double
Double type.
-
#float ⇒ Cassandra::Types::Float
Float type.
-
#inet ⇒ Cassandra::Types::Inet
Inet type.
-
#int ⇒ Cassandra::Types::Int
Int type.
-
#list(value_type) ⇒ Cassandra::Types::List
List type.
-
#map(key_type, value_type) ⇒ Cassandra::Types::Map
Map type.
-
#set(value_type) ⇒ Cassandra::Types::Set
Set type.
-
#smallint ⇒ Cassandra::Types::Smallint
Smallint type.
-
#text ⇒ Cassandra::Types::Text
Text type.
-
#time ⇒ Cassandra::Types::Time
Time type.
-
#timestamp ⇒ Cassandra::Types::Timestamp
Timestamp type.
-
#timeuuid ⇒ Cassandra::Types::Timeuuid
Timeuuid type.
-
#tinyint ⇒ Cassandra::Types::Tinyint
Tinyint type.
-
#tuple(*members) ⇒ Cassandra::Types::Tuple
Tuple type.
-
#udt(keyspace, name, *fields) ⇒ Cassandra::Types::UserDefined
Creates a User Defined Type instance.
-
#uuid ⇒ Cassandra::Types::Uuid
Uuid type.
-
#varchar ⇒ Cassandra::Types::Text
Text type since varchar is an alias for text.
-
#varint ⇒ Cassandra::Types::Varint
Varint type.
Instance Method Details
#ascii ⇒ Cassandra::Types::Ascii
Returns ascii type.
1433 1434 1435 |
# File 'lib/cassandra/types.rb', line 1433 def ascii Ascii end |
#bigint ⇒ Cassandra::Types::Bigint
Returns bigint type.
1438 1439 1440 |
# File 'lib/cassandra/types.rb', line 1438 def bigint Bigint end |
#blob ⇒ Cassandra::Types::Blob
Returns blob type.
1428 1429 1430 |
# File 'lib/cassandra/types.rb', line 1428 def blob Blob end |
#boolean ⇒ Cassandra::Types::Boolean
Returns boolean type.
1458 1459 1460 |
# File 'lib/cassandra/types.rb', line 1458 def boolean Boolean end |
#counter ⇒ Cassandra::Types::Counter
Returns counter type.
1443 1444 1445 |
# File 'lib/cassandra/types.rb', line 1443 def counter Counter end |
#custom(name) ⇒ Cassandra::Types::Custom
Returns custom type.
1633 1634 1635 |
# File 'lib/cassandra/types.rb', line 1633 def custom(name) Custom.new(name) end |
#date ⇒ Cassandra::Types::Date
Returns date type.
1498 1499 1500 |
# File 'lib/cassandra/types.rb', line 1498 def date Date end |
#decimal ⇒ Cassandra::Types::Decimal
Returns decimal type.
1463 1464 1465 |
# File 'lib/cassandra/types.rb', line 1463 def decimal Decimal end |
#double ⇒ Cassandra::Types::Double
Returns double type.
1468 1469 1470 |
# File 'lib/cassandra/types.rb', line 1468 def double Double end |
#float ⇒ Cassandra::Types::Float
Returns float type.
1473 1474 1475 |
# File 'lib/cassandra/types.rb', line 1473 def float Float end |
#inet ⇒ Cassandra::Types::Inet
Returns inet type.
1478 1479 1480 |
# File 'lib/cassandra/types.rb', line 1478 def inet Inet end |
#int ⇒ Cassandra::Types::Int
Returns int type.
1448 1449 1450 |
# File 'lib/cassandra/types.rb', line 1448 def int Int end |
#list(value_type) ⇒ Cassandra::Types::List
Returns list type.
1519 1520 1521 1522 1523 1524 |
# File 'lib/cassandra/types.rb', line 1519 def list(value_type) Util.assert_instance_of(Cassandra::Type, value_type, "list type must be a Cassandra::Type, #{value_type.inspect} given") List.new(value_type) end |
#map(key_type, value_type) ⇒ Cassandra::Types::Map
Returns map type.
1529 1530 1531 1532 1533 1534 1535 1536 |
# File 'lib/cassandra/types.rb', line 1529 def map(key_type, value_type) Util.assert_instance_of(Cassandra::Type, key_type, "map key type must be a Cassandra::Type, #{key_type.inspect} given") Util.assert_instance_of(Cassandra::Type, value_type, "map value type must be a Cassandra::Type, #{value_type.inspect} given") Map.new(key_type, value_type) end |
#set(value_type) ⇒ Cassandra::Types::Set
Returns set type.
1540 1541 1542 1543 1544 1545 |
# File 'lib/cassandra/types.rb', line 1540 def set(value_type) Util.assert_instance_of(Cassandra::Type, value_type, "set type must be a Cassandra::Type, #{value_type.inspect} given") Set.new(value_type) end |
#smallint ⇒ Cassandra::Types::Smallint
Returns smallint type.
1508 1509 1510 |
# File 'lib/cassandra/types.rb', line 1508 def smallint Smallint end |
#text ⇒ Cassandra::Types::Text
Returns text type.
1423 1424 1425 |
# File 'lib/cassandra/types.rb', line 1423 def text Text end |
#time ⇒ Cassandra::Types::Time
Returns time type.
1503 1504 1505 |
# File 'lib/cassandra/types.rb', line 1503 def time Time end |
#timestamp ⇒ Cassandra::Types::Timestamp
Returns timestamp type.
1483 1484 1485 |
# File 'lib/cassandra/types.rb', line 1483 def Timestamp end |
#timeuuid ⇒ Cassandra::Types::Timeuuid
Returns timeuuid type.
1493 1494 1495 |
# File 'lib/cassandra/types.rb', line 1493 def timeuuid Timeuuid end |
#tinyint ⇒ Cassandra::Types::Tinyint
Returns tinyint type.
1513 1514 1515 |
# File 'lib/cassandra/types.rb', line 1513 def Tinyint end |
#tuple(*members) ⇒ Cassandra::Types::Tuple
Returns tuple type.
1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 |
# File 'lib/cassandra/types.rb', line 1549 def tuple(*members) Util.assert_not_empty(members, 'tuple must contain at least one member') members.each do |member| Util.assert_instance_of(Cassandra::Type, member, 'each tuple member must be a Cassandra::Type, ' \ "#{member.inspect} given") end Tuple.new(*members) end |
#udt(keyspace, name, *fields) ⇒ Cassandra::Types::UserDefined
Creates a User Defined Type instance
1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 |
# File 'lib/cassandra/types.rb', line 1590 def udt(keyspace, name, *fields) keyspace = String(keyspace) name = String(name) fields = Array(fields.first) if fields.one? Util.assert_not_empty(fields, 'user-defined type must contain at least one field') if fields.first.is_a?(::Array) fields = fields.map do |pair| Util.assert(pair.size == 2, 'fields of a user-defined type must be an Array of name and ' \ "value pairs, #{pair.inspect} given") Util.assert_instance_of(::String, pair[0], 'each field name for a user-defined type must be a String, ' \ "#{pair[0].inspect} given") Util.assert_instance_of(Cassandra::Type, pair[1], 'each field type for a user-defined type must be a ' \ "Cassandra::Type, #{pair[1].inspect} given") UserDefined::Field.new(*pair) end else Util.assert(fields.size.even?, 'fields of a user-defined type must be an Array of alternating ' \ "names and values pairs, #{fields.inspect} given") fields = fields.each_slice(2).map do |field_name, field_type| Util.assert_instance_of(::String, field_name, 'each field name for a user-defined type must be a String, ' \ "#{field_name.inspect} given") Util.assert_instance_of(Cassandra::Type, field_type, 'each field type for a user-defined type must be a ' \ "Cassandra::Type, #{field_type.inspect} given") UserDefined::Field.new(field_name, field_type) end end UserDefined.new(keyspace, name, fields) end |
#uuid ⇒ Cassandra::Types::Uuid
Returns uuid type.
1488 1489 1490 |
# File 'lib/cassandra/types.rb', line 1488 def uuid Uuid end |
#varchar ⇒ Cassandra::Types::Text
Returns text type since varchar is an alias for text.
1418 1419 1420 |
# File 'lib/cassandra/types.rb', line 1418 def varchar Text end |
#varint ⇒ Cassandra::Types::Varint
Returns varint type.
1453 1454 1455 |
# File 'lib/cassandra/types.rb', line 1453 def varint Varint end |