Skip to content

Commit 34325e5

Browse files
authored
Merge pull request #157 from davidvpe/hotfix/fetch-action
Adding fetch action for all() and first() methods
2 parents 6753bd4 + 2587143 commit 34325e5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Sources/Fluent/Query/Query.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ extension QueryRepresentable {
128128
*/
129129
public func first() throws -> T? {
130130
let query = try makeQuery()
131+
query.action = .fetch
131132
query.limit = Limit(count: 1)
132133

133134
var model = try query.run().first
@@ -142,6 +143,8 @@ extension QueryRepresentable {
142143
*/
143144
public func all() throws -> [T] {
144145
let query = try makeQuery()
146+
147+
query.action = .fetch
145148

146149
let models = try query.run()
147150
models.forEach { model in

0 commit comments

Comments
 (0)