Class: Cequel::Record::Bound Abstract Private
- Inherits:
-
Object
- Object
- Cequel::Record::Bound
- Defined in:
- lib/cequel/record/bound.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Subclasses must implement the ‘to_cql` method, and may override the `operator` and `bind_value` methods.
An upper or lower bound for a range query.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#column ⇒ Schema::Column
readonly
private
Column bound applies to.
-
#value ⇒ Object
readonly
private
Value for bound.
Class Method Summary collapse
-
.create(column, gt, inclusive, value) ⇒ Bound
private
Create a bound object for the given column.
Instance Method Summary collapse
-
#exclusive? ⇒ Boolean
private
‘true` if this is an exclusive bound.
-
#gt? ⇒ Boolean
private
‘true` if this is a lower bound.
-
#inclusive? ⇒ Boolean
private
‘true` if this is an inclusive bound.
-
#initialize(column, gt, inclusive, value) ⇒ Bound
constructor
private
A new instance of Bound.
-
#lt? ⇒ Boolean
private
‘true` if this is an upper bound.
-
#to_cql_with_bind_variables ⇒ Array
private
Pair containing CQL string and bind value.
Constructor Details
#initialize(column, gt, inclusive, value) ⇒ Bound
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Bound.
46 47 48 |
# File 'lib/cequel/record/bound.rb', line 46 def initialize(column, gt, inclusive, value) @column, @gt, @inclusive, @value = column, gt, inclusive, value end |
Instance Attribute Details
#column ⇒ Schema::Column (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns column bound applies to.
15 16 17 |
# File 'lib/cequel/record/bound.rb', line 15 def column @column end |
#value ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns value for bound.
17 18 19 |
# File 'lib/cequel/record/bound.rb', line 17 def value @value end |
Class Method Details
.create(column, gt, inclusive, value) ⇒ Bound
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create a bound object for the given column. This method returns an instance of the appropriate ‘Bound` subclass given the type of the column and the class of the value.
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/cequel/record/bound.rb', line 27 def self.create(column, gt, inclusive, value) implementation = if column.partition_key? PartitionKeyBound elsif column.type?(:timeuuid) && !Cequel.uuid?(value) TimeuuidBound else ClusteringColumnBound end implementation.new(column, gt, inclusive, value) end |
Instance Method Details
#exclusive? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns ‘true` if this is an exclusive bound.
81 82 83 |
# File 'lib/cequel/record/bound.rb', line 81 def exclusive? !inclusive? end |
#gt? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns ‘true` if this is a lower bound.
60 61 62 |
# File 'lib/cequel/record/bound.rb', line 60 def gt? !!@gt end |
#inclusive? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns ‘true` if this is an inclusive bound.
74 75 76 |
# File 'lib/cequel/record/bound.rb', line 74 def inclusive? !!@inclusive end |
#lt? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns ‘true` if this is an upper bound.
67 68 69 |
# File 'lib/cequel/record/bound.rb', line 67 def lt? !gt? end |
#to_cql_with_bind_variables ⇒ Array
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns pair containing CQL string and bind value.
53 54 55 |
# File 'lib/cequel/record/bound.rb', line 53 def to_cql_with_bind_variables [to_cql, bind_value] end |