Skip to content

Instance Method

serialize(_:)

Serialize an arbitrary SQLExpression using the database’s dialect.
func serialize(_ expression: any SQLExpression) -> (sql: String, binds: [any Encodable & Sendable])

Discussion

The expression need not represent a complete query. Serialization transforms the expression into:

  1. A string containing raw SQL text rendered in the database’s dialect, and,

  2. A potentially empty array of values for any bound parameters referenced by the query.

See Also

Raw queries