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.
ObjectSource
The program's own objects as a table: one row per object, one column per function that reads a value from an object. Each function's return type sets its column's type.
Example
source := ObjectSource->New("runs", runs)<Run>;
source->AddString("name", \(Run) ~ String : (r) => r->GetName());
source->AddFloat("score", \(Run) ~ Float : (r) => r->GetScore());
source->AddInt("epochs", \(Run) ~ Int : (r) => r->GetEpochs());
catalog := Catalog->New();
catalog->Load(source);Operations
AddBool #
Adds a Bool column
method : public : AddBool(name:String, reader:(T)~Bool) ~ ObjectSource<T>Parameters
| Name | Type | Description |
|---|---|---|
| name | String | column name |
| reader | (T)~Bool | reads the value from an object |
Return
| Type | Description |
|---|---|
| ObjectSource<T> | this source |
AddDate #
Adds a Date column; a Nil date is an empty cell
method : public : AddDate(name:String, reader:(T)~Date) ~ ObjectSource<T>Parameters
| Name | Type | Description |
|---|---|---|
| name | String | column name |
| reader | (T)~Date | reads the value from an object |
Return
| Type | Description |
|---|---|
| ObjectSource<T> | this source |
AddFloat #
Adds a Float column
method : public : AddFloat(name:String, reader:(T)~Float) ~ ObjectSource<T>Parameters
| Name | Type | Description |
|---|---|---|
| name | String | column name |
| reader | (T)~Float | reads the value from an object |
Return
| Type | Description |
|---|---|
| ObjectSource<T> | this source |
AddInt #
Adds an Int column
method : public : AddInt(name:String, reader:(T)~Int) ~ ObjectSource<T>Parameters
| Name | Type | Description |
|---|---|---|
| name | String | column name |
| reader | (T)~Int | reads the value from an object |
Return
| Type | Description |
|---|---|
| ObjectSource<T> | this source |
AddString #
Adds a String column; a Nil string is an empty cell
method : public : AddString(name:String, reader:(T)~String) ~ ObjectSource<T>Parameters
| Name | Type | Description |
|---|---|---|
| name | String | column name |
| reader | (T)~String | reads the value from an object |
Return
| Type | Description |
|---|---|
| ObjectSource<T> | this source |
GetError #
Gets the reason the last load failed
method : public : GetError() ~ StringReturn
| Type | Description |
|---|---|
| String | error, Nil if none |
GetTables #
Gets the table the objects provide
method : public : GetTables() ~ TableSpec[]Return
| Type | Description |
|---|---|
| TableSpec | one table shape |
Load #
Loads the objects 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 |