Skip to content

Instance Method

appendInterpolation(literals:joinedBy:)

Embed an array of Strings as a list of literal values, placing the joiner between each pair of values.
mutating func appendInterpolation(literals: [String], joinedBy joiner: String)

Discussion

This is equivalent to adding an SQLList whose subexpressions are all SQLLiteral.string(_:)s and whose separator is the joiner wrapped by SQLRaw.

Example:

sqliteDatabase.serialize("""
    SELECT \(literals: "a", "b", "c", "d", joinedBy: "||") FROM \(ident: "nowhere")
    """ as SQLQueryString
).sql
// SELECT 'a'||'b'||'c'||'d' FROM "nowhere"