Skip to content
This repository has been archived by the owner on Aug 13, 2024. It is now read-only.

Commit

Permalink
use new generic style for new methods just merged from main
Browse files Browse the repository at this point in the history
  • Loading branch information
radmakr committed Sep 13, 2022
1 parent 0565f3c commit 552e30b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/MongoManager/MongoManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ public struct MongoManager {
}

/// unwrap your `Codable` array from the MongoDB Document object
public static func unwrapDocuments<C: Codable>(_ documents: MongoDocuments<C>) -> C {
public static func unwrapDocuments(_ documents: MongoDocuments<some Codable>) -> some Codable {
documents.documents
}

/// decode a `MongoDocuments` object from the given FetchResponse
/// - Parameters res: A `FetchResponse` object to decode
/// - Returns an array of objects conforming to `Codable`
public static func decodeDocuments<C: Codable>(from res: FetchResponse) async throws -> C {
unwrapDocuments(try await res.body.decode(MongoDocuments<C>.self))
try await res.body.decode(MongoDocuments<C>.self).documents
}

private static func headers(for data: MongoData) -> [String : String] {
Expand Down

0 comments on commit 552e30b

Please sign in to comment.