Skip to content

Commit a168662

Browse files
committed
update
1 parent c7f0b5c commit a168662

File tree

4 files changed

+36
-27
lines changed

4 files changed

+36
-27
lines changed

Package.swift

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,36 @@
1-
// swift-tools-version:4.0
2-
// Package.swift
3-
// Perfect-MySQL
4-
//
5-
// Created by Kyle Jessup on 3/22/16.
6-
// Copyright (C) 2016 PerfectlySoft, Inc.
7-
//
8-
//===----------------------------------------------------------------------===//
9-
//
10-
// This source file is part of the Perfect.org open source project
11-
//
12-
// Copyright (c) 2015 - 2016 PerfectlySoft Inc. and the Perfect project authors
13-
// Licensed under Apache License v2.0
14-
//
15-
// See http://perfect.org/licensing.html for license information
16-
//
17-
//===----------------------------------------------------------------------===//
18-
//
1+
// swift-tools-version:5.2
192

203
import PackageDescription
214

5+
226
#if os(macOS)
23-
let clientPackage = "Perfect-mysqlclient"
7+
let mysqlclientPath = "Sources/mysqlclient-macos"
248
#else
25-
let clientPackage = "Perfect-mysqlclient-Linux"
9+
let mysqlclientPath = "Sources/mysqlclient"
2610
#endif
2711

2812
let package = Package(
2913
name: "PerfectMySQL",
14+
platforms: [
15+
.macOS(.v10_15)
16+
],
3017
products: [
3118
.library(name: "PerfectMySQL", targets: ["PerfectMySQL"])
3219
],
3320
dependencies: [
34-
.package(url: "https://github.com/PerfectlySoft/Perfect-CRUD.git", from: "1.2.2"),
35-
.package(url: "https://github.com/PerfectlySoft/\(clientPackage).git", from: "2.0.0"),
36-
],
21+
.package(name: "PerfectCRUD", url: "https://github.com/123FLO321/Perfect-CRUD.git", .branch("swift5"))
22+
],
3723
targets: [
38-
.target(name: "PerfectMySQL", dependencies: ["PerfectCRUD"]),
24+
.systemLibrary(
25+
name: "mysqlclient",
26+
path: mysqlclientPath,
27+
pkgConfig: "mysqlclient",
28+
providers: [
29+
.brew(["mysql"]),
30+
.apt(["libmysqlclient-dev"]),
31+
]
32+
),
33+
.target(name: "PerfectMySQL", dependencies: ["PerfectCRUD", "mysqlclient"]),
3934
.testTarget(name: "PerfectMySQLTests", dependencies: ["PerfectMySQL"])
4035
]
4136
)

Sources/PerfectMySQL/MySQLCRUD.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ class MySQLCRUDRowReader<K : CodingKey>: KeyedDecodingContainerProtocol {
134134
return ret as! T
135135
case .data:
136136
let bytes: [UInt8] = (val as? [UInt8]) ?? []
137-
return Data(bytes: bytes) as! T
137+
return Data(bytes) as! T
138138
case .uuid:
139139
guard let str = val as? String, let uuid = UUID(uuidString: str) else {
140140
throw CRUDDecoderError("Invalid UUID string \(String(describing: val)).")
@@ -155,7 +155,9 @@ class MySQLCRUDRowReader<K : CodingKey>: KeyedDecodingContainerProtocol {
155155
throw CRUDDecoderError("Unsupported type: \(type) for key: \(key.stringValue)")
156156
}
157157
return try JSONDecoder().decode(type, from: data)
158-
}
158+
case .wrapped:
159+
throw CRUDDecoderError("Wrapped is unsupported.")
160+
}
159161
}
160162
func nestedContainer<NestedKey>(keyedBy type: NestedKey.Type, forKey key: Key) throws -> KeyedDecodingContainer<NestedKey> where NestedKey : CodingKey {
161163
throw CRUDDecoderError("Unimplimented nestedContainer")
@@ -339,7 +341,9 @@ class MySQLGenDelegate: SQLGenDelegate {
339341
typeName = "longtext"
340342
case .codable:
341343
typeName = "json"
342-
}
344+
case .wrapped:
345+
throw MySQLCRUDError("Wrapped is unsupported.")
346+
}
343347
}
344348
let addendum: String
345349
if column.properties.contains(.primaryKey) {
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module mysqlclient {
2+
header "/usr/local/include/mysql/mysql.h"
3+
link "mysqlclient"
4+
export *
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module mysqlclient {
2+
header "/usr/include/mysql/mysql.h"
3+
link "mysqlclient"
4+
export *
5+
}

0 commit comments

Comments
 (0)