In-memory query engine over typed columns. Tables are filled row by row or loaded from sources (CSV files, folders, the program's own objects) and queried with SQL-like statements; aggregates, Describe() and Finder (file search) are included. Compile with -lib query.
FilesystemSource
A folder as a table named 'files', optionally with everything below it. Columns: id, parent_id (empty at the top), depth (0 at the top), name, path, ext, is_dir, size, modified, created, owner, is_readonly and is_hidden. A name starting with '.' counts as hidden. With a scan hint, the costly columns (size, modified, created, owner, is_readonly) are only read when asked for.
Example
catalog := Catalog->New();
catalog->Load(FilesystemSource->New("results", true));
files := catalog->Get("files");Operations
ColumnNames # function
Gets the column names
function : ColumnNames() ~ String[]Return
| Type | Description |
|---|---|
| String | column names |
GetError #
Gets the reason the last listing failed
method : public : GetError() ~ StringReturn
| Type | Description |
|---|---|
| String | error, Nil if none |
GetTables #
Gets the table the folder provides
method : public : GetTables() ~ TableSpec[]Return
| Type | Description |
|---|---|
| TableSpec | one table shape |
List #
Lists the folder as a table, with every column
method : public : List() ~ TableReturn
| Type | Description |
|---|---|
| Table | table, Nil if the folder cannot be read (see GetError) |
List #
Lists the folder as a table, reading only the given columns' costly values
method : public : List(columns:String[]) ~ TableParameters
| Name | Type | Description |
|---|---|---|
| columns | String | columns needed |
Return
| Type | Description |
|---|---|
| Table | table, Nil if the folder cannot be read (see GetError) |
List #
Lists the folder as a table, reading only the given columns' costly values
method : public : List(columns:String[], limit:Int) ~ TableParameters
| Name | Type | Description |
|---|---|---|
| columns | String | columns needed, Nil for all |
| limit | Int | the most rows to list, -1 for all |
Return
| Type | Description |
|---|---|
| Table | table, Nil if the folder cannot be read (see GetError) |
Load #
Loads the listing into a catalog
method : public : Load(catalog:Catalog, hint:ScanHint) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| catalog | Catalog | catalog |
| hint | ScanHint | columns and rows needed, Nil for everything |
Return
| Type | Description |
|---|---|
| Bool | true if loaded |
New # constructor
Constructor
New(root:String, recursive:Bool)Parameters
| Name | Type | Description |
|---|---|---|
| root | String | folder |
| recursive | Bool | true to include everything below the folder |
New # constructor
Constructor
New(root:String, recursive:Bool, max_depth:Int, include_hidden:Bool)Parameters
| Name | Type | Description |
|---|---|---|
| root | String | folder |
| recursive | Bool | true to include everything below the folder |
| max_depth | Int | deepest level to include, 0 for the folder's own entries, -1 for no limit |
| include_hidden | Bool | false to leave out, and not descend into, entries whose names start with '.' |