Instance Method
join(from:children:method:)
This will join a foreign table based on a
@Children relation@discardableResult func join<From, To>(from model: From.Type, children: KeyPath<From, ChildrenProperty<From, To>>, method: DatabaseQuery.Join.Method = .inner) -> Self where From : Model, To : Model
Parameters
modelThe
Modelto join fromchildrenThe
ChildrenPropertyto joinmethodThe method to use. The default is an inner join
Return Value
A new QueryBuilder
Discussion
This will not decode the joined data, but can be used in order to filter.
Star.query(on: db)
.join(from: Star.self, children: \.$planets)
.filter(Planet.self, \Planet.$name == "Earth")