lib/adapter/cassanity.rb in adapter-cassanity-0.4.0 vs lib/adapter/cassanity.rb in adapter-cassanity-0.5.0
- old
+ new
@@ -4,12 +4,10 @@
module Adapter
module Cassanity
extend Forwardable
- def_delegator :@client, :schema
-
# Public
def read(key, options = nil)
operation_options = {where: where(key)}
adapter_options = with_default_consistency(@options[:read])
arguments = update_arguments(operation_options, adapter_options, options)
@@ -40,16 +38,12 @@
def clear(options = nil)
@client.truncate
end
# Private
- def where(criteria)
- if schema.composite_primary_key?
- criteria
- else
- primary_key = schema.primary_keys.first
- {primary_key => criteria}
- end
+ def where(key)
+ primary_key = @options.fetch(:primary_key)
+ {primary_key => key}
end
# Private
def update_arguments(operation_options, adapter_options, method_options)
keys = operation_options.keys