Model
-
findFromParameter(_:
Asynchronouson: builder: ) Returns a
Model
that will match the ID given in a named request parameter. For a route that has a parameter nameduserIDParam.paramString
,User.findFromParameter(userIDParam, req)
will get the value of the parameter and use that to fetch the user with that ID from the User table. Returns a failed future with an Abort error if: the parameter doesn’t exist, the parameter’s value can’t be made into an IDValue for the Model type, or no Model type with that ID was found in the database.Declaration
Swift
static func findFromParameter( _ param: PathComponent, on req: Request, builder: ((QueryBuilder<Self>) -> Void)? = nil ) async throws -> Self
Parameters
param
A PathComponent describing a path component of type .parameter
req
The incoming request
Container
, which provides theEventLoop
on which the query must be run.Return Value
[UUID]
containing all the user’s associated IDs.