lib/google/cloud/spanner/convert.rb in google-cloud-spanner-1.3.1 vs lib/google/cloud/spanner/convert.rb in google-cloud-spanner-1.4.0
- old
+ new
@@ -35,10 +35,11 @@
end
Hash[formatted_params]
end
def raw_to_value_and_type obj, type = nil
+ obj = obj.to_column_value if obj.respond_to? :to_column_value
if NilClass === obj
if type
if type.is_a?(Array) && type.count == 1
[Google::Protobuf::Value.new(null_value: :NULL_VALUE),
Google::Spanner::V1::Type.new(
@@ -113,9 +114,11 @@
"A parameter of type #{obj.class} is not supported."
end
end
def raw_to_value obj
+ obj = obj.to_column_value if obj.respond_to? :to_column_value
+
if NilClass === obj
Google::Protobuf::Value.new null_value: :NULL_VALUE
elsif String === obj
Google::Protobuf::Value.new string_value: obj
elsif Symbol === obj