Skip to content

Type Method

path(for:)

Returns an array of FieldKeys representing the individual textual components of the full path of the database field corresponding to the given Swift property. This method can only reference properties which represent actual fields in the database, corresponding to the AnyQueryableProperty protocol - for example, it can not be used with with the @Children property type, nor directly with an @Parent property.
static func path<Property>(for field: KeyPath<Self, Property>) -> [FieldKey] where Property : AnyQueryableProperty

Discussion

Almost all properties have only a single path component; support for multistep paths is primarily intended to support drilling down into JSON structures. At the time of this writing, the current version of FluentKit will always yield field paths with exactly one component. Unfortunately, the API can not be changed to eliminate the array wrapper without major source breakage.