concept number in category grails

appears as: numbers, numbers, number, number
Grails in Action, Second Edition

This is an excerpt from Manning's book Grails in Action, Second Edition.

Table 1.1. Crunching numbers: the grails stats command in action
grails stats

    +----------------------+-------+-------+
    | Name                 | Files |  LOC  |
    +----------------------+-------+-------+
    | Controllers          |     1 |    20 |
    | Domain Classes       |     1 |    10 |
    | Services             |     1 |    21 |
    | Unit Tests           |     3 |    39 |
    +----------------------+-------+-------+
    | Totals               |     6 |    90 |
    +----------------------+-------+-------+

You’ve learned about Grails. And you’ve created plenty of code, too. But don’t take my word for it; let’s have Grails crunch the numbers with a grails stats command. Table 1.1 shows the grails stats command in action.

Table 1.1. Crunching numbers: the grails stats command in action
grails stats

    +----------------------+-------+-------+
    | Name                 | Files |  LOC  |
    +----------------------+-------+-------+
    | Controllers          |     1 |    20 |
    | Domain Classes       |     1 |    10 |
    | Services             |     1 |    21 |
    | Unit Tests           |     3 |    39 |
    +----------------------+-------+-------+
    | Totals               |     6 |    90 |
    +----------------------+-------+-------+

In this case, checking the number of posts is a good test for whether the sample data is already loaded in the database. You could feasibly do the check on any of the domain classes in the model because the sample data is either there or it’s not.

Table 5.2. Named arguments supported by list()

Option

Description

max Specifies the maximum number of rows to return
offset Specifies the number of elements into the ResultSet to start at when returning values (useful for pagination)
sort Specifies the field to sort on in the returned list
order Specifies the order of the sort: "asc" or "desc" (default is "asc")
ignoreCase Sets sorting to ignore case (true by default)
fetch Specifies eager/lazy fetch strategy as a Map of options