Class: Aerospike::Statement
- Inherits:
-
Object
- Object
- Aerospike::Statement
- Defined in:
- lib/aerospike/query/statement.rb
Instance Attribute Summary collapse
-
#bin_names ⇒ Object
Returns the value of attribute bin_names.
-
#filters ⇒ Object
Returns the value of attribute filters.
-
#function_args ⇒ Object
Returns the value of attribute function_args.
-
#function_name ⇒ Object
Returns the value of attribute function_name.
-
#index_name ⇒ Object
Returns the value of attribute index_name.
-
#namespace ⇒ Object
Returns the value of attribute namespace.
-
#package_name ⇒ Object
Returns the value of attribute package_name.
-
#predexp ⇒ Object
Returns the value of attribute predexp.
-
#return_data ⇒ Object
Returns the value of attribute return_data.
-
#set_name ⇒ Object
Returns the value of attribute set_name.
-
#task_id ⇒ Object
Returns the value of attribute task_id.
Instance Method Summary collapse
-
#initialize(namespace, set_name, bin_names = []) ⇒ Statement
constructor
A new instance of Statement.
- #is_scan? ⇒ Boolean
- #set_aggregate_function(package_name, function_name, function_args = [], return_data = true) ⇒ Object
- #set_task_id ⇒ Object
Constructor Details
#initialize(namespace, set_name, bin_names = []) ⇒ Statement
Returns a new instance of Statement.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/aerospike/query/statement.rb', line 25 def initialize(namespace, set_name, bin_names=[]) # Namespace determines query Namespace @namespace = namespace # SetName determines query Set name (Optional) @set_name = set_name # IndexName determines query index name (Optional) # If not set, the server will determine the index from the filter's bin name. @index_name = nil # BinNames detemines bin names (optional) @bin_names = bin_names # Filters determine query filters (Optional) # Currently, only one filter is allowed by the server on a secondary index lookup. # If multiple filters are necessary, see QueryFilter example for a workaround. # QueryFilter demonstrates how to add additional filters in an user-defined # aggregation function. @filters = [] # Predicate expressions @predexp = nil @package_name = nil @function_name = nil @function_args = nil # TaskId determines query task id. (Optional) @task_id = rand(RAND_MAX) # determines if the query should return data @return_data = true end |
Instance Attribute Details
#bin_names ⇒ Object
Returns the value of attribute bin_names.
21 22 23 |
# File 'lib/aerospike/query/statement.rb', line 21 def bin_names @bin_names end |
#filters ⇒ Object
Returns the value of attribute filters.
22 23 24 |
# File 'lib/aerospike/query/statement.rb', line 22 def filters @filters end |
#function_args ⇒ Object
Returns the value of attribute function_args.
22 23 24 |
# File 'lib/aerospike/query/statement.rb', line 22 def function_args @function_args end |
#function_name ⇒ Object
Returns the value of attribute function_name.
22 23 24 |
# File 'lib/aerospike/query/statement.rb', line 22 def function_name @function_name end |
#index_name ⇒ Object
Returns the value of attribute index_name.
21 22 23 |
# File 'lib/aerospike/query/statement.rb', line 21 def index_name @index_name end |
#namespace ⇒ Object
Returns the value of attribute namespace.
21 22 23 |
# File 'lib/aerospike/query/statement.rb', line 21 def namespace @namespace end |
#package_name ⇒ Object
Returns the value of attribute package_name.
22 23 24 |
# File 'lib/aerospike/query/statement.rb', line 22 def package_name @package_name end |
#predexp ⇒ Object
Returns the value of attribute predexp.
23 24 25 |
# File 'lib/aerospike/query/statement.rb', line 23 def predexp @predexp end |
#return_data ⇒ Object
Returns the value of attribute return_data.
23 24 25 |
# File 'lib/aerospike/query/statement.rb', line 23 def return_data @return_data end |
#set_name ⇒ Object
Returns the value of attribute set_name.
21 22 23 |
# File 'lib/aerospike/query/statement.rb', line 21 def set_name @set_name end |
#task_id ⇒ Object
Returns the value of attribute task_id.
21 22 23 |
# File 'lib/aerospike/query/statement.rb', line 21 def task_id @task_id end |
Instance Method Details
#is_scan? ⇒ Boolean
67 68 69 |
# File 'lib/aerospike/query/statement.rb', line 67 def is_scan? return (filters.nil? || (filters.empty?)) end |
#set_aggregate_function(package_name, function_name, function_args = [], return_data = true) ⇒ Object
60 61 62 63 64 65 |
# File 'lib/aerospike/query/statement.rb', line 60 def set_aggregate_function(package_name, function_name, function_args=[], return_data=true) @package_name = package_name @function_name = function_name @function_args = function_args @return_data = return_data end |
#set_task_id ⇒ Object
71 72 73 74 75 |
# File 'lib/aerospike/query/statement.rb', line 71 def set_task_id while @task_id == 0 @task_id = rand(RAND_MAX) end end |