-
Notifications
You must be signed in to change notification settings - Fork 14
Relationship
Josh Wright edited this page Jan 14, 2021
·
3 revisions
A protocol representing a relationship between two Model
s.
Contains only those two types and functionality for eager
loading this relationship.
public protocol Relationship
Given an array of From
s, this function loads objects from
the relationship eagerLoadKeyPath
and sets them on each
From
.
func loadRelationships(for from: [From], query nestedQuery: @escaping (ModelQuery<To.Value>) -> ModelQuery<To.Value>, into eagerLoadKeyPath: KeyPath<From, Self>) -> EventLoopFuture<[From]>
- from: The array of
From
to eager load a relationship on. - nestedQuery: A closure for generating the query to find the related
To
objects. - eagerLoadKeyPath: The
KeyPath
of the relationship. Once loaded, theTo
objects will be set here.
A future containing the From
models, with the relationships at the eagerLoadKeyPath
populated & ready for access.
Generated at 2021-01-13T22:24:59-0800 using swift-doc 1.0.0-beta.5.
Alchemy
Types
- AlterTableBuilder
- BCryptDigest
- BasicAuthMiddleware
- BcryptError
- BelongsToRelationship
- CORSMiddleware
- CORSMiddleware.AllowOriginSetting
- CORSMiddleware.Configuration
- ColumnType
- CreateColumn
- CreateColumnBuilder
- CreateIndex
- CreateTableBuilder
- DatabaseConfig
- DatabaseError
- DatabaseField
- DatabaseKeyMappingStrategy
- DatabaseValue
- DayUnit
- Env
- FrequencyTyped
- Grammar
- HTTPAuth
- HTTPAuth.Basic
- HTTPAuth.Bearer
- HTTPBody
- HTTPError
- HasManyRelationship
- HasOneRelationship
- HasRelationship
- HourUnit
- JoinClause
- JoinType
- Launch
- Log
- MIMEType
- MinuteUnit
- ModelQuery
- MySQLDatabase
- Operator
- OrderClause
- OrderClause.Sort
- OrderedDictionary
- PapyrusClientError
- PathParameter
- PathParameter.DecodingError
- PostgresDatabase
- Query
- Request
- Response
- Router
- RuneError
- SQL
- SQLJSON
- Scheduler
- Schema
- SecondUnit
- Services
- Socket
- StaticFileMiddleware
- StringLength
- Thread
- TokenAuthMiddleware
- WeekUnit
- Weekday
- WhereBoolean
- WhereColumn
- WhereIn
- WhereIn.InType
- WhereNested
- WhereRaw
- WhereValue