Updated package file and removed dep
This commit is contained in:
parent
653f4bdfa6
commit
fe48e5f421
|
@ -72,3 +72,4 @@ buildlinux
|
||||||
/.build_lin
|
/.build_lin
|
||||||
Package.pins
|
Package.pins
|
||||||
Package.resolved
|
Package.resolved
|
||||||
|
.DS_Store
|
||||||
|
|
|
@ -1,12 +1,20 @@
|
||||||
|
// swift-tools-version:4.2
|
||||||
// Generated automatically by Perfect Assistant Application
|
// Generated automatically by Perfect Assistant Application
|
||||||
// Date: 2018-03-02 16:12:45 +0000
|
// Date: 2018-03-02 16:12:45 +0000
|
||||||
import PackageDescription
|
import PackageDescription
|
||||||
let package = Package(
|
let package = Package(
|
||||||
name: "StORM",
|
name: "StORM",
|
||||||
targets: [],
|
products: [
|
||||||
|
.library(name: "StORM", targets: ["StORM"])
|
||||||
|
],
|
||||||
dependencies: [
|
dependencies: [
|
||||||
.Package(url: "https://github.com/PerfectlySoft/PerfectLib.git", majorVersion: 3),
|
.package(url: "https://github.com/PerfectlySoft/PerfectLib.git", from: "3.0.0"),
|
||||||
.Package(url: "https://github.com/iamjono/SwiftMoment.git", majorVersion: 1),
|
.package(url: "https://github.com/iamjono/SwiftMoment.git", from: "1.0.0")
|
||||||
.Package(url: "https://github.com/iamjono/SwiftString.git", majorVersion: 2),
|
],
|
||||||
|
targets: [
|
||||||
|
.target(name: "StORM", dependencies: [
|
||||||
|
"SwiftMoment",
|
||||||
|
"PerfectLib"
|
||||||
|
])
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import SwiftMoment
|
import SwiftMoment
|
||||||
import SwiftString
|
|
||||||
|
|
||||||
extension StORM {
|
extension StORM {
|
||||||
|
|
||||||
|
@ -67,25 +66,18 @@ extension StORM {
|
||||||
return data[name] as? [UInt8] ?? def
|
return data[name] as? [UInt8] ?? def
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// =======================================================================================
|
// =======================================================================================
|
||||||
// Array Of Strings
|
// Array Of Strings
|
||||||
// =======================================================================================
|
// =======================================================================================
|
||||||
public static func arrayOfStrings(_ data: [String: Any], _ name: String, _ def: [String]? = [String]()) -> [String]? {
|
public static func arrayOfStrings(_ data: [String: Any], _ name: String, _ def: [String]? = [String]()) -> [String]? {
|
||||||
return (data[name] as? String ?? "").split(",").map{ $0.trimmed() } // note default ignored right now
|
return (data[name] as? String ?? "").split(separator: ",").map{ $0.trimmingCharacters(in: .whitespacesAndNewlines) } // note default ignored right now
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================================
|
// =======================================================================================
|
||||||
// Array Of Integers
|
// Array Of Integers
|
||||||
// =======================================================================================
|
// =======================================================================================
|
||||||
public static func arrayOfIntegers(_ data: [String: Any], _ name: String, _ def: [Int]? = [Int]()) -> [Int]? {
|
public static func arrayOfIntegers(_ data: [String: Any], _ name: String, _ def: [Int]? = [Int]()) -> [Int]? {
|
||||||
return (data[name] as? String ?? "").split(",").map{ Int($0.trimmed()) ?? 0 } // note default ignored right now
|
return (data[name] as? String ?? "").split(separator: ",").map{ Int($0.trimmingCharacters(in: .whitespacesAndNewlines)) ?? 0 } // note default ignored right now
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================================
|
// =======================================================================================
|
||||||
|
|
|
@ -105,20 +105,20 @@ open class StORM {
|
||||||
let (_, val) = firstAsKey()
|
let (_, val) = firstAsKey()
|
||||||
|
|
||||||
// Grab the type of value:
|
// Grab the type of value:
|
||||||
let type = type(of: val)
|
let theType = type(of: val)
|
||||||
// Check if we are nil, we would then of course have an empty primary key.
|
// Check if we are nil, we would then of course have an empty primary key.
|
||||||
guard String(describing: val) != "nil" else {
|
guard String(describing: val) != "nil" else {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// For now we will be expecting String & Integer key types:
|
// For now we will be expecting String & Integer key types:
|
||||||
switch type {
|
switch theType {
|
||||||
case is Int.Type, is Int?.Type:
|
case is Int.Type, is Int?.Type:
|
||||||
return (val as! Int == 0)
|
return (val as! Int == 0)
|
||||||
case is String.Type, is String?.Type:
|
case is String.Type, is String?.Type:
|
||||||
return (val as! String).isEmpty
|
return (val as! String).isEmpty
|
||||||
default:
|
default:
|
||||||
print("[StORM] WARNING: [\(#function)] Unexpected \(type) for PRIMARY KEY.")
|
print("[StORM] WARNING: [\(#function)] Unexpected \(theType) for PRIMARY KEY.")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue