Skip to content

Commit

Permalink
💫 Enum array support
Browse files Browse the repository at this point in the history
  • Loading branch information
MihaelIsaev committed Oct 26, 2020
1 parent 4f46ffc commit 9b31d24
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Sources/Bridges/Helpers/Table+AllColumns.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,19 @@
//

import Foundation
import SwifQL

extension Table {
typealias Columns = [(name: String, value: SwifQLable, isChanged: Bool)]

func allColumns() -> Columns {
columns.compactMap {
let value: SwifQLable
if let v = $0.property.inputValue as? SwifQLPart {
if let v = ($0.property.inputValue as Any) as? [AnySwifQLEnum] {
let values = v.compactMap { $0.anyRawValue as? String }.joined(separator: ",")
let preparedPart = SwifQLPartSafeValue("{\(values)}")
value = SwifQLableParts(parts: [preparedPart])
} else if let v = $0.property.inputValue as? SwifQLPart {
value = SwifQLableParts(parts: [v])
} else if let v = $0.property.inputValue as? SwifQLable {
value = v
Expand Down

0 comments on commit 9b31d24

Please sign in to comment.