module Cql::Model

Constants

Boolean

Type alias for use with the property-declaration DSL.

UUID
Uuid

Type aliases for use with the property-declaration DSL.

Public Class Methods

cql_client(new_client=nil) click to toggle source

Get or set the “master” client connection shared by every model that doesn’t bother to set its own. Defaults to a localhost connection with no default keyspace; every query must be wrapped in a “using_keyspace” method call.

@param [optional, Cql::Client] new_client the new client to set @return [Cql::Client] the current client

# File lib/cql/model.rb, line 37
def self.cql_client(new_client=nil)
  if new_client
    @@cql_model_mutex.synchronize do
      @@cql_client = new_client
    end
  else
    @@cql_client ||= Cql::Client.new
    @@cql_client.start! unless @@cql_client.connected?
  end

  @@cql_client
end
included(klass) click to toggle source
# File lib/cql/model.rb, line 26
def self.included(klass)
  klass.__send__(:extend, Cql::Model::ClassMethods)
  klass.__send__(:include, Cql::Model::InstanceMethods)
end