CSBaseDataTransaction

@objc
public class CSBaseDataTransaction : NSObject

The CSBaseDataTransaction serves as the Objective-C bridging type for BaseDataTransaction.

  • Indicates if the transaction has pending changes

    Declaration

    Swift

    @objc
    public var hasChanges: Bool { get }
  • Creates a new NSManagedObject with the specified entity type.

    Declaration

    Swift

    @objc
    public func createInto(_ into: CSInto) -> Any

    Parameters

    into

    the CSInto clause indicating the destination NSManagedObject entity type and the destination configuration

    Return Value

    a new NSManagedObject instance of the specified entity type.

  • Returns an editable proxy of a specified NSManagedObject.

    Declaration

    Swift

    @objc
    public func editObject(_ object: NSManagedObject?) -> Any?

    Parameters

    object

    the NSManagedObject type to be edited

    Return Value

    an editable proxy for the specified NSManagedObject.

  • Returns an editable proxy of the object with the specified NSManagedObjectID.

    Declaration

    Swift

    @objc
    public func editInto(_ into: CSInto, objectID: NSManagedObjectID) -> Any?

    Parameters

    into

    a CSInto clause specifying the entity type

    objectID

    the NSManagedObjectID for the object to be edited

    Return Value

    an editable proxy for the specified NSManagedObject.

  • Deletes a specified NSManagedObject.

    Declaration

    Swift

    @objc
    public func deleteObject(_ object: NSManagedObject?)

    Parameters

    object

    the NSManagedObject to be deleted

  • Deletes the specified NSManagedObjects.

    Declaration

    Swift

    @objc
    public func deleteObjects(_ objects: [NSManagedObject])

    Parameters

    objects

    the NSManagedObjects to be deleted

  • Refreshes all registered objects NSManagedObjects in the transaction.

    Declaration

    Swift

    @objc
    public func refreshAndMergeAllObjects()
  • Returns all pending NSManagedObjects of the specified type that were inserted to the transaction. This method should not be called after the -commit*: method was called.

    Declaration

    Swift

    @objc
    public func insertedObjectsOfType(_ entity: NSManagedObject.Type) -> Set<NSManagedObject>

    Parameters

    entity

    the NSManagedObject subclass to filter

    Return Value

    an NSSet of pending NSManagedObjects of the specified type that were inserted to the transaction.

  • Returns all pending NSManagedObjectIDs that were inserted to the transaction. This method should not be called after the -commit*: method was called.

    Declaration

    Swift

    @objc
    public func insertedObjectIDs() -> Set<NSManagedObjectID>

    Return Value

    an NSSet of pending NSManagedObjectIDs that were inserted to the transaction.

  • Returns all pending NSManagedObjectIDs of the specified type that were inserted to the transaction. This method should not be called after the -commit*: method was called.

    Declaration

    Swift

    @objc
    public func insertedObjectIDsOfType(_ entity: NSManagedObject.Type) -> Set<NSManagedObjectID>

    Parameters

    entity

    the NSManagedObject subclass to filter

    Return Value

    an NSSet of pending NSManagedObjectIDs of the specified type that were inserted to the transaction.

  • Returns all pending NSManagedObjects of the specified type that were updated in the transaction. This method should not be called after the -commit*: method was called.

    Declaration

    Swift

    @objc
    public func updatedObjectsOfType(_ entity: NSManagedObject.Type) -> Set<NSManagedObject>

    Parameters

    entity

    the NSManagedObject subclass to filter

    Return Value

    an NSSet of pending NSManagedObjects of the specified type that were updated in the transaction.

  • Returns all pending NSManagedObjectIDs that were updated in the transaction. This method should not be called after the -commit*: method was called.

    Declaration

    Swift

    @objc
    public func updatedObjectIDs() -> Set<NSManagedObjectID>

    Return Value

    an NSSet of pending NSManagedObjectIDs that were updated in the transaction.

  • Returns all pending NSManagedObjectIDs of the specified type that were updated in the transaction. This method should not be called after the -commit*: method was called.

    Declaration

    Swift

    @objc
    public func updatedObjectIDsOfType(_ entity: NSManagedObject.Type) -> Set<NSManagedObjectID>

    Parameters

    entity

    the NSManagedObject subclass to filter

    Return Value

    an NSSet of pending NSManagedObjectIDs of the specified type that were updated in the transaction.

  • Returns all pending NSManagedObjects of the specified type that were deleted from the transaction. This method should not be called after the -commit*: method was called.

    Declaration

    Swift

    @objc
    public func deletedObjectsOfType(_ entity: NSManagedObject.Type) -> Set<NSManagedObject>

    Parameters

    entity

    the NSManagedObject subclass to filter

    Return Value

    an NSSet of pending NSManagedObjects of the specified type that were deleted from the transaction.

  • Returns all pending NSManagedObjectIDs of the specified type that were deleted from the transaction. This method should not be called after the -commit*: method was called.

    Declaration

    Swift

    @objc
    public func deletedObjectIDs() -> Set<NSManagedObjectID>

    Return Value

    an NSSet of pending NSManagedObjectIDs of the specified type that were deleted from the transaction.

  • Returns all pending NSManagedObjectIDs of the specified type that were deleted from the transaction. This method should not be called after the -commit*: method was called.

    Declaration

    Swift

    @objc
    public func deletedObjectIDsOfType(_ entity: NSManagedObject.Type) -> Set<NSManagedObjectID>

    Parameters

    entity

    the NSManagedObject subclass to filter

    Return Value

    a Set of pending NSManagedObjectIDs of the specified type that were deleted from the transaction.

  • Fetches the NSManagedObject instance in the transaction’s context from a reference created from a transaction or from a different managed object context.

    Declaration

    Swift

    @objc
    public func fetchExistingObject(_ object: NSManagedObject) -> Any?

    Parameters

    object

    a reference to the object created/fetched outside the transaction

    Return Value

    the NSManagedObject instance if the object exists in the transaction, or nil if not found.

  • Fetches the NSManagedObject instance in the transaction’s context from an NSManagedObjectID.

    Declaration

    Swift

    @objc
    public func fetchExistingObjectWithID(_ objectID: NSManagedObjectID) -> Any?

    Parameters

    objectID

    the NSManagedObjectID for the object

    Return Value

    the NSManagedObject instance if the object exists in the transaction, or nil if not found.

  • Fetches the NSManagedObject instances in the transaction’s context from references created from a transaction or from a different managed object context.

    Declaration

    Swift

    @objc
    public func fetchExistingObjects(_ objects: [NSManagedObject]) -> [Any]

    Parameters

    objects

    an array of NSManagedObjects created/fetched outside the transaction

    Return Value

    the NSManagedObject array for objects that exists in the transaction

  • Fetches the NSManagedObject instances in the transaction’s context from a list of NSManagedObjectID.

    Declaration

    Swift

    @objc
    public func fetchExistingObjectsWithIDs(_ objectIDs: [NSManagedObjectID]) -> [Any]

    Parameters

    objectIDs

    the NSManagedObjectID array for the objects

    Return Value

    the NSManagedObject array for objects that exists in the transaction

  • Fetches the first NSManagedObject instance that satisfies the specified CSFetchClauses. Accepts CSWhere, CSOrderBy, and CSTweak clauses.

    Declaration

    Swift

    @objc
    public func fetchOneFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> Any?

    Parameters

    from

    a From clause indicating the entity type

    fetchClauses

    a series of CSFetchClause instances for the fetch request. Accepts CSWhere, CSOrderBy, and CSTweak clauses.

    Return Value

    the first NSManagedObject instance that satisfies the specified CSFetchClauses

  • Fetches all NSManagedObject instances that satisfy the specified CSFetchClauses. Accepts CSWhere, CSOrderBy, and CSTweak clauses.

    Declaration

    Swift

    @objc
    public func fetchAllFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> [Any]?

    Parameters

    from

    a CSFrom clause indicating the entity type

    fetchClauses

    a series of CSFetchClause instances for the fetch request. Accepts CSWhere, CSOrderBy, and CSTweak clauses.

    Return Value

    all NSManagedObject instances that satisfy the specified CSFetchClauses

  • Fetches the number of NSManagedObjects that satisfy the specified CSFetchClauses. Accepts CSWhere, CSOrderBy, and CSTweak clauses.

    Declaration

    Swift

    @objc
    public func fetchCountFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> NSNumber?

    Parameters

    from

    a CSFrom clause indicating the entity type

    fetchClauses

    a series of CSFetchClause instances for the fetch request. Accepts CSWhere, CSOrderBy, and CSTweak clauses.

    Return Value

    the number NSManagedObjects that satisfy the specified CSFetchClauses

  • Fetches the NSManagedObjectID for the first NSManagedObject that satisfies the specified CSFetchClauses. Accepts CSWhere, CSOrderBy, and CSTweak clauses.

    Declaration

    Swift

    @objc
    public func fetchObjectIDFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> NSManagedObjectID?

    Parameters

    from

    a CSFrom clause indicating the entity type

    fetchClauses

    a series of CSFetchClause instances for the fetch request. Accepts CSWhere, CSOrderBy, and CSTweak clauses.

    Return Value

    the NSManagedObjectID for the first NSManagedObject that satisfies the specified CSFetchClauses

  • Queries aggregate values as specified by the CSQueryClauses. Requires at least a CSSelect clause, and optional CSWhere, CSOrderBy, CSGroupBy, and CSTweak clauses.

    A query differs from a fetch in that it only retrieves values already stored in the persistent store. As such, values from unsaved transactions or contexts will not be incorporated in the query result.

    Declaration

    Swift

    @objc
    public func queryValueFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> Any?

    Parameters

    from

    a CSFrom clause indicating the entity type

    selectClause

    a CSSelect clause indicating the properties to fetch, and with the generic type indicating the return type.

    queryClauses

    a series of CSQueryClause instances for the query request. Accepts CSWhere, CSOrderBy, CSGroupBy, and CSTweak clauses.

    Return Value

    the result of the the query. The type of the return value is specified by the generic type of the CSSelect parameter.

  • Queries a dictionary of attribute values as specified by the CSQueryClauses. Requires at least a CSSelect clause, and optional CSWhere, CSOrderBy, CSGroupBy, and CSTweak clauses.

    A query differs from a fetch in that it only retrieves values already stored in the persistent store. As such, values from unsaved transactions or contexts will not be incorporated in the query result.

    Declaration

    Swift

    @objc
    public func queryAttributesFrom(_ from: CSFrom, selectClause: CSSelect, queryClauses: [CSQueryClause]) -> [[String : Any]]?

    Parameters

    from

    a CSFrom clause indicating the entity type

    selectClause

    a CSSelect clause indicating the properties to fetch, and with the generic type indicating the return type.

    queryClauses

    a series of CSQueryClause instances for the query request. Accepts CSWhere, CSOrderBy, CSGroupBy, and CSTweak clauses.

    Return Value

    the result of the the query. The type of the return value is specified by the generic type of the CSSelect parameter.