Skip to main content

Module hook

Module hook 

Source
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.

PHPRust
Hook (a marker interface)Hook (what Builder::add_hook takes)
Hook\FilterFilter
Hook\AttributeAttribute
Hook\Join\FilterJoinFilter
Hook\Join\ConditionJoinCondition
Hook\Join\PlacementPlacement
Hook\WriteWrite
Hook\Filter\TenantTenant
Hook\Attribute\MapMap

Structs§

Hook
A hook a builder accepts: one object may filter, resolve attributes and filter joins at once (as Tenant filters both tables and joins).
JoinCondition
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’s ON, elsewhere in the WHERE).

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 WHERE of every query on a table (tenancy, permissions).
JoinFilter
Scopes a joined table: a condition for the join, placed in its ON or in the WHERE, or nothing.
Write
Decorates rows before they are written and observes writes, for the database layer.