Sha256: eb4f3a2fa278bdb8153071a31f06aee2d1cb2ea75bc073b712f2708402f5eb06
Contents?: true
Size: 1.33 KB
Versions: 21
Compression:
Stored size: 1.33 KB
Contents
module CassandraObject module Adapters class AbstractAdapter attr_reader :config def initialize(config) @config = config end # Read records from a instance of CassandraObject::Scope def select(scope) # abstract end # Insert a new row def insert(table, id, attributes) # abstract end # Update an existing row def update(table, id, attributes) # abstract end # Delete rows by an array of ids def delete(table, ids) # abstract end def execute_batch(statements) # abstract end def batching? !@batch_statements.nil? end def batch @batch_statements = [] yield execute_batch(@batch_statements) if !@batch_statements.nil? && @batch_statements.any? ensure @batch_statements = nil end def statement_with_options(stmt, options) if options.present? with_stmt = options.split(',').map do |o| "#{o}" end.join(' AND ') stmt = "#{stmt} WITH #{with_stmt}" end stmt end def execute_batchable(statements) if defined?(@batch_statements) && @batch_statements @batch_statements += statements else execute_batch(statements) end end end end end
Version data entries
21 entries across 21 versions & 1 rubygems