Query Rows With Conditions (LCC.db.list)
Signature
rows, err = LCC.db.list(name, opts?, timeout?)
Parameters
- name
String. Table name. Must be non-empty and no longer than 256 bytes. - opts
Table, optional. Query options:conditions: key/value pairs combined with ANDorder_by: string, column to sort by ("id"by default)desc: boolean,truefor descending order, defaultfalselimit: integer, maximum rows to returnoffset: integer, number of rows to skip (default0)
- timeout
Number, optional. Request timeout in seconds, default60.
Returns
- rows
Table. Array of rows that match;nilon failure. - err
String ornil. Error description such asunknown columnorunknown table.
Notes
Runs a filtered query; all user columns are returned as strings while
idis returned as a number.
Withoutoptsit returns every record in ascendingidorder.
Example
local rows, err = LCC.db.list("tasks", {
conditions = { Status = "Idle" },
order_by = "id",
limit = 20
})
if rows then
print("Idle tasks:", #rows)
end