Module: SfCli::Sf::Model::QueryMethods::ClassMethods
- Defined in:
- lib/sf_cli/sf/model/query_methods.rb
Instance Method Summary collapse
- #all ⇒ Object
- #count ⇒ Object
- #find(id) ⇒ Object
- #find_by(*find_condition) ⇒ Object
- #limit(num) ⇒ Object
- #max(field_name) ⇒ Object
- #min(field_name) ⇒ Object
- #order(*field_names) ⇒ Object
- #pluck(field_name) ⇒ Object
- #select(*fields) ⇒ Object
- #take ⇒ Object
- #to_csv ⇒ Object
- #where(*expr) ⇒ Object
Instance Method Details
#all ⇒ Object
46 47 48 49 |
# File 'lib/sf_cli/sf/model/query_methods.rb', line 46 def all qc = QueryCondition.new(connection, self.name, self.field_names) qc.all end |
#count ⇒ Object
66 67 68 69 |
# File 'lib/sf_cli/sf/model/query_methods.rb', line 66 def count qc = QueryCondition.new(connection, self.name, self.field_names) qc.count end |
#find(id) ⇒ Object
37 38 39 |
# File 'lib/sf_cli/sf/model/query_methods.rb', line 37 def find(id) connection.find(name.to_sym, id, Object.const_get(name.to_sym)) end |
#find_by(*find_condition) ⇒ Object
41 42 43 44 |
# File 'lib/sf_cli/sf/model/query_methods.rb', line 41 def find_by(*find_condition) qc = QueryCondition.new(connection, self.name, self.field_names) qc.where(*find_condition).take end |
#limit(num) ⇒ Object
25 26 27 28 29 |
# File 'lib/sf_cli/sf/model/query_methods.rb', line 25 def limit(num) qc = QueryCondition.new(connection, self.name, self.field_names) qc.limit(num) qc end |
#max(field_name) ⇒ Object
71 72 73 74 |
# File 'lib/sf_cli/sf/model/query_methods.rb', line 71 def max(field_name) qc = QueryCondition.new(connection, self.name, self.field_names) qc.max(field_name) end |
#min(field_name) ⇒ Object
76 77 78 79 |
# File 'lib/sf_cli/sf/model/query_methods.rb', line 76 def min(field_name) qc = QueryCondition.new(connection, self.name, self.field_names) qc.min(field_name) end |
#order(*field_names) ⇒ Object
31 32 33 34 35 |
# File 'lib/sf_cli/sf/model/query_methods.rb', line 31 def order(*field_names) qc = QueryCondition.new(connection, self.name, self.field_names) qc.order(*field_names) qc end |
#pluck(field_name) ⇒ Object
56 57 58 59 |
# File 'lib/sf_cli/sf/model/query_methods.rb', line 56 def pluck(field_name) qc = QueryCondition.new(connection, self.name, self.field_names) qc.pluck(field_name) end |
#select(*fields) ⇒ Object
19 20 21 22 23 |
# File 'lib/sf_cli/sf/model/query_methods.rb', line 19 def select(*fields) qc = QueryCondition.new(connection, self.name, self.field_names) qc.select(*fields) return qc end |
#take ⇒ Object
61 62 63 64 |
# File 'lib/sf_cli/sf/model/query_methods.rb', line 61 def take qc = QueryCondition.new(connection, self.name, self.field_names) qc.take end |
#to_csv ⇒ Object
51 52 53 54 |
# File 'lib/sf_cli/sf/model/query_methods.rb', line 51 def to_csv qc = QueryCondition.new(connection, self.name, self.field_names) qc.to_csv end |
#where(*expr) ⇒ Object
13 14 15 16 17 |
# File 'lib/sf_cli/sf/model/query_methods.rb', line 13 def where(*expr) qc = QueryCondition.new(connection, self.name, self.field_names) qc.where(*expr) return qc end |