Skip to content

Commit

Permalink
Make some result properties public.
Browse files Browse the repository at this point in the history
  • Loading branch information
roanutil committed Feb 7, 2021
1 parent 34abc0e commit 6bc2839
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
16 changes: 8 additions & 8 deletions Sources/CoreDataRepository/AggregateRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,22 @@ public final class AggregateRepository {

/// A return type for successful calculation
public struct Success<Value: Numeric> {
let function: Function
let result: [[String: Value]]
let request: NSFetchRequest<NSDictionary>
public let function: Function
public let result: [[String: Value]]
public let request: NSFetchRequest<NSDictionary>

var predicate: NSPredicate? {
public var predicate: NSPredicate? {
request.predicate
}
}

/// A return type for failure to calculate
public struct Failure: Error, Hashable {
let function: Function
let request: NSFetchRequest<NSDictionary>
let error: RepositoryErrors
public let function: Function
public let request: NSFetchRequest<NSDictionary>
public let error: RepositoryErrors

var predicate: NSPredicate? {
public var predicate: NSPredicate? {
request.predicate
}
}
Expand Down
20 changes: 10 additions & 10 deletions Sources/CoreDataRepository/FetchRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ public final class FetchRepository {
self.fetchRequest = fetchRequest
}

var limit: Int { fetchRequest.fetchLimit }
var offset: Int { fetchRequest.fetchOffset }
var predicate: NSPredicate? { fetchRequest.predicate }
var sortDesc: [NSSortDescriptor]? { fetchRequest.sortDescriptors }
public var limit: Int { fetchRequest.fetchLimit }
public var offset: Int { fetchRequest.fetchOffset }
public var predicate: NSPredicate? { fetchRequest.predicate }
public var sortDesc: [NSSortDescriptor]? { fetchRequest.sortDescriptors }
}

/// Return tpe for a failure to fetch. Includes parameters with error.
Expand All @@ -51,23 +51,23 @@ public final class FetchRepository {
self.fetchRequest = fetchRequest
}

var nsError: NSError? {
public var nsError: NSError? {
if case let .cocoa(nsError) = error {
return nsError
}
return nil
}
var localizedDescription: String? {
public var localizedDescription: String? {
if let desc = nsError?.localizedDescription {
return desc
}
return nil
}

var limit: Int { fetchRequest.fetchLimit }
var offset: Int { fetchRequest.fetchOffset }
var predicate: NSPredicate? { fetchRequest.predicate }
var sortDesc: [NSSortDescriptor]? { fetchRequest.sortDescriptors }
public var limit: Int { fetchRequest.fetchLimit }
public var offset: Int { fetchRequest.fetchOffset }
public var predicate: NSPredicate? { fetchRequest.predicate }
public var sortDesc: [NSSortDescriptor]? { fetchRequest.sortDescriptors }
}

// MARK: Functions/Endpoints
Expand Down

0 comments on commit 6bc2839

Please sign in to comment.