Delete

public struct Delete : Query

The SQL DELETE statement.

  • The table to delete rows from.

    Declaration

    Swift

    public let table: Table
  • The SQL WHERE clause containing the filter for rows to delete. Could be represented with a Filter clause or a String containing raw SQL.

    Declaration

    Swift

    public private(set) var whereClause: QueryFilterProtocol? { get }
  • A String with a clause to be appended to the end of the query.

    Declaration

    Swift

    public private(set) var suffix: QuerySuffixProtocol? { get }
  • An array of AuxiliaryTable which will be used in a query with a WITH clause.

    Declaration

    Swift

    public private(set) var with: [AuxiliaryTable]? { get }
  • Initialize an instance of Delete.

    Declaration

    Swift

    public init(from table: Table, where conditions: QueryFilterProtocol? = nil)

    Parameters

    from

    The table to delete rows from.

    conditions

    An optional where clause to apply.

  • Build the query using QueryBuilder.

    Throws

    QueryError.syntaxError if query build fails.

    Declaration

    Swift

    public func build(queryBuilder: QueryBuilder) throws -> String

    Parameters

    queryBuilder

    The QueryBuilder to use.

    Return Value

    A String representation of the query.

  • Add an SQL WHERE clause to the delete statement.

    Declaration

    Swift

    public func `where`(_ conditions: QueryFilterProtocol) -> Delete

    Parameters

    conditions

    The Filter clause or a String containing SQL WHERE clause to apply.

    Return Value

    A new instance of Delete.

  • Add a raw suffix to the delete statement.

    Declaration

    Swift

    public func suffix(_ raw: String) -> Delete

    Parameters

    raw

    A String with a clause to be appended to the end of the query.

    Return Value

    A new instance of Delete.