CSBaseDataTransaction
@objc
public class CSBaseDataTransaction : NSObject
The CSBaseDataTransaction
serves as the Objective-C bridging type for BaseDataTransaction
.
See also
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 destinationNSManagedObject
entity type and the destination configurationReturn 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 editedReturn 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 typeobjectID
the
NSManagedObjectID
for the object to be editedReturn 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
NSManagedObject
s.Declaration
Swift
@objc public func deleteObjects(_ objects: [NSManagedObject])
Parameters
objects
the
NSManagedObject
s to be deleted -
Refreshes all registered objects
NSManagedObject
s in the transaction.Declaration
Swift
@objc public func refreshAndMergeAllObjects()
-
Returns all pending
NSManagedObject
s 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 filterReturn Value
an
NSSet
of pendingNSManagedObject
s of the specified type that were inserted to the transaction. -
Returns all pending
NSManagedObjectID
s 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 pendingNSManagedObjectID
s that were inserted to the transaction. -
Returns all pending
NSManagedObjectID
s 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 filterReturn Value
an
NSSet
of pendingNSManagedObjectID
s of the specified type that were inserted to the transaction. -
Returns all pending
NSManagedObject
s 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 filterReturn Value
an
NSSet
of pendingNSManagedObject
s of the specified type that were updated in the transaction. -
Returns all pending
NSManagedObjectID
s 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 pendingNSManagedObjectID
s that were updated in the transaction. -
Returns all pending
NSManagedObjectID
s 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 filterReturn Value
an
NSSet
of pendingNSManagedObjectID
s of the specified type that were updated in the transaction. -
Returns all pending
NSManagedObject
s 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 filterReturn Value
an
NSSet
of pendingNSManagedObject
s of the specified type that were deleted from the transaction. -
Returns all pending
NSManagedObjectID
s 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 pendingNSManagedObjectID
s of the specified type that were deleted from the transaction. -
Returns all pending
NSManagedObjectID
s 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 filterReturn Value
a
Set
of pendingNSManagedObjectID
s 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, ornil
if not found. -
Fetches the
NSManagedObject
instance in the transaction’s context from anNSManagedObjectID
.Declaration
Swift
@objc public func fetchExistingObjectWithID(_ objectID: NSManagedObjectID) -> Any?
Parameters
objectID
the
NSManagedObjectID
for the objectReturn Value
the
NSManagedObject
instance if the object exists in the transaction, ornil
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
NSManagedObject
s created/fetched outside the transactionReturn Value
the
NSManagedObject
array for objects that exists in the transaction -
Fetches the
NSManagedObject
instances in the transaction’s context from a list ofNSManagedObjectID
.Declaration
Swift
@objc public func fetchExistingObjectsWithIDs(_ objectIDs: [NSManagedObjectID]) -> [Any]
Parameters
objectIDs
the
NSManagedObjectID
array for the objectsReturn Value
the
NSManagedObject
array for objects that exists in the transaction -
Fetches the first
NSManagedObject
instance that satisfies the specifiedCSFetchClause
s. AcceptsCSWhere
,CSOrderBy
, andCSTweak
clauses.Declaration
Swift
@objc public func fetchOneFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> Any?
Parameters
from
a
From
clause indicating the entity typefetchClauses
a series of
CSFetchClause
instances for the fetch request. AcceptsCSWhere
,CSOrderBy
, andCSTweak
clauses.Return Value
the first
NSManagedObject
instance that satisfies the specifiedCSFetchClause
s -
Fetches all
NSManagedObject
instances that satisfy the specifiedCSFetchClause
s. AcceptsCSWhere
,CSOrderBy
, andCSTweak
clauses.Declaration
Swift
@objc public func fetchAllFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> [Any]?
Parameters
from
a
CSFrom
clause indicating the entity typefetchClauses
a series of
CSFetchClause
instances for the fetch request. AcceptsCSWhere
,CSOrderBy
, andCSTweak
clauses.Return Value
all
NSManagedObject
instances that satisfy the specifiedCSFetchClause
s -
Fetches the number of
NSManagedObject
s that satisfy the specifiedCSFetchClause
s. AcceptsCSWhere
,CSOrderBy
, andCSTweak
clauses.Declaration
Swift
@objc public func fetchCountFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> NSNumber?
Parameters
from
a
CSFrom
clause indicating the entity typefetchClauses
a series of
CSFetchClause
instances for the fetch request. AcceptsCSWhere
,CSOrderBy
, andCSTweak
clauses.Return Value
the number
NSManagedObject
s that satisfy the specifiedCSFetchClause
s -
Fetches the
NSManagedObjectID
for the firstNSManagedObject
that satisfies the specifiedCSFetchClause
s. AcceptsCSWhere
,CSOrderBy
, andCSTweak
clauses.Declaration
Swift
@objc public func fetchObjectIDFrom(_ from: CSFrom, fetchClauses: [CSFetchClause]) -> NSManagedObjectID?
Parameters
from
a
CSFrom
clause indicating the entity typefetchClauses
a series of
CSFetchClause
instances for the fetch request. AcceptsCSWhere
,CSOrderBy
, andCSTweak
clauses.Return Value
the
NSManagedObjectID
for the firstNSManagedObject
that satisfies the specifiedCSFetchClause
s -
Queries aggregate values as specified by the
CSQueryClause
s. Requires at least aCSSelect
clause, and optionalCSWhere
,CSOrderBy
,CSGroupBy
, andCSTweak
clauses.A
query
differs from afetch
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 typeselectClause
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. AcceptsCSWhere
,CSOrderBy
,CSGroupBy
, andCSTweak
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
CSQueryClause
s. Requires at least aCSSelect
clause, and optionalCSWhere
,CSOrderBy
,CSGroupBy
, andCSTweak
clauses.A
query
differs from afetch
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 typeselectClause
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. AcceptsCSWhere
,CSOrderBy
,CSGroupBy
, andCSTweak
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.