Skip to content

Type Method

queryValue(_:)

Requests a description of the appropriate method of encoding a value of the property’s wrapped type into a database query. In essence, this is the static version of queryableValue(), except that this version will always have an input and thus can not return nil.
static func queryValue(_ value: Self.Value) -> DatabaseQuery.Value

Discussion

Warning

The existence of this method implies that any two identically-typed instances of a property must encode their values into queries in exactly the same fashion, and Fluent does have code paths which proceed on that assumption. For example, this requirement is the primary reason that a TimestampProperty’s format is represented as a generic type parameter rather than being provided to an initializer.

Default Implementations

QueryableProperty Implementations

  • queryValue(_:)
    Since Value conforms to Codable, the default encoding for any QueryableProperty’s value is as a query placeholder and associated parameter binding (bindings are sent to a database driver encoded via Encodable). See DatabaseQuery.Value for more details on possible alternative encodings.