Skip to content

Commit 29658ba

Browse files
committed
Merge pull request #45 from qutheory/preview
updating to swift preview release
2 parents 23d2ad8 + eb2285b commit 29658ba

File tree

5 files changed

+15
-16
lines changed

5 files changed

+15
-16
lines changed

.swift-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
DEVELOPMENT-SNAPSHOT-2016-05-03-a
1+
3.0-preview-1-SNAPSHOT-2016-05-31-a

Package.swift

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import PackageDescription
22

33
let package = Package(
4-
name: "Fluent",
5-
dependencies: [
6-
.Package(url: "https://github.com/qutheory/libc.git", majorVersion: 0, minor: 1),
7-
]
8-
)
4+
name: "Fluent"
5+
)

Sources/Query.swift

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public class Query<T: Model> {
6161

6262
Returns an array of entities.
6363
*/
64+
// @discardableResult
6465
func run() throws -> [T] {
6566
var models: [T] = []
6667

@@ -116,18 +117,16 @@ public class Query<T: Model> {
116117
Attempts to save a supplied entity
117118
and updates its identifier if successful.
118119
*/
119-
public func save(_ model: inout T) throws -> T {
120+
public func save(_ model: inout T) throws {
120121
let data = model.serialize()
121122

122123
if let id = model.id {
123-
filter(database.driver.idKey, .equals, id)
124+
let _ = filter(database.driver.idKey, .equals, id) // discardableResult
124125
try update(data)
125126
} else {
126127
let new = try create(data)
127128
model.id = new?.id
128129
}
129-
130-
return model
131130
}
132131

133132
//MARK: Delete
@@ -138,7 +137,7 @@ public class Query<T: Model> {
138137
*/
139138
public func delete() throws {
140139
action = .delete
141-
try run()
140+
let _ = try run() // discardableResult
142141
}
143142

144143
/**
@@ -153,8 +152,8 @@ public class Query<T: Model> {
153152

154153
let filter = Filter.compare(database.driver.idKey, .equals, id)
155154
filters.append(filter)
156-
157-
try run()
155+
156+
let _ = try run() // discardableResult
158157
}
159158

160159
//MARK: Update
@@ -166,7 +165,7 @@ public class Query<T: Model> {
166165
public func update(_ serialized: [String: Value?]) throws {
167166
action = .update
168167
data = serialized
169-
try run()
168+
let _ = try run() // discardableResult
170169
}
171170

172171

@@ -179,6 +178,7 @@ public class Query<T: Model> {
179178
Used for filtering results based on how
180179
a result's value compares to the supplied value.
181180
*/
181+
// @discardableResult
182182
public func filter(_ field: String, _ comparison: Filter.Comparison, _ value: Value) -> Self {
183183
let filter = Filter.compare(field, comparison, value)
184184
filters.append(filter)
@@ -192,6 +192,7 @@ public class Query<T: Model> {
192192
Used for filtering results based on whether
193193
a result's value is or is not in a set.
194194
*/
195+
// @discardableResult
195196
public func filter(_ field: String, _ scope: Filter.Scope, _ set: [Value]) -> Self {
196197
let filter = Filter.subset(field, scope, set)
197198
filters.append(filter)
@@ -202,6 +203,7 @@ public class Query<T: Model> {
202203
/**
203204
Shortcut for creating a `.equals` filter.
204205
*/
206+
// @discardableResult
205207
public func filter(_ field: String, _ value: Value) -> Self {
206208
return filter(field, .equals, value)
207209
}

Tests/Fluent/ModelFindTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class ModelFindTests: XCTestCase {
5252
}
5353
}
5454

55-
static var allTests : [(String, ModelFindTests -> () throws -> Void)] {
55+
static var allTests : [(String, (ModelFindTests) -> () throws -> Void)] {
5656
return [
5757
("testFindFailing", testFindFailing),
5858
("testFindSucceeding", testFindSucceeding),

Tests/Fluent/QueryFiltersTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class QueryFiltersTests: XCTestCase {
3232
}
3333
}
3434

35-
static var allTests : [(String, QueryFiltersTests -> () throws -> Void)] {
35+
static var allTests : [(String, (QueryFiltersTests) -> () throws -> Void)] {
3636
return [
3737
("testBasalQuery", testBasalQuery),
3838
("testBasicQuery", testBasicQuery),

0 commit comments

Comments
 (0)