Module: RPCMapper::QueryMethods
- Defined in:
- lib/rpc_mapper/relation/query_methods.rb
Instance Attribute Summary collapse
-
#fresh_value ⇒ Object
TRP: Define each of the variables the query options will be stored in.
-
#from_value ⇒ Object
TRP: Define each of the variables the query options will be stored in.
-
#group_values ⇒ Object
TRP: Define each of the variables the query options will be stored in.
-
#having_values ⇒ Object
TRP: Define each of the variables the query options will be stored in.
-
#includes_values ⇒ Object
TRP: Define each of the variables the query options will be stored in.
-
#joins_values ⇒ Object
TRP: Define each of the variables the query options will be stored in.
-
#limit_value ⇒ Object
TRP: Define each of the variables the query options will be stored in.
-
#offset_value ⇒ Object
TRP: Define each of the variables the query options will be stored in.
-
#order_values ⇒ Object
TRP: Define each of the variables the query options will be stored in.
-
#raw_sql_value ⇒ Object
TRP: Define each of the variables the query options will be stored in.
-
#select_values ⇒ Object
TRP: Define each of the variables the query options will be stored in.
-
#where_values ⇒ Object
TRP: Define each of the variables the query options will be stored in.
Instance Method Summary collapse
- #fresh(val = true) ⇒ Object
- #from(table) ⇒ Object
- #group(*args) ⇒ Object
- #having(*args) ⇒ Object
- #includes(*args) ⇒ Object
- #joins(*args) ⇒ Object
- #limit(value = true) ⇒ Object
- #offset(value = true) ⇒ Object
- #order(*args) ⇒ Object
- #select(*args) ⇒ Object
- #sql(raw_sql) ⇒ Object
- #where(*args) ⇒ Object
Instance Attribute Details
#fresh_value ⇒ Object
TRP: Define each of the variables the query options will be stored in.
3 4 5 |
# File 'lib/rpc_mapper/relation/query_methods.rb', line 3 def fresh_value @fresh_value end |
#from_value ⇒ Object
TRP: Define each of the variables the query options will be stored in.
3 4 5 |
# File 'lib/rpc_mapper/relation/query_methods.rb', line 3 def from_value @from_value end |
#group_values ⇒ Object
TRP: Define each of the variables the query options will be stored in.
3 4 5 |
# File 'lib/rpc_mapper/relation/query_methods.rb', line 3 def group_values @group_values end |
#having_values ⇒ Object
TRP: Define each of the variables the query options will be stored in.
3 4 5 |
# File 'lib/rpc_mapper/relation/query_methods.rb', line 3 def having_values @having_values end |
#includes_values ⇒ Object
TRP: Define each of the variables the query options will be stored in.
3 4 5 |
# File 'lib/rpc_mapper/relation/query_methods.rb', line 3 def includes_values @includes_values end |
#joins_values ⇒ Object
TRP: Define each of the variables the query options will be stored in.
3 4 5 |
# File 'lib/rpc_mapper/relation/query_methods.rb', line 3 def joins_values @joins_values end |
#limit_value ⇒ Object
TRP: Define each of the variables the query options will be stored in.
3 4 5 |
# File 'lib/rpc_mapper/relation/query_methods.rb', line 3 def limit_value @limit_value end |
#offset_value ⇒ Object
TRP: Define each of the variables the query options will be stored in.
3 4 5 |
# File 'lib/rpc_mapper/relation/query_methods.rb', line 3 def offset_value @offset_value end |
#order_values ⇒ Object
TRP: Define each of the variables the query options will be stored in.
3 4 5 |
# File 'lib/rpc_mapper/relation/query_methods.rb', line 3 def order_values @order_values end |
#raw_sql_value ⇒ Object
TRP: Define each of the variables the query options will be stored in.
3 4 5 |
# File 'lib/rpc_mapper/relation/query_methods.rb', line 3 def raw_sql_value @raw_sql_value end |
#select_values ⇒ Object
TRP: Define each of the variables the query options will be stored in.
3 4 5 |
# File 'lib/rpc_mapper/relation/query_methods.rb', line 3 def select_values @select_values end |
#where_values ⇒ Object
TRP: Define each of the variables the query options will be stored in.
3 4 5 |
# File 'lib/rpc_mapper/relation/query_methods.rb', line 3 def where_values @where_values end |
Instance Method Details
#fresh(val = true) ⇒ Object
52 53 54 55 56 57 |
# File 'lib/rpc_mapper/relation/query_methods.rb', line 52 def fresh(val=true) clone.tap do |r| r.fresh_value = val r.reset_queries if r.fresh_value end end |
#from(table) ⇒ Object
48 49 50 |
# File 'lib/rpc_mapper/relation/query_methods.rb', line 48 def from(table) clone.tap { |r| r.from_value = table } end |
#group(*args) ⇒ Object
15 16 17 |
# File 'lib/rpc_mapper/relation/query_methods.rb', line 15 def group(*args) clone.tap { |r| r.group_values += args if args_valid? args } end |
#having(*args) ⇒ Object
36 37 38 |
# File 'lib/rpc_mapper/relation/query_methods.rb', line 36 def having(*args) clone.tap { |r| r.having_values += args if args_valid? args } end |
#includes(*args) ⇒ Object
27 28 29 30 |
# File 'lib/rpc_mapper/relation/query_methods.rb', line 27 def includes(*args) args.reject! { |a| a.nil? } clone.tap { |r| r.includes_values += (r.includes_values + args).flatten.uniq if args_valid? args } end |
#joins(*args) ⇒ Object
23 24 25 |
# File 'lib/rpc_mapper/relation/query_methods.rb', line 23 def joins(*args) clone.tap { |r| r.joins_values += args if args_valid?(args) } end |
#limit(value = true) ⇒ Object
40 41 42 |
# File 'lib/rpc_mapper/relation/query_methods.rb', line 40 def limit(value = true) clone.tap { |r| r.limit_value = value } end |
#offset(value = true) ⇒ Object
44 45 46 |
# File 'lib/rpc_mapper/relation/query_methods.rb', line 44 def offset(value = true) clone.tap { |r| r.offset_value = value } end |
#order(*args) ⇒ Object
19 20 21 |
# File 'lib/rpc_mapper/relation/query_methods.rb', line 19 def order(*args) clone.tap { |r| r.order_values += args if args_valid? args } end |
#select(*args) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/rpc_mapper/relation/query_methods.rb', line 7 def select(*args) if block_given? to_a.select {|*block_args| yield(*block_args) } else clone.tap { |r| r.select_values += args if args_valid? args } end end |
#sql(raw_sql) ⇒ Object
59 60 61 |
# File 'lib/rpc_mapper/relation/query_methods.rb', line 59 def sql(raw_sql) clone.tap { |r| r.raw_sql_value = raw_sql } end |
#where(*args) ⇒ Object
32 33 34 |
# File 'lib/rpc_mapper/relation/query_methods.rb', line 32 def where(*args) clone.tap { |r| r.where_values += args.compact.select { |i| args_valid? i } if args_valid? args } end |