Module: Cassandra::Types
Defined Under Namespace
Classes: Ascii, Bigint, Blob, Boolean, Counter, Custom, Decimal, Double, Float, Inet, Int, List, Map, Set, Text, Timestamp, Timeuuid, Tuple, UserDefined, Uuid, Varchar, 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.
-
#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::Map
Map type.
-
#map(key_type, value_type) ⇒ Cassandra::Types::Varchar
Varchar type.
-
#set(value_type) ⇒ Cassandra::Types::Set
Set type.
-
#text ⇒ Cassandra::Types::Text
Text type.
-
#timestamp ⇒ Cassandra::Types::Timestamp
Timestamp type.
-
#timeuuid ⇒ Cassandra::Types::Timeuuid
Timeuuid 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::Varchar
Varchar type.
-
#varint ⇒ Cassandra::Types::Varint
Varint type.
Instance Method Details
#ascii ⇒ Cassandra::Types::Ascii
Returns ascii type.
1222 1223 1224 |
# File 'lib/cassandra/types.rb', line 1222 def ascii Ascii end |
#bigint ⇒ Cassandra::Types::Bigint
Returns bigint type.
1227 1228 1229 |
# File 'lib/cassandra/types.rb', line 1227 def bigint Bigint end |
#blob ⇒ Cassandra::Types::Blob
Returns blob type.
1217 1218 1219 |
# File 'lib/cassandra/types.rb', line 1217 def blob Blob end |
#boolean ⇒ Cassandra::Types::Boolean
Returns boolean type.
1247 1248 1249 |
# File 'lib/cassandra/types.rb', line 1247 def boolean Boolean end |
#counter ⇒ Cassandra::Types::Counter
Returns counter type.
1232 1233 1234 |
# File 'lib/cassandra/types.rb', line 1232 def counter Counter end |
#custom(name) ⇒ Cassandra::Types::Custom
Returns custom type.
1402 1403 1404 |
# File 'lib/cassandra/types.rb', line 1402 def custom(name) Custom.new(name) end |
#decimal ⇒ Cassandra::Types::Decimal
Returns decimal type.
1252 1253 1254 |
# File 'lib/cassandra/types.rb', line 1252 def decimal Decimal end |
#double ⇒ Cassandra::Types::Double
Returns double type.
1257 1258 1259 |
# File 'lib/cassandra/types.rb', line 1257 def double Double end |
#float ⇒ Cassandra::Types::Float
Returns float type.
1262 1263 1264 |
# File 'lib/cassandra/types.rb', line 1262 def float Float end |
#inet ⇒ Cassandra::Types::Inet
Returns inet type.
1267 1268 1269 |
# File 'lib/cassandra/types.rb', line 1267 def inet Inet end |
#int ⇒ Cassandra::Types::Int
Returns int type.
1237 1238 1239 |
# File 'lib/cassandra/types.rb', line 1237 def int Int end |
#list(value_type) ⇒ Cassandra::Types::Map
Returns map type.
1288 1289 1290 1291 1292 1293 1294 |
# File 'lib/cassandra/types.rb', line 1288 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::Varchar
Returns varchar type.
1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 |
# File 'lib/cassandra/types.rb', line 1299 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.
1312 1313 1314 1315 1316 1317 1318 |
# File 'lib/cassandra/types.rb', line 1312 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 |
#text ⇒ Cassandra::Types::Text
Returns text type.
1212 1213 1214 |
# File 'lib/cassandra/types.rb', line 1212 def text Text end |
#timestamp ⇒ Cassandra::Types::Timestamp
Returns timestamp type.
1272 1273 1274 |
# File 'lib/cassandra/types.rb', line 1272 def Timestamp end |
#timeuuid ⇒ Cassandra::Types::Timeuuid
Returns timeuuid type.
1282 1283 1284 |
# File 'lib/cassandra/types.rb', line 1282 def timeuuid Timeuuid end |
#tuple(*members) ⇒ Cassandra::Types::Tuple
Returns tuple type.
1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 |
# File 'lib/cassandra/types.rb', line 1322 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
1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 |
# File 'lib/cassandra/types.rb', line 1352 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 % 2) == 0, "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.
1277 1278 1279 |
# File 'lib/cassandra/types.rb', line 1277 def uuid Uuid end |
#varchar ⇒ Cassandra::Types::Varchar
Returns varchar type.
1207 1208 1209 |
# File 'lib/cassandra/types.rb', line 1207 def varchar Varchar end |
#varint ⇒ Cassandra::Types::Varint
Returns varint type.
1242 1243 1244 |
# File 'lib/cassandra/types.rb', line 1242 def varint Varint end |