abstract class RethinkORM::Base
- RethinkORM::Base
- ActiveModel::Model
- Reference
- Object
Included Modules
- ActiveModel::Callbacks
- ActiveModel::Validation
- RethinkORM::Associations
- RethinkORM::Index
- RethinkORM::Persistence
- RethinkORM::Queries
- RethinkORM::Table
- RethinkORM::Validators
Direct Known Subclasses
Defined in:
rethinkdb-orm/base.crConstant Summary
-
AM_PARENT_TYPE =
{:type => RethinkORM::Base} of Nil => Nil
-
INDICES =
[] of NamedTuple(field: String, table: String)
-
TABLES =
["locks"] of String
Constructors
- .new(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
- .new(pull : JSON::PullParser)
- .new(rs : DB::ResultSet)
Class Method Summary
-
.all(**options)
Cursor of each model in the database
-
.attributes : Array(Symbol)
Returns all attribute keys.
-
.changes(id : String | Nil = nil, **options)
Changefeed at document (if id passed) or table level
-
.changes(**options, & : RethinkDB::Table -> HasChanges)
Creates a Changefeed on query
-
.clear
Removes all records from the table
-
.collection_query(**options, &)
Unsafe method until
.where
can accept more generic arguments Makes 2 LARGE assumptions - User correctly scopes the query under the right table - User forms a query that returns a collection of models -
.count
Returns a count of all documents in the table
-
.count(**attrs)
Returns a count of all documents in the table
-
.count(**attrs, &predicate : RethinkDB::DatumTerm -> RethinkDB::DatumTerm)
Returns a count of documents for which predicate block is true
-
.create(**attributes)
Creates the model.
-
.create!(**attributes)
Creates the model.
-
.exists?(id : String, **options)
Check for document presence in the table
-
.find(id : String, **options)
Find single document by id
-
.find!(id : String, **options)
Lookup document by id
-
.find_all(ids : Array | Tuple, **options)
Query by ids, optionally set a secondary index
-
.find_by(**attribute)
Returns documents with columns matching the given criteria
DEPRECATED Use
.where
instead. -
.find_by(**attribute, &predicate : RethinkDB::DatumTerm -> RethinkDB::DatumTerm)
Returns documents with columns matching the given criteria
DEPRECATED Use
.where
instead. - .from_rs(rs : DB::ResultSet)
-
.get_all(values : Array | Tuple, **options)
Query by ids, optionally set a secondary index
DEPRECATED Use
.find_all
instead. - .has_index?(field)
-
.raw_changes(id : String | Nil = nil, **options)
Establishes a changefeed of models in a RethinkDB table Changefeed at document (id passed) or table level
-
.raw_changes(**options, & : RethinkDB::Table -> HasChanges)
Creates a Changefeed::Raw on query
-
.raw_query(**options, &)
Unsafe method until
.where
can accept more generic arguments Makes 2 LARGE assumptions - User correctly scopes the query under the right table - User forms a query that returns a collection of models -
.table_query(**options, &)
Yield a RethinkDB handle namespaced under the document table
-
.where(&predicate : RethinkDB::DatumTerm -> RethinkDB::DatumTerm)
Returns documents for which predicate block is true
- .where(**attrs, &predicate : RethinkDB::DatumTerm -> RethinkDB::DatumTerm)
-
.where(attrs : Hash, **options)
Returns documents containing fields that match the attributes
-
.where(**attrs)
Returns documents containing fields that match the attributes
Instance Method Summary
-
#==(other : self)
Returns
true
if this reference is the same as other. -
#apply_defaults
Generate code to apply default values
-
#assign_attributes(id : String | Nil | Missing = Missing)
Assign to multiple attributes.
-
#assign_attributes(params : HTTP::Params | Hash(String, String) | Tuple(String, String))
Assign to mulitple attributes via
HTTP::Params
. -
#assign_attributes(model : RethinkORM::Base)
Assign to multiple attributes from a model object
-
#attributes
Returns a
Hash
of all attribute values -
#attributes_tuple
Returns a
NamedTuple
of all attribute values. -
#id : String | Nil
Default primary key
-
#id=(id : String | Nil)
Default primary key
- #id_assigned? : Bool
-
#id_change : Tuple(String | Nil | Nil, String | Nil | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #id_changed? : Bool
-
#id_default : String | Nil
#id
's default value -
#id_present? : Bool
Default primary key
- #id_was : String | Nil | Nil
-
#id_will_change! : Nil
Include
#id
in the set of changed attributes, whether it has changed or not. -
#persistent_attributes
Returns a
Hash
of all attributes that can be persisted. -
#uuid_generator=(generator : Class)
Allow user defined uuid generator
Instance methods inherited from module RethinkORM::Persistence
_new_flag
_new_flag,
_new_flag=(_new_flag)
_new_flag=,
delete
delete,
destroy
destroy,
destroyed=(destroyed : Bool)
destroyed=,
destroyed? : Bool
destroyed?,
new_record?
new_record?,
persisted?
persisted?,
reload!
reload!,
save(**options)
save,
save!(**options)
save!,
update(**attributes)
update,
update!(**attributes)
update!,
update_fields(**attributes)
update_fields
Instance methods inherited from module RethinkORM::Associations
reset_associations
reset_associations
Constructor Detail
Class Method Detail
Changefeed at document (if id passed) or table level
Yields an infinite iterator of model events
Unsafe method until .where
can accept more generic arguments
Makes 2 LARGE assumptions
- User correctly scopes the query under the right table
- User forms a query that returns a collection of models
Should raise/not compile on malformed query/incorrect return type to create a collection
Returns a count of documents for which predicate block is true
Returns documents with columns matching the given criteria
DEPRECATED Use .where
instead.
Returns documents with columns matching the given criteria
DEPRECATED Use .where
instead.
Query by ids, optionally set a secondary index
DEPRECATED Use .find_all
instead.
Establishes a changefeed of models in a RethinkDB table Changefeed at document (id passed) or table level
Creates a Changefeed::Raw on query
Unsafe method until .where
can accept more generic arguments
Makes 2 LARGE assumptions
- User correctly scopes the query under the right table
- User forms a query that returns a collection of models
Should raise/not compile on malformed query/incorrect return type to create a collection
Returns documents for which predicate block is true
Returns documents containing fields that match the attributes
Instance Method Detail
Returns true
if this reference is the same as other. Invokes same?
.
Assign to mulitple attributes via HTTP::Params
.
Returns a Tuple of the previous and the current value of an instance variable if it has changed