Module: Cequel::Record
- Extended by:
- ActiveSupport::Concern, Forwardable
- Defined in:
- lib/cequel/record.rb,
lib/cequel/record/bound.rb,
lib/cequel/record/dirty.rb,
lib/cequel/record/errors.rb,
lib/cequel/record/schema.rb,
lib/cequel/record/scoped.rb,
lib/cequel/record/finders.rb,
lib/cequel/record/railtie.rb,
lib/cequel/record/callbacks.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/record/associations.rb,
lib/cequel/record/mass_assignment.rb,
lib/cequel/record/data_set_builder.rb,
lib/cequel/record/record_generator.rb,
lib/cequel/record/has_many_association.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
Overview
Cequel::Record is an active record-style data modeling library and object-row mapper. Model classes inherit from Cequel::Record, define their columns in the class definition, and have access to a full and robust set of read and write functionality.
Individual components are documented in their respective modules. See below for links.
Defined Under Namespace
Modules: Associations, BulkWrites, Callbacks, ClassMethods, Collection, Conversion, Dirty, Finders, MassAssignment, Persistence, Properties, Schema, Scoped, Timestamps, Validations Classes: AssociationCollection, BelongsToAssociation, Bound, ClusteringColumnBound, ConfigurationGenerator, DataSetBuilder, HasManyAssociation, LazyRecordCollection, List, Map, PartitionKeyBound, Railtie, RecordGenerator, RecordSet, Set, TimeuuidBound
Constant Summary collapse
- MissingAttributeError =
Raised when attempting to access an attribute of a record when that attribute hasn’t been loaded
Class.new(ArgumentError)
- UnknownAttributeError =
Raised when attempting to read or write an attribute that isn’t defined on the record
Class.new(ArgumentError)
- RecordNotFound =
Raised when attempting to load a record by key when that record does not exist
Class.new(StandardError)
- InvalidRecordConfiguration =
Raised when attempting to configure a record in a way that is not possible
Class.new(StandardError)
- RecordInvalid =
Raised when attempting to save a record that is invalid
Class.new(StandardError)
- IllegalQuery =
Raised when attempting to construct a RecordSet that cannot construct a valid CQL query
Class.new(StandardError)
- MissingKeyError =
Raised when attempting to persist a Cequel::Record without defining all primary key columns
Class.new(StandardError)
- MissingTableNameError =
Raised when attempting to reflect on the schema of a Cequel::Record without a table name.
Class.new(StandardError)
Class Attribute Summary collapse
-
.connection ⇒ Metal::Keyspace
The keyspace used for record persistence.
Class Method Summary collapse
-
.descendants ⇒ Array<Class>
All the record classes that are currently defined.
-
.establish_connection(configuration) ⇒ void
Establish a connection with the given configuration.
-
.included(base) ⇒ Object
Hook called when new record classes are created.
Class Attribute Details
.connection ⇒ Metal::Keyspace
Returns the keyspace used for record persistence.
109 110 111 |
# File 'lib/cequel/record.rb', line 109 def connection @connection end |
Class Method Details
.descendants ⇒ Array<Class>
Returns All the record classes that are currently defined.
124 125 126 127 128 129 130 131 132 |
# File 'lib/cequel/record.rb', line 124 def descendants weak_descendants.map do |clazz| begin clazz.__getobj__ if clazz.weakref_alive? rescue WeakRef::RefError nil end end.compact end |
.establish_connection(configuration) ⇒ void
This method returns an undefined value.
Establish a connection with the given configuration
118 119 120 |
# File 'lib/cequel/record.rb', line 118 def establish_connection(configuration) self.connection = Cequel.connect(configuration) end |
.included(base) ⇒ Object
Hook called when new record classes are created.
135 136 137 |
# File 'lib/cequel/record.rb', line 135 def included(base) weak_descendants << WeakRef.new(base) end |