@@ -64,3 +64,35 @@ public class AsyncDeleteRepositoryWrapper<R, T>: AsyncDeleteRepository where R:
64
64
try await repository. delete ( query, operation: operation) . async ( )
65
65
}
66
66
}
67
+
68
+ @available ( iOS 13 . 0 . 0 , * )
69
+ // swiftlint:disable line_length
70
+ public class AsyncRepositoryWrapper < R, T> : AsyncGetRepository , AsyncPutRepository , AsyncDeleteRepository where R: GetRepository , R: PutRepository , R: DeleteRepository , R. T == T {
71
+ private let repository : R
72
+
73
+ public init ( _ repository: R ) {
74
+ self . repository = repository
75
+ }
76
+
77
+ public func get( _ query: Query , operation: Operation ) async throws -> T {
78
+ try await repository. get ( query, operation: operation) . async ( )
79
+ }
80
+
81
+ public func getAll( _ query: Query , operation: Operation ) async throws -> [ T ] {
82
+ try await repository. getAll ( query, operation: operation) . async ( )
83
+ }
84
+
85
+ @discardableResult
86
+ public func put( _ value: T ? , in query: Query , operation: Operation ) async throws -> T {
87
+ try await repository. put ( value, in: query, operation: operation) . async ( )
88
+ }
89
+
90
+ @discardableResult
91
+ public func putAll( _ array: [ T ] , in query: Query , operation: Operation ) async throws -> [ T ] {
92
+ try await repository. putAll ( array, in: query, operation: operation) . async ( )
93
+ }
94
+
95
+ public func delete( _ query: Query , operation: Operation ) async throws {
96
+ try await repository. delete ( query, operation: operation) . async ( )
97
+ }
98
+ }
0 commit comments