Skip to content

Instance Method

get(reload:on:)

Return the value of the relation, loading it first if necessary.
func get(reload: Bool = false, on database: any Database) -> EventLoopFuture<Self.RelatedValue>

Parameters

reload

If true, load the value from the database unconditionally, overwriting any previously loaded value.

database

The database to use if the value needs to be loaded.

Return Value

The loaded value.

Discussion

If the value is loaded (including reloading), the value is set in the property before being returned.

Note

This API is strongly preferred over load(on:), even when the caller does not need the returned value, in order to minimize unnecessary database traffic.