-
-
Notifications
You must be signed in to change notification settings - Fork 17
findAll
Jorge Reyes edited this page May 29, 2015
·
3 revisions
Find all the entities for the specified query, named or positional arguments or by an example entity
###Returns
- This function returns array
###Arguments
Key | Type | Required | Default | Description |
---|---|---|---|---|
query | string | No | --- | |
params | any | No | [runtime expression] | |
offset | numeric | No | 0 | |
max | numeric | No | 0 | |
timeout | numeric | No | 0 | |
ignoreCase | boolean | No | false | |
example | any | No | --- |
###Examples
// find all blog posts
ormService.findAll("Post");
// with a positional parameters
ormService.findAll("from Post as p where p.author=?",['Luis Majano']);
// 10 posts from Luis Majano staring from 5th post ordered by release date
ormService.findAll("from Post as p where p.author=? order by p.releaseDate",['Luis majano'],offset=5,max=10);
// Using paging params
var query = "from Post as p where p.author='Luis Majano' order by p.releaseDate"
// first 20 posts
ormService.findAll(query=query,max=20)
// 20 posts starting from my 15th entry
ormService.findAll(query=query,max=20,offset=15);
// examples with named parameters
ormService.findAll("from Post as p where p.author=:author", {author='Luis Majano'})
ormService.findAll("from Post as p where p.author=:author", {author='Luis Majano'}, max=20, offset=5);
// query by example
user = ormService.new(entityName="User",firstName="Luis");
ormService.findAll( example=user );