| 1 | I've been thinking about query feature that allows to build HopObject collection on the fly. Under the hood, the query object would be a HopObject with a custom DbMapping. The SQL query would probably be built using a subnodeRelation built from properties of the query object's filter property. These filter conditions could cover a number of common comparison operators: |
| 2 | |
| 3 | * columnname - add equal to clause for the column |
| 4 | * columnname_not_equal - add not equal to clause for the column |
| 5 | * columnname_less_than - add less than clause for the column |
| 6 | * columnname_greater_than - add greater than clause for the column |
| 7 | * columnname_less_or_equal - add a less than or equal to clause for the column |
| 8 | * columnname_greater_or_equal - add a greater than or equal for the column |
| 9 | * columnname_like - add like clause for the column |
| 10 | * columnname_not_like - add not like clause for the column |
| 11 | * columnname_is_null - add is null clause for the column |
| 12 | * columnname_not_null - add is not null clause for the column |
| 13 | |
| 14 | Query objects could be created by a constructor or factory function passing the arguments as object literals. |
| 15 | |
| 16 | var q = new HopQuery({ |
| 17 | type: Page |
| 18 | filter: { |
| 19 | createtime_greater_than: t1, |
| 20 | createtime_less_or_equal: t2, |
| 21 | type_like: "update:%" |
| 22 | } |
| 23 | order: "createtime desc" |
| 24 | }); |