You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mention Xcode and OS X versions affected.
platforms: [.macOS(.v12)]
How do do you integrate SQLite.swift in your project?
Swift Package manager
General guidelines
Be as descriptive as possible.
Creating dynamic columns in tables needs a way to create defaultValues:
public struct TableSchema: Codable, Equatable {
public let schema: String
public let name: String
public let strict: Int
public let num_cols: Int
public let without_row_id: Int
public let columns: [String: ColumnSchema]
public func convertDataType(_ dataType: String) -> ColumnDefinition.Affinity {
switch dataType {
case "INTEGER":
return ColumnDefinition.Affinity.INTEGER
case "REAL":
return ColumnDefinition.Affinity.REAL
case "TEXT":
return ColumnDefinition.Affinity.TEXT
case "BLOB":
return ColumnDefinition.Affinity.BLOB
default:
return ColumnDefinition.Affinity.TEXT
}
}
public func createTable(in db: Connection) throws {
let table = Table(self.name)
try db.run(table.create(ifNotExists: true, block: { t in
for column in columns {
let col = column.value
let columnDefinition = ColumnDefinition(
name: col.name,
type: convertDataType(col.data_type),
nullable: col.nullable == 1,
defaultValue: LiteralValue.init(col.default_value ?? "NULL")
)
t.column(columnDefinition)
}
}))
}
}
Provide as much information needed to reliably reproduce the issue.
Attach screenshots if possible.
Better yet: attach GIFs or link to video.
Even better: link to a sample project exhibiting the issue.
public enum LiteralValue should have public init
init(_ string: String?) {
guard let string = string else {
self = .NULL
return
}
switch string {
case "NULL": self = .NULL
case "TRUE": self = .TRUE
case "FALSE": self = .FALSE
case "CURRENT_TIME": self = .CURRENT_TIME
case "CURRENT_TIMESTAMP": self = .CURRENT_TIMESTAMP
case "CURRENT_DATE": self = .CURRENT_DATE
default: self = LiteralValue.parse(string)
}
}
The text was updated successfully, but these errors were encountered:
Build Information
.package(url: "https://github.com/stephencelis/SQLite.swift", from: "0.14.1"),
platforms: [.macOS(.v12)]
Swift Package manager
General guidelines
Creating dynamic columns in tables needs a way to create defaultValues:
public enum LiteralValue
should havepublic init
The text was updated successfully, but these errors were encountered: