Expand description
Hooks: code a builder runs while compiling, to scope every query
(Filter, JoinFilter) or map attribute names to columns
(Attribute). Tenant and Map are the hooks the library ships.
PHP: Utopia\Query\Hook, Hook\Filter, Hook\Attribute, Hook\Join\Filter, Hook\Write.
| PHP | Rust |
|---|---|
Hook (a marker interface) | Hook (what Builder::add_hook takes) |
Hook\Filter | Filter |
Hook\Attribute | Attribute |
Hook\Join\Filter | JoinFilter |
Hook\Join\Condition | JoinCondition |
Hook\Join\Placement | Placement |
Hook\Write | Write |
Hook\Filter\Tenant | Tenant |
Hook\Attribute\Map | Map |
Structs§
- Hook
- A hook a builder accepts: one object may filter, resolve attributes and
filter joins at once (as
Tenantfilters both tables and joins). - Join
Condition - A join filter’s condition and where it goes.
- Map
- Maps attribute names to columns through a table; other names stay as they are.
- Tenant
- Scopes every query, and every joined table, to tenants:
column IN (?, ...)(in a left or right join’sON, elsewhere in theWHERE).
Enums§
- Placement
- Where a join filter’s condition goes.
Traits§
- Attribute
- Maps an attribute name to the column it is stored in.
- Filter
- Adds a condition to the
WHEREof every query on a table (tenancy, permissions). - Join
Filter - Scopes a joined table: a condition for the join, placed in its
ONor in theWHERE, or nothing. - Write
- Decorates rows before they are written and observes writes, for the database layer.