<commit_before>/// Supports mutating SQL before execution using `customSQL(_:)` closures added to `QueryBuilder`.
public protocol CustomSQLSupporting: QuerySupporting { }

/// A custom SQL transformation.
public struct CustomSQL {
    /// Mutates a `SQL.DataQuery`
    public let closure: (inout DataQuery) -> ()
}

extension DatabaseQuery where Database: CustomSQLSupporting {
    /// Array of custom SQL transformations for this database query.
    public var customSQL: [CustomSQL] {
        get { return extend["custom-sql"] as? [CustomSQL] ?? [] }
        set { extend["custom-sql"] = newValue }
    }
}

extension QueryBuilder where Model.Database: CustomSQLSupporting {
    /// Adds a SQL-transforming closure to the `QueryBuilder` that will be
    /// called before the query is executed.
    ///
    /// One or more SQL-transforming closures may be added--they will be run sequentially.
    ///
    /// - parameters:
    ///     - closure: Accepts the `SQL.DataQuery` generated by this query builder.
    ///                Called before the query executes.
    ///                The `SQL.DataQuery` is mutable. Add or remove any custom options.
    ///
    /// - returns: QueryBuilder for chaining.
    public func customSQL(_ closure: @escaping (inout DataQuery) -> ()) -> Self {
        query.customSQL.append(.init(closure: closure))
        return self
    }
}<commit_msg>update customsql supporting<commit_after>/// Supports mutating SQL before execution using `customSQL(_:)` closures added to `QueryBuilder`.
public protocol CustomSQLSupporting: QuerySupporting { }

/// A custom SQL transformation.
public struct CustomSQL {
    /// Mutates a `SQLQuery`
    public let closure: (inout SQLQuery) -> ()
}

extension DatabaseQuery where Database: CustomSQLSupporting {
    /// Array of custom SQL transformations for this database query.
    public var customSQL: [CustomSQL] {
        get { return extend["custom-sql"] as? [CustomSQL] ?? [] }
        set { extend["custom-sql"] = newValue }
    }
}

extension QueryBuilder where Model.Database: CustomSQLSupporting {
    /// Adds a SQL-transforming closure to the `QueryBuilder` that will be
    /// called before the query is executed.
    ///
    /// One or more SQL-transforming closures may be added--they will be run sequentially.
    ///
    /// - parameters:
    ///     - closure: Accepts the `SQLQuery` generated by this query builder.
    ///                Called before the query executes.
    ///                The `SQLQuery` is mutable. Add or remove any custom options.
    ///
    /// - returns: QueryBuilder for chaining.
    public func customSQL(_ closure: @escaping (inout SQLQuery) -> ()) -> Self {
        query.customSQL.append(.init(closure: closure))
        return self
    }
}
{'fraction_non_alphanumeric': 0.1100685673042223, 'fraction_numerical': 0.0, 'mean_word_length': 2.5906735751295336, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4643253', 'n_tokens_mistral': 734, 'n_tokens_neox': 704, 'n_words': 264}