yugabyte-ycql-driver 3.2.3.1 → 3.2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/README.md +2 -2
 - data/lib/cassandra/cluster/schema/cql_type_parser.rb +1 -0
 - data/lib/cassandra/protocol/coder.rb +14 -0
 - data/lib/cassandra/types.rb +46 -0
 - data/lib/cassandra/version.rb +1 -1
 - metadata +4 -4
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: b753f0f1caa1a111c6b06f09948f2d43044135f0
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: c206ec00e72602d3029d0331d8cdf850115929b1
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 152346040cbf20ac767041f1966f3978e5fc9a46a6fa3a8f8808095917768443e332e7e06206e65fe31424b64597ae06c3517477c04339bd8a99de31521f6db3
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: b48e47de726948927484dda1e08a96717a7b767d3c2df352df4162c4a7f6a687db2da4edcd480ac2d5cd03a08f43a2d4cf4df0e25721112a1b054a6567348d2e
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -11,7 +11,7 @@ the Cassandra Query Language version 3 (CQL3) and Cassandra's native protocol. 
     | 
|
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
            - Code: https://github.com/yugabyte/cassandra-ruby-driver
         
     | 
| 
       13 
13 
     | 
    
         
             
            - Docs: http://docs.datastax.com/en/developer/ruby-driver
         
     | 
| 
       14 
     | 
    
         
            -
            -  
     | 
| 
      
 14 
     | 
    
         
            +
            - Forum: https://forum.yugabyte.com
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
            This driver is based on [the cql-rb gem](https://github.com/iconara/cql-rb) by [Theo Hultberg](https://github.com/iconara) and we added support for:
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
         @@ -227,7 +227,7 @@ Driver for Apache Cassandra will continue on this project, while 
     | 
|
| 
       227 
227 
     | 
    
         | 
| 
       228 
228 
     | 
    
         
             
            ## Copyright
         
     | 
| 
       229 
229 
     | 
    
         | 
| 
       230 
     | 
    
         
            -
            Copyright  
     | 
| 
      
 230 
     | 
    
         
            +
            Copyright 2019, YugaByte, Inc.
         
     | 
| 
       231 
231 
     | 
    
         | 
| 
       232 
232 
     | 
    
         
             
            Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
         
     | 
| 
       233 
233 
     | 
    
         
             
            except in compliance with the License. You may obtain a copy of the License at
         
     | 
| 
         @@ -60,6 +60,7 @@ module Cassandra 
     | 
|
| 
       60 
60 
     | 
    
         
             
                      when 'smallint'          then Cassandra::Types.smallint
         
     | 
| 
       61 
61 
     | 
    
         
             
                      when 'time'              then Cassandra::Types.time
         
     | 
| 
       62 
62 
     | 
    
         
             
                      when 'tinyint'           then Cassandra::Types.tinyint
         
     | 
| 
      
 63 
     | 
    
         
            +
                      when 'jsonb'             then Cassandra::Types.jsonb
         
     | 
| 
       63 
64 
     | 
    
         
             
                      when 'map'               then
         
     | 
| 
       64 
65 
     | 
    
         
             
                        Cassandra::Types.map(*node.children.map { |t| lookup_type(t, types)})
         
     | 
| 
       65 
66 
     | 
    
         
             
                      when 'set'               then
         
     | 
| 
         @@ -117,6 +117,7 @@ module Cassandra 
     | 
|
| 
       117 
117 
     | 
    
         
             
                                                             type.value_type)
         
     | 
| 
       118 
118 
     | 
    
         
             
                    when :udt              then write_udt_v4(buffer, value, type.fields)
         
     | 
| 
       119 
119 
     | 
    
         
             
                    when :tuple            then write_tuple_v4(buffer, value, type.members)
         
     | 
| 
      
 120 
     | 
    
         
            +
                    when :jsonb            then write_text(buffer, value)
         
     | 
| 
       120 
121 
     | 
    
         
             
                    else
         
     | 
| 
       121 
122 
     | 
    
         
             
                      raise Errors::EncodingError, %(Unsupported value type: #{type})
         
     | 
| 
       122 
123 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -217,6 +218,7 @@ module Cassandra 
     | 
|
| 
       217 
218 
     | 
    
         
             
                    when 0x0031 then Types.tuple(
         
     | 
| 
       218 
219 
     | 
    
         
             
                      *::Array.new(buffer.read_short) { read_type_v4(buffer) }
         
     | 
| 
       219 
220 
     | 
    
         
             
                    )
         
     | 
| 
      
 221 
     | 
    
         
            +
                    when 0x0080 then Types.jsonb
         
     | 
| 
       220 
222 
     | 
    
         
             
                    else
         
     | 
| 
       221 
223 
     | 
    
         
             
                      raise Errors::DecodingError, %(Unsupported column type: #{id})
         
     | 
| 
       222 
224 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -255,6 +257,7 @@ module Cassandra 
     | 
|
| 
       255 
257 
     | 
    
         
             
                    when :time             then read_time(buffer)
         
     | 
| 
       256 
258 
     | 
    
         
             
                    when :date             then read_date(buffer)
         
     | 
| 
       257 
259 
     | 
    
         
             
                    when :custom           then read_custom(buffer, type, custom_type_handlers)
         
     | 
| 
      
 260 
     | 
    
         
            +
                    when :jsonb            then read_text(buffer)
         
     | 
| 
       258 
261 
     | 
    
         
             
                    when :list
         
     | 
| 
       259 
262 
     | 
    
         
             
                      return nil unless read_size(buffer)
         
     | 
| 
       260 
263 
     | 
    
         | 
| 
         @@ -405,6 +408,7 @@ module Cassandra 
     | 
|
| 
       405 
408 
     | 
    
         
             
                                                             type.value_type)
         
     | 
| 
       406 
409 
     | 
    
         
             
                    when :udt              then write_udt_v3(buffer, value, type.fields)
         
     | 
| 
       407 
410 
     | 
    
         
             
                    when :tuple            then write_tuple_v3(buffer, value, type.members)
         
     | 
| 
      
 411 
     | 
    
         
            +
                    when :jsonb            then write_text(buffer, value)
         
     | 
| 
       408 
412 
     | 
    
         
             
                    else
         
     | 
| 
       409 
413 
     | 
    
         
             
                      raise Errors::EncodingError, %(Unsupported value type: #{type})
         
     | 
| 
       410 
414 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -438,6 +442,7 @@ module Cassandra 
     | 
|
| 
       438 
442 
     | 
    
         
             
                    when :text             then read_text(buffer)
         
     | 
| 
       439 
443 
     | 
    
         
             
                    when :varint           then read_varint(buffer)
         
     | 
| 
       440 
444 
     | 
    
         
             
                    when :inet             then read_inet(buffer)
         
     | 
| 
      
 445 
     | 
    
         
            +
                    when :jsonb            then read_text(buffer)
         
     | 
| 
       441 
446 
     | 
    
         
             
                    when :list
         
     | 
| 
       442 
447 
     | 
    
         
             
                      return nil unless read_size(buffer)
         
     | 
| 
       443 
448 
     | 
    
         | 
| 
         @@ -568,6 +573,7 @@ module Cassandra 
     | 
|
| 
       568 
573 
     | 
    
         
             
                    when 0x0031 then Types.tuple(
         
     | 
| 
       569 
574 
     | 
    
         
             
                      *::Array.new(buffer.read_short) { read_type_v3(buffer) }
         
     | 
| 
       570 
575 
     | 
    
         
             
                    )
         
     | 
| 
      
 576 
     | 
    
         
            +
                    when 0x0080 then Types.jsonb
         
     | 
| 
       571 
577 
     | 
    
         
             
                    else
         
     | 
| 
       572 
578 
     | 
    
         
             
                      raise Errors::DecodingError, %(Unsupported column type: #{id})
         
     | 
| 
       573 
579 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -628,6 +634,7 @@ module Cassandra 
     | 
|
| 
       628 
634 
     | 
    
         
             
                    when :timestamp        then write_timestamp(buffer, value)
         
     | 
| 
       629 
635 
     | 
    
         
             
                    when :timeuuid, :uuid  then write_uuid(buffer, value)
         
     | 
| 
       630 
636 
     | 
    
         
             
                    when :varint           then write_varint(buffer, value)
         
     | 
| 
      
 637 
     | 
    
         
            +
                    when :jsonb            then write_text(buffer, value)
         
     | 
| 
       631 
638 
     | 
    
         
             
                    when :list, :set       then write_list_v1(buffer, value, type.value_type)
         
     | 
| 
       632 
639 
     | 
    
         
             
                    when :map              then write_map_v1(buffer,
         
     | 
| 
       633 
640 
     | 
    
         
             
                                                             value,
         
     | 
| 
         @@ -666,6 +673,7 @@ module Cassandra 
     | 
|
| 
       666 
673 
     | 
    
         
             
                    when :uuid             then read_uuid(buffer)
         
     | 
| 
       667 
674 
     | 
    
         
             
                    when :timeuuid         then read_uuid(buffer, TimeUuid)
         
     | 
| 
       668 
675 
     | 
    
         
             
                    when :inet             then read_inet(buffer)
         
     | 
| 
      
 676 
     | 
    
         
            +
                    when :jsonb            then read_text(buffer)
         
     | 
| 
       669 
677 
     | 
    
         
             
                    when :list
         
     | 
| 
       670 
678 
     | 
    
         
             
                      return nil unless read_size(buffer)
         
     | 
| 
       671 
679 
     | 
    
         | 
| 
         @@ -757,6 +765,7 @@ module Cassandra 
     | 
|
| 
       757 
765 
     | 
    
         
             
                    when 0x0020 then Types.list(read_type_v1(buffer))
         
     | 
| 
       758 
766 
     | 
    
         
             
                    when 0x0021 then Types.map(read_type_v1(buffer), read_type_v1(buffer))
         
     | 
| 
       759 
767 
     | 
    
         
             
                    when 0x0022 then Types.set(read_type_v1(buffer))
         
     | 
| 
      
 768 
     | 
    
         
            +
                    when 0x0080 then Types.text
         
     | 
| 
       760 
769 
     | 
    
         
             
                    else
         
     | 
| 
       761 
770 
     | 
    
         
             
                      raise Errors::DecodingError, %(Unsupported column type: #{kind})
         
     | 
| 
       762 
771 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -995,6 +1004,9 @@ module Cassandra 
     | 
|
| 
       995 
1004 
     | 
    
         
             
                    when :varint
         
     | 
| 
       996 
1005 
     | 
    
         
             
                      size = read_short_size(buffer)
         
     | 
| 
       997 
1006 
     | 
    
         
             
                      size && buffer.read_varint(size)
         
     | 
| 
      
 1007 
     | 
    
         
            +
                    when :jsonb
         
     | 
| 
      
 1008 
     | 
    
         
            +
                      value = buffer.read_short_bytes
         
     | 
| 
      
 1009 
     | 
    
         
            +
                      value && value.force_encoding(::Encoding::UTF_8)
         
     | 
| 
       998 
1010 
     | 
    
         
             
                    else
         
     | 
| 
       999 
1011 
     | 
    
         
             
                      raise Errors::EncodingError, %(Unsupported short value type: #{type})
         
     | 
| 
       1000 
1012 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -1068,6 +1080,8 @@ module Cassandra 
     | 
|
| 
       1068 
1080 
     | 
    
         
             
                      end
         
     | 
| 
       1069 
1081 
     | 
    
         
             
                    when :varint
         
     | 
| 
       1070 
1082 
     | 
    
         
             
                      buffer.append_short_bytes(value && CqlByteBuffer.new.append_varint(value))
         
     | 
| 
      
 1083 
     | 
    
         
            +
                    when :jsonb
         
     | 
| 
      
 1084 
     | 
    
         
            +
                      buffer.append_short_bytes(value && value.encode(::Encoding::UTF_8))
         
     | 
| 
       1071 
1085 
     | 
    
         
             
                    else
         
     | 
| 
       1072 
1086 
     | 
    
         
             
                      raise Errors::EncodingError, %(Unsupported short value type: #{type})
         
     | 
| 
       1073 
1087 
     | 
    
         
             
                    end
         
     | 
    
        data/lib/cassandra/types.rb
    CHANGED
    
    | 
         @@ -264,6 +264,15 @@ module Cassandra 
     | 
|
| 
       264 
264 
     | 
    
         
             
                    Util.assert_instance_of(::Integer, value, message, &block)
         
     | 
| 
       265 
265 
     | 
    
         
             
                    Util.assert(value <= 127 && value >= -128, message, &block)
         
     | 
| 
       266 
266 
     | 
    
         
             
                  end
         
     | 
| 
      
 267 
     | 
    
         
            +
             
     | 
| 
      
 268 
     | 
    
         
            +
                  def new_jsonb(value)
         
     | 
| 
      
 269 
     | 
    
         
            +
                    String(value)
         
     | 
| 
      
 270 
     | 
    
         
            +
                  end
         
     | 
| 
      
 271 
     | 
    
         
            +
             
     | 
| 
      
 272 
     | 
    
         
            +
                  def assert_jsonb(value, message, &block)
         
     | 
| 
      
 273 
     | 
    
         
            +
                    Util.assert_instance_of(::String, value, message, &block)
         
     | 
| 
      
 274 
     | 
    
         
            +
                  end
         
     | 
| 
      
 275 
     | 
    
         
            +
             
     | 
| 
       267 
276 
     | 
    
         
             
                end
         
     | 
| 
       268 
277 
     | 
    
         | 
| 
       269 
278 
     | 
    
         
             
                # @!parse
         
     | 
| 
         @@ -1036,6 +1045,38 @@ module Cassandra 
     | 
|
| 
       1036 
1045 
     | 
    
         
             
                #   end
         
     | 
| 
       1037 
1046 
     | 
    
         
             
                const_set('Tinyint', Simple.new(:tinyint))
         
     | 
| 
       1038 
1047 
     | 
    
         | 
| 
      
 1048 
     | 
    
         
            +
                # @!parse
         
     | 
| 
      
 1049 
     | 
    
         
            +
                #   class Jsonb < Type
         
     | 
| 
      
 1050 
     | 
    
         
            +
                #     # @return [Symbol] `:jsonb`
         
     | 
| 
      
 1051 
     | 
    
         
            +
                #     # @see Cassandra::Type#kind
         
     | 
| 
      
 1052 
     | 
    
         
            +
                #     def kind
         
     | 
| 
      
 1053 
     | 
    
         
            +
                #     end
         
     | 
| 
      
 1054 
     | 
    
         
            +
                #
         
     | 
| 
      
 1055 
     | 
    
         
            +
                #     # Coerces the value to String
         
     | 
| 
      
 1056 
     | 
    
         
            +
                #     # @param value [Object] original value
         
     | 
| 
      
 1057 
     | 
    
         
            +
                #     # @return [String] value
         
     | 
| 
      
 1058 
     | 
    
         
            +
                #     # @see Cassandra::Type#new
         
     | 
| 
      
 1059 
     | 
    
         
            +
                #     def new(value)
         
     | 
| 
      
 1060 
     | 
    
         
            +
                #     end
         
     | 
| 
      
 1061 
     | 
    
         
            +
                #
         
     | 
| 
      
 1062 
     | 
    
         
            +
                #     # Asserts that a given value is a String
         
     | 
| 
      
 1063 
     | 
    
         
            +
                #     # @param value [Object] value to be validated
         
     | 
| 
      
 1064 
     | 
    
         
            +
                #     # @param message [String] error message to use when assertion
         
     | 
| 
      
 1065 
     | 
    
         
            +
                #     #   fails
         
     | 
| 
      
 1066 
     | 
    
         
            +
                #     # @yieldreturn [String] error message to use when assertion fails
         
     | 
| 
      
 1067 
     | 
    
         
            +
                #     # @raise [ArgumentError] if the value is not a String
         
     | 
| 
      
 1068 
     | 
    
         
            +
                #     # @return [void]
         
     | 
| 
      
 1069 
     | 
    
         
            +
                #     # @see Cassandra::Type#assert
         
     | 
| 
      
 1070 
     | 
    
         
            +
                #     def assert(value, message = nil, &block)
         
     | 
| 
      
 1071 
     | 
    
         
            +
                #     end
         
     | 
| 
      
 1072 
     | 
    
         
            +
                #
         
     | 
| 
      
 1073 
     | 
    
         
            +
                #     # @return [String] `"jsonb"`
         
     | 
| 
      
 1074 
     | 
    
         
            +
                #     # @see Cassandra::Type#to_s
         
     | 
| 
      
 1075 
     | 
    
         
            +
                #     def to_s
         
     | 
| 
      
 1076 
     | 
    
         
            +
                #     end
         
     | 
| 
      
 1077 
     | 
    
         
            +
                #   end
         
     | 
| 
      
 1078 
     | 
    
         
            +
                const_set('Jsonb', Simple.new(:jsonb))
         
     | 
| 
      
 1079 
     | 
    
         
            +
             
     | 
| 
       1039 
1080 
     | 
    
         
             
                class Tuple < Type
         
     | 
| 
       1040 
1081 
     | 
    
         
             
                  # @private
         
     | 
| 
       1041 
1082 
     | 
    
         
             
                  attr_reader :members
         
     | 
| 
         @@ -1581,6 +1622,11 @@ module Cassandra 
     | 
|
| 
       1581 
1622 
     | 
    
         
             
                  Tinyint
         
     | 
| 
       1582 
1623 
     | 
    
         
             
                end
         
     | 
| 
       1583 
1624 
     | 
    
         | 
| 
      
 1625 
     | 
    
         
            +
                # @return [Cassandra::Types::Jsonb] jsonb type
         
     | 
| 
      
 1626 
     | 
    
         
            +
                def jsonb
         
     | 
| 
      
 1627 
     | 
    
         
            +
                  Jsonb
         
     | 
| 
      
 1628 
     | 
    
         
            +
                end
         
     | 
| 
      
 1629 
     | 
    
         
            +
             
     | 
| 
       1584 
1630 
     | 
    
         
             
                # @param value_type [Cassandra::Type] the type of elements in this list
         
     | 
| 
       1585 
1631 
     | 
    
         
             
                # @return [Cassandra::Types::List] list type
         
     | 
| 
       1586 
1632 
     | 
    
         
             
                def list(value_type)
         
     | 
    
        data/lib/cassandra/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: yugabyte-ycql-driver
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 3.2.3. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 3.2.3.2
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Theo Hultberg
         
     | 
| 
         @@ -11,7 +11,7 @@ authors: 
     | 
|
| 
       11 
11 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       12 
12 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       13 
13 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       14 
     | 
    
         
            -
            date: 2019- 
     | 
| 
      
 14 
     | 
    
         
            +
            date: 2019-10-01 00:00:00.000000000 Z
         
     | 
| 
       15 
15 
     | 
    
         
             
            dependencies:
         
     | 
| 
       16 
16 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       17 
17 
     | 
    
         
             
              name: ione
         
     | 
| 
         @@ -213,7 +213,7 @@ files: 
     | 
|
| 
       213 
213 
     | 
    
         
             
            - lib/ycql.rb
         
     | 
| 
       214 
214 
     | 
    
         
             
            homepage: https://github.com/YugaByte/cassandra-ruby-driver
         
     | 
| 
       215 
215 
     | 
    
         
             
            licenses:
         
     | 
| 
       216 
     | 
    
         
            -
            - Apache 
     | 
| 
      
 216 
     | 
    
         
            +
            - Apache-2.0
         
     | 
| 
       217 
217 
     | 
    
         
             
            metadata: {}
         
     | 
| 
       218 
218 
     | 
    
         
             
            post_install_message: 
         
     | 
| 
       219 
219 
     | 
    
         
             
            rdoc_options:
         
     | 
| 
         @@ -236,7 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       236 
236 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       237 
237 
     | 
    
         
             
            requirements: []
         
     | 
| 
       238 
238 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       239 
     | 
    
         
            -
            rubygems_version: 2. 
     | 
| 
      
 239 
     | 
    
         
            +
            rubygems_version: 2.6.11
         
     | 
| 
       240 
240 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       241 
241 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       242 
242 
     | 
    
         
             
            summary: Ruby Driver for YugaByte DB
         
     |