Import Statements
Import Statements
Import statements bring concepts and definitions from other Trilogy files into the current scope.
Syntax
import_statement: "import" (".")* IDENTIFIER ("." IDENTIFIER)* ("as" IDENTIFIER)?
Basic Import
Import a module by name:
import customer;
Relative Imports
Use dots to import from relative paths:
import .local_module;
import ..parent_module;
Nested Module Import
Import from nested module paths:
import models.customer;
import data.warehouse.sales;
Aliased Import
Use as to give the import a local alias. All concepts from the imported module will be namespaced under this alias:
import customer as c;
import models.order as ord;
After aliasing, reference concepts like c.id or ord.total.
Example
import customer as customer;
import order as order;
import std.money;
select
customer.id,
customer.name,
sum(order.total) -> customer_total
;
