Module: Cequel

Extended by:
Uuids
Defined in:
lib/cequel.rb,
lib/cequel/type.rb,
lib/cequel/util.rb,
lib/cequel/metal.rb,
lib/cequel/uuids.rb,
lib/cequel/errors.rb,
lib/cequel/record.rb,
lib/cequel/schema.rb,
lib/cequel/version.rb,
lib/cequel/metal/row.rb,
lib/cequel/metal/batch.rb,
lib/cequel/metal/writer.rb,
lib/cequel/record/bound.rb,
lib/cequel/record/dirty.rb,
lib/cequel/schema/patch.rb,
lib/cequel/schema/table.rb,
lib/cequel/spec_support.rb,
lib/cequel/metal/deleter.rb,
lib/cequel/metal/logging.rb,
lib/cequel/metal/updater.rb,
lib/cequel/record/errors.rb,
lib/cequel/record/schema.rb,
lib/cequel/record/scoped.rb,
lib/cequel/schema/column.rb,
lib/cequel/metal/data_set.rb,
lib/cequel/metal/inserter.rb,
lib/cequel/metal/keyspace.rb,
lib/cequel/record/finders.rb,
lib/cequel/record/railtie.rb,
lib/cequel/instrumentation.rb,
lib/cequel/metal/statement.rb,
lib/cequel/schema/keyspace.rb,
lib/cequel/record/callbacks.rb,
lib/cequel/metal/incrementer.rb,
lib/cequel/record/collection.rb,
lib/cequel/record/conversion.rb,
lib/cequel/record/properties.rb,
lib/cequel/record/record_set.rb,
lib/cequel/record/timestamps.rb,
lib/cequel/record/bulk_writes.rb,
lib/cequel/record/persistence.rb,
lib/cequel/record/validations.rb,
lib/cequel/metal/batch_manager.rb,
lib/cequel/record/associations.rb,
lib/cequel/schema/table_differ.rb,
lib/cequel/schema/table_reader.rb,
lib/cequel/schema/table_writer.rb,
lib/cequel/metal/request_logger.rb,
lib/cequel/schema/table_updater.rb,
lib/cequel/schema/table_desc_dsl.rb,
lib/cequel/schema/table_property.rb,
lib/cequel/record/mass_assignment.rb,
lib/cequel/metal/row_specification.rb,
lib/cequel/record/data_set_builder.rb,
lib/cequel/record/record_generator.rb,
lib/cequel/schema/update_table_dsl.rb,
lib/cequel/spec_support/preparation.rb,
lib/cequel/schema/migration_validator.rb,
lib/cequel/metal/cql_row_specification.rb,
lib/cequel/record/has_many_association.rb,
lib/cequel/metal/policy/cassandra_error.rb,
lib/cequel/record/association_collection.rb,
lib/cequel/record/belongs_to_association.rb,
lib/cequel/record/lazy_record_collection.rb,
lib/cequel/record/configuration_generator.rb,
lib/cequel/metal/new_relic_instrumentation.rb

Overview

Cequel is a library providing robust data modeling and query building capabilities for Cassandra using CQL3.

Defined Under Namespace

Modules: Instrumentation, Metal, Record, Schema, SpecSupport, Type, Util, Uuids

Constant Summary collapse

InvalidSchemaMigration =

Raised when the schema defined in Cassandra cannot be modified to match the schema defined in the application (e.g., changing the type of a primary key)

Since:

  • 1.0.0

Class.new(StandardError)
NoSuchKeyspaceError =
Class.new(StandardError)
NoSuchTableError =
Class.new(StandardError)
VERSION =

The current version of the library

'3.2.1'

Class Method Summary collapse

Class Method Details

.connect(configuration = nil) ⇒ Metal::Keyspace

Get a handle to a keyspace

Parameters:

  • configuration (Options) (defaults to: nil)

Options Hash (configuration):

  • :host (String) — default: '127.0.0.1'

    hostname of single Cassandra instance to connect to

  • :port (Integer) — default: 9042

    port on which to connect to all specified hosts

  • :max_retries (Integer)

    maximum number of retries on connection failure

  • :hosts (Array<String>)

    list of Cassandra instances to connect to (hostnames only)

  • :username (String)

    user to auth with (leave blank for no auth)

  • :password (String)

    password to auth with (leave blank for no auth)

  • :keyspace (String)

    name of keyspace to connect to

  • :ssl (Boolean)

    enable/disable ssl/tls support

  • :server_cert (String)

    path to ssl server certificate

  • :client_cert (String)

    path to ssl client certificate

  • :private_key (String)

    path to ssl client private key

  • :passphrase (String)

    the passphrase for client private key

  • :cassandra_error_policy (String)

    A mixin for handling errors from Cassandra

  • :cassandra_options (Hash)

    A hash of arbitrary options to pass to Cassandra

Returns:


37
38
39
# File 'lib/cequel.rb', line 37

def self.connect(configuration = nil)
  Metal::Keyspace.new(configuration || {})
end

.uuid(value = nil) ⇒ Object Originally defined in module Uuids

Create a UUID

Parameters:

  • value (Time, String, Integer) (defaults to: nil)

    timestamp to assign to the UUID, or numeric or string representation of the UUID

Returns:

  • a UUID appropriate for use with Cequel

.uuid?(object) ⇒ Boolean Originally defined in module Uuids

Determine if an object is a UUID

Parameters:

  • object

    an object to check

Returns:

  • (Boolean)

    true if the object is recognized by Cequel as a UUID