Documentation
¶
Overview ¶
Package coredata provides Go bindings for the CoreData framework.
Persist or cache data on a single device, or sync data to multiple devices with CloudKit.
Use Core Data to save your application’s permanent data for offline use, to cache temporary data, and to add undo functionality to your app on a single device. To sync data across multiple devices in a single iCloud account, Core Data automatically mirrors your schema to a CloudKit container.
Essentials ¶
- Creating a Core Data model: Define your app’s object structure with a data model file.
- Setting up a Core Data stack: Set up the classes that manage and persist your app’s objects.
- Core Data stack: Manage and persist your app’s model layer. (NSPersistentContainer, NSManagedObjectModel, NSEntityDescription, NSPropertyDescription, NSAttributeDescription)
- Handling Different Data Types in Core Data: Create, store, and present records for a variety of data types.
- Linking Data Between Two Core Data Stores: Organize data in two different stores and implement a link between them.
Data modeling ¶
- Modeling data: Configure the data model file to contain your app’s object graph.
- Core Data model: Describe your app’s object structure. (NSManagedObject, NSEntityDescription, NSPropertyDescription, NSAttributeDescription, NSAttributeType)
Fetch requests ¶
- NSFetchRequest: A description of search criteria used to retrieve data from a persistent store. (NSFetchRequestResultType, NSFetchRequestExpression, NSExpressionDescription, NSFetchedPropertyDescription, NSFetchRequestResultType)
- NSAsynchronousFetchRequest: A fetch request that retrieves results asynchronously and supports progress notification.
- NSAsynchronousFetchResult: A fetch result object that encompasses the response from an executed asynchronous fetch request.
- NSFetchedResultsController: A controller that you use to manage the results of a Core Data fetch request and to display data to the user. (NSFetchedResultsControllerDelegate, NSFetchedResultsSectionInfo, NSFetchRequestResultType, NSFetchedResultsChangeType)
SwiftData migration and coexistence ¶
- Adopting SwiftData for a Core Data app: Persist data in your app intuitively with the Swift native persistence framework.
CloudKit mirroring ¶
- Mirroring a Core Data store with CloudKit: Back user interfaces with a local replica of a CloudKit private database.
- Synchronizing a local store to the cloud: Share data between a user’s devices and other iCloud users.
- NSPersistentCloudKitContainer: A container that encapsulates the Core Data stack in your app, and mirrors select persistent stores to a CloudKit private database. (NSPersistentCloudKitContainerSchemaInitializationOptions, NSPersistentCloudKitContainerEventRequest, NSPersistentCloudKitContainerEventResult)
- NSPersistentCloudKitContainerOptions: An object that customizes how a store description aligns with a CloudKit database.
- Sharing Core Data objects between iCloud users: Use Core Data and CloudKit to synchronize data between devices of an iCloud user and share data between different iCloud users.
Change processing ¶
- Accessing data when the store changes: Guarantee that a context won’t see store changes until you tell it to look.
- Consuming relevant store changes: Filter store transactions for changes relevant to the current view.
- Persistent history: Use persistent history tracking to determine what changes have occurred in the store since the enabling of persistent history tracking. (NSPersistentHistoryToken, NSPersistentHistoryChangeRequest, NSPersistentHistoryResult, NSPersistentHistoryTransaction, NSPersistentHistoryChange)
Background tasks ¶
- Using Core Data in the background: Use Core Data in both a single-threaded and multithreaded app.
- Loading and displaying a large data feed: Consume data in the background, and lower memory use by batching imports and preventing duplicate records.
- Conflict resolution: Detect and resolve conflicts that occur when data is changed on multiple threads. (NSConstraintConflict, NSMergeConflict, NSMergePolicy, NSQueryGenerationToken)
- Batch processing: Use batch processes to manage large data changes. (NSBatchInsertRequest, NSBatchInsertResult, NSBatchUpdateRequest, NSBatchUpdateResult, NSBatchDeleteRequest)
Data model migration ¶
- Migrating your data model automatically: Enable lightweight migrations to keep your data model and the underlying data in a consistent state.
- Staged migrations: Migrate complex data models containing changes that are incompatible with lightweight migrations. (NSStagedMigrationManager, NSLightweightMigrationStage, NSCustomMigrationStage, NSMigrationStage)
- Manual migrations: Migrate elaborate data models with changes that go beyond the capabilities of both lightweight and staged migrations. (NSMigrationManager, NSMappingModel, NSEntityMapping, NSEntityMigrationPolicy, NSEntityMappingType)
Related types ¶
- Core Data Constants: Keys to use with persistent stores and notifications from Core Data.//
Key Types ¶
- NSManagedObjectContext - An object space to manipulate and track changes to managed objects.
- NSManagedObject - The base class that all Core Data model objects inherit from.
- NSPersistentStoreCoordinator - An object that enables an app’s contexts and the underlying persistent stores to work together.
- NSEntityDescription - A description of a Core Data entity.
- NSFetchRequest - A description of search criteria used to retrieve data from a persistent store.
- NSManagedObjectModel - A programmatic representation of the `XCUIElementTypeXcdatamodeld` file describing your objects.
- NSMigrationManager - A migration manager instance that performs a migration of data from one persistent store to another using a given mapping model.
- NSPersistentStore - The abstract base class for all Core Data persistent stores.
- NSFetchedResultsController - A controller that you use to manage the results of a Core Data fetch request and to display data to the user.
- NSPersistentStoreDescription - A description object used to create and load a persistent store.
Code generated from Apple documentation. DO NOT EDIT.
Index ¶
- Variables
- func NewAsynchronousFetchResultBlock(handler AsynchronousFetchResultHandler) (objc.ID, func())
- func NewBoolManagedObjectBlock(handler BoolManagedObjectHandler) (objc.ID, func())
- func NewErrorBlock(handler ErrorHandler) (objc.ID, func())
- func NewManagedObjectContextBlock(handler ManagedObjectContextHandler) (objc.ID, func())
- func NewNSPersistentStoreAsynchronousFetchResultCompletionBlock(handler NSPersistentStoreAsynchronousFetchResultCompletionBlock) (objc.ID, func())
- func NewPersistentStoreDescriptionErrorBlock(handler PersistentStoreDescriptionErrorHandler) (objc.ID, func())
- func NewVoidBlock(handler VoidHandler) (objc.ID, func())
- func NewidNSFetchRequestResultAsynchronousFetchResultBlock(handler idNSFetchRequestResultAsynchronousFetchResultHandler) (objc.ID, func())
- type AsynchronousFetchResultHandler
- type BoolManagedObjectHandler
- type BoolStringidMutableDictionaryHandler
- type Class
- type ErrorHandler
- type INSAsynchronousFetchRequest
- type INSAsynchronousFetchResult
- type INSAtomicStore
- type INSAtomicStoreCacheNode
- type INSAttributeDescription
- type INSBatchDeleteRequest
- type INSBatchDeleteResult
- type INSBatchInsertRequest
- type INSBatchInsertResult
- type INSBatchUpdateRequest
- type INSBatchUpdateResult
- type INSCompositeAttributeDescription
- type INSConstraintConflict
- type INSCoreDataCoreSpotlightDelegate
- type INSCustomMigrationStage
- type INSDerivedAttributeDescription
- type INSEntityDescription
- type INSEntityMapping
- type INSEntityMigrationPolicy
- type INSExpressionDescription
- type INSFetchIndexDescription
- type INSFetchIndexElementDescription
- type INSFetchRequest
- type INSFetchRequestExpression
- type INSFetchedPropertyDescription
- type INSFetchedResultsController
- type INSIncrementalStore
- type INSIncrementalStoreNode
- type INSLightweightMigrationStage
- type INSManagedObject
- type INSManagedObjectContext
- type INSManagedObjectID
- type INSManagedObjectModel
- type INSManagedObjectModelReference
- type INSMappingModel
- type INSMergeConflict
- type INSMergePolicy
- type INSMigrationManager
- type INSMigrationStage
- type INSPersistentCloudKitContainer
- type INSPersistentCloudKitContainerEvent
- type INSPersistentCloudKitContainerEventRequest
- type INSPersistentCloudKitContainerEventResult
- type INSPersistentCloudKitContainerOptions
- type INSPersistentContainer
- type INSPersistentHistoryChange
- type INSPersistentHistoryChangeRequest
- type INSPersistentHistoryResult
- type INSPersistentHistoryToken
- type INSPersistentHistoryTransaction
- type INSPersistentStore
- type INSPersistentStoreAsynchronousResult
- type INSPersistentStoreCoordinator
- type INSPersistentStoreDescription
- type INSPersistentStoreRequest
- type INSPersistentStoreResult
- type INSPropertyDescription
- type INSPropertyMapping
- type INSQueryGenerationToken
- type INSRelationshipDescription
- type INSSaveChangesRequest
- type INSStagedMigrationManager
- type ManagedObjectContextHandler
- type NSAsynchronousFetchRequest
- func (a NSAsynchronousFetchRequest) Autorelease() NSAsynchronousFetchRequest
- func (a NSAsynchronousFetchRequest) EstimatedResultCount() int
- func (a NSAsynchronousFetchRequest) FetchRequest() INSFetchRequest
- func (a NSAsynchronousFetchRequest) Init() NSAsynchronousFetchRequest
- func (a NSAsynchronousFetchRequest) InitWithFetchRequestCompletionBlock(request INSFetchRequest, ...) NSAsynchronousFetchRequest
- func (a NSAsynchronousFetchRequest) InitWithFetchRequestCompletionBlockSync(ctx context.Context, request INSFetchRequest) (*NSAsynchronousFetchResult, error)
- func (a NSAsynchronousFetchRequest) SetEstimatedResultCount(value int)
- type NSAsynchronousFetchRequestClass
- type NSAsynchronousFetchResult
- type NSAsynchronousFetchResultClass
- type NSAtomicStore
- func (a NSAtomicStore) AddCacheNodes(cacheNodes foundation.INSSet)
- func (a NSAtomicStore) Autorelease() NSAtomicStore
- func (a NSAtomicStore) CacheNodeForObjectID(objectID INSManagedObjectID) INSAtomicStoreCacheNode
- func (a NSAtomicStore) CacheNodes() foundation.INSSet
- func (a NSAtomicStore) Init() NSAtomicStore
- func (a NSAtomicStore) Load() (bool, error)
- func (a NSAtomicStore) NewCacheNodeForManagedObject(managedObject INSManagedObject) INSAtomicStoreCacheNode
- func (a NSAtomicStore) NewReferenceObjectForManagedObject(managedObject INSManagedObject) objectivec.IObject
- func (a NSAtomicStore) ObjectIDForEntityReferenceObject(entity INSEntityDescription, data objectivec.IObject) INSManagedObjectID
- func (a NSAtomicStore) ReferenceObjectForObjectID(objectID INSManagedObjectID) objectivec.IObject
- func (a NSAtomicStore) Save() (bool, error)
- func (a NSAtomicStore) UpdateCacheNodeFromManagedObject(node INSAtomicStoreCacheNode, managedObject INSManagedObject)
- func (a NSAtomicStore) WillRemoveCacheNodes(cacheNodes foundation.INSSet)
- type NSAtomicStoreCacheNode
- func (a NSAtomicStoreCacheNode) Autorelease() NSAtomicStoreCacheNode
- func (a NSAtomicStoreCacheNode) Init() NSAtomicStoreCacheNode
- func (a NSAtomicStoreCacheNode) InitWithObjectID(moid INSManagedObjectID) NSAtomicStoreCacheNode
- func (a NSAtomicStoreCacheNode) ObjectID() INSManagedObjectID
- func (a NSAtomicStoreCacheNode) PropertyCache() foundation.INSDictionary
- func (a NSAtomicStoreCacheNode) SetPropertyCache(value foundation.INSDictionary)
- type NSAtomicStoreCacheNodeClass
- type NSAtomicStoreClass
- type NSAttributeDescription
- func (a NSAttributeDescription) AllowsCloudEncryption() bool
- func (a NSAttributeDescription) AllowsExternalBinaryDataStorage() bool
- func (a NSAttributeDescription) AttributeType() NSAttributeType
- func (a NSAttributeDescription) AttributeValueClassName() string
- func (a NSAttributeDescription) Autorelease() NSAttributeDescription
- func (a NSAttributeDescription) DefaultValue() objectivec.IObject
- func (a NSAttributeDescription) Init() NSAttributeDescription
- func (a NSAttributeDescription) PreservesValueInHistoryOnDeletion() bool
- func (a NSAttributeDescription) SetAllowsCloudEncryption(value bool)
- func (a NSAttributeDescription) SetAllowsExternalBinaryDataStorage(value bool)
- func (a NSAttributeDescription) SetAttributeType(value NSAttributeType)
- func (a NSAttributeDescription) SetAttributeValueClassName(value string)
- func (a NSAttributeDescription) SetDefaultValue(value objectivec.IObject)
- func (a NSAttributeDescription) SetPreservesValueInHistoryOnDeletion(value bool)
- func (a NSAttributeDescription) SetValueTransformerName(value string)
- func (a NSAttributeDescription) ValueTransformerName() string
- type NSAttributeDescriptionClass
- type NSAttributeType
- type NSBatchDeleteRequest
- func (b NSBatchDeleteRequest) Autorelease() NSBatchDeleteRequest
- func (b NSBatchDeleteRequest) FetchRequest() INSFetchRequest
- func (b NSBatchDeleteRequest) Init() NSBatchDeleteRequest
- func (b NSBatchDeleteRequest) InitWithFetchRequest(fetch INSFetchRequest) NSBatchDeleteRequest
- func (b NSBatchDeleteRequest) InitWithObjectIDs(objects []NSManagedObjectID) NSBatchDeleteRequest
- func (b NSBatchDeleteRequest) ResultType() NSBatchDeleteRequestResultType
- func (b NSBatchDeleteRequest) SetResultType(value NSBatchDeleteRequestResultType)
- type NSBatchDeleteRequestClass
- type NSBatchDeleteRequestResultType
- type NSBatchDeleteResult
- type NSBatchDeleteResultClass
- type NSBatchInsertRequest
- func NSBatchInsertRequestFromID(id objc.ID) NSBatchInsertRequest
- func NewBatchInsertRequestWithEntityNameObjects(entityName string, dictionaries foundation.INSDictionary) NSBatchInsertRequest
- func NewBatchInsertRequestWithEntityObjects(entity INSEntityDescription, dictionaries foundation.INSDictionary) NSBatchInsertRequest
- func NewNSBatchInsertRequest() NSBatchInsertRequest
- func (b NSBatchInsertRequest) Autorelease() NSBatchInsertRequest
- func (b NSBatchInsertRequest) DictionaryHandler() objectivec.IObject
- func (b NSBatchInsertRequest) Entity() INSEntityDescription
- func (b NSBatchInsertRequest) EntityName() string
- func (b NSBatchInsertRequest) Init() NSBatchInsertRequest
- func (b NSBatchInsertRequest) InitWithEntityManagedObjectHandler(entity INSEntityDescription, handler BoolManagedObjectHandler) NSBatchInsertRequest
- func (b NSBatchInsertRequest) InitWithEntityNameManagedObjectHandler(entityName string, handler BoolManagedObjectHandler) NSBatchInsertRequest
- func (b NSBatchInsertRequest) InitWithEntityNameObjects(entityName string, dictionaries foundation.INSDictionary) NSBatchInsertRequest
- func (b NSBatchInsertRequest) InitWithEntityObjects(entity INSEntityDescription, dictionaries foundation.INSDictionary) NSBatchInsertRequest
- func (b NSBatchInsertRequest) ManagedObjectHandler() BoolManagedObjectHandler
- func (b NSBatchInsertRequest) ObjectsToInsert() foundation.INSDictionary
- func (b NSBatchInsertRequest) ResultType() NSBatchInsertRequestResultType
- func (b NSBatchInsertRequest) SetDictionaryHandler(value objc.ID)
- func (b NSBatchInsertRequest) SetManagedObjectHandler(value BoolManagedObjectHandler)
- func (b NSBatchInsertRequest) SetObjectsToInsert(value foundation.INSDictionary)
- func (b NSBatchInsertRequest) SetResultType(value NSBatchInsertRequestResultType)
- type NSBatchInsertRequestClass
- type NSBatchInsertRequestResultType
- type NSBatchInsertResult
- type NSBatchInsertResultClass
- type NSBatchUpdateRequest
- func (b NSBatchUpdateRequest) Autorelease() NSBatchUpdateRequest
- func (b NSBatchUpdateRequest) Entity() INSEntityDescription
- func (b NSBatchUpdateRequest) EntityName() string
- func (b NSBatchUpdateRequest) IncludesSubentities() bool
- func (b NSBatchUpdateRequest) Init() NSBatchUpdateRequest
- func (b NSBatchUpdateRequest) InitWithEntity(entity INSEntityDescription) NSBatchUpdateRequest
- func (b NSBatchUpdateRequest) InitWithEntityName(entityName string) NSBatchUpdateRequest
- func (b NSBatchUpdateRequest) Predicate() foundation.NSPredicate
- func (b NSBatchUpdateRequest) PropertiesToUpdate() foundation.INSDictionary
- func (b NSBatchUpdateRequest) ResultType() NSBatchUpdateRequestResultType
- func (b NSBatchUpdateRequest) SetIncludesSubentities(value bool)
- func (b NSBatchUpdateRequest) SetPredicate(value foundation.NSPredicate)
- func (b NSBatchUpdateRequest) SetPropertiesToUpdate(value foundation.INSDictionary)
- func (b NSBatchUpdateRequest) SetResultType(value NSBatchUpdateRequestResultType)
- type NSBatchUpdateRequestClass
- type NSBatchUpdateRequestResultType
- type NSBatchUpdateResult
- type NSBatchUpdateResultClass
- type NSCompositeAttributeDescription
- func (c NSCompositeAttributeDescription) Autorelease() NSCompositeAttributeDescription
- func (c NSCompositeAttributeDescription) Elements() []NSAttributeDescription
- func (c NSCompositeAttributeDescription) Init() NSCompositeAttributeDescription
- func (c NSCompositeAttributeDescription) SetElements(value []NSAttributeDescription)
- type NSCompositeAttributeDescriptionClass
- type NSConstraintConflict
- func NSConstraintConflictFromID(id objc.ID) NSConstraintConflict
- func NewConstraintConflictWithConstraintDatabaseObjectDatabaseSnapshotConflictingObjectsConflictingSnapshots(contraint []string, databaseObject INSManagedObject, ...) NSConstraintConflict
- func NewNSConstraintConflict() NSConstraintConflict
- func (c NSConstraintConflict) Autorelease() NSConstraintConflict
- func (c NSConstraintConflict) ConflictingObjects() []NSManagedObject
- func (c NSConstraintConflict) ConflictingSnapshots() foundation.INSDictionary
- func (c NSConstraintConflict) Constraint() []string
- func (c NSConstraintConflict) ConstraintValues() foundation.INSDictionary
- func (c NSConstraintConflict) DatabaseObject() INSManagedObject
- func (c NSConstraintConflict) DatabaseSnapshot() foundation.INSDictionary
- func (c NSConstraintConflict) Init() NSConstraintConflict
- func (c NSConstraintConflict) InitWithConstraintDatabaseObjectDatabaseSnapshotConflictingObjectsConflictingSnapshots(contraint []string, databaseObject INSManagedObject, ...) NSConstraintConflict
- type NSConstraintConflictClass
- type NSCoreDataCoreSpotlightDelegate
- func NSCoreDataCoreSpotlightDelegateFromID(id objc.ID) NSCoreDataCoreSpotlightDelegate
- func NewCoreDataCoreSpotlightDelegateForStoreWithDescriptionCoordinator(description INSPersistentStoreDescription, psc INSPersistentStoreCoordinator) NSCoreDataCoreSpotlightDelegate
- func NewNSCoreDataCoreSpotlightDelegate() NSCoreDataCoreSpotlightDelegate
- func (c NSCoreDataCoreSpotlightDelegate) AttributeSetForObject(object INSManagedObject) corespotlight.CSSearchableItemAttributeSet
- func (c NSCoreDataCoreSpotlightDelegate) Autorelease() NSCoreDataCoreSpotlightDelegate
- func (c NSCoreDataCoreSpotlightDelegate) DeleteSpotlightIndex(ctx context.Context) error
- func (c NSCoreDataCoreSpotlightDelegate) DeleteSpotlightIndexWithCompletionHandler(completionHandler ErrorHandler)
- func (c NSCoreDataCoreSpotlightDelegate) DomainIdentifier() string
- func (c NSCoreDataCoreSpotlightDelegate) IndexName() string
- func (c NSCoreDataCoreSpotlightDelegate) Init() NSCoreDataCoreSpotlightDelegate
- func (c NSCoreDataCoreSpotlightDelegate) InitForStoreWithDescriptionCoordinator(description INSPersistentStoreDescription, psc INSPersistentStoreCoordinator) NSCoreDataCoreSpotlightDelegate
- func (c NSCoreDataCoreSpotlightDelegate) IsIndexingEnabled() bool
- func (c NSCoreDataCoreSpotlightDelegate) SearchableIndexReindexAllSearchableItemsWithAcknowledgementHandler(searchableIndex *corespotlight.CSSearchableIndex, ...)
- func (c NSCoreDataCoreSpotlightDelegate) SearchableIndexReindexAllSearchableItemsWithAcknowledgementHandlerSync(ctx context.Context, searchableIndex *corespotlight.CSSearchableIndex) error
- func (c NSCoreDataCoreSpotlightDelegate) SearchableIndexReindexSearchableItemsWithIdentifiersAcknowledgementHandler(searchableIndex *corespotlight.CSSearchableIndex, identifiers []string, ...)
- func (c NSCoreDataCoreSpotlightDelegate) StartSpotlightIndexing()
- func (c NSCoreDataCoreSpotlightDelegate) StopSpotlightIndexing()
- type NSCoreDataCoreSpotlightDelegateClass
- type NSCustomMigrationStage
- func (c NSCustomMigrationStage) Autorelease() NSCustomMigrationStage
- func (c NSCustomMigrationStage) CurrentModel() INSManagedObjectModelReference
- func (c NSCustomMigrationStage) DidMigrateHandler() objectivec.IObject
- func (c NSCustomMigrationStage) Init() NSCustomMigrationStage
- func (c NSCustomMigrationStage) NextModel() INSManagedObjectModelReference
- func (c NSCustomMigrationStage) SetDidMigrateHandler(value objectivec.IObject)
- func (c NSCustomMigrationStage) SetWillMigrateHandler(value objectivec.IObject)
- func (c NSCustomMigrationStage) WillMigrateHandler() objectivec.IObject
- type NSCustomMigrationStageClass
- type NSDeleteRule
- type NSDerivedAttributeDescription
- func (d NSDerivedAttributeDescription) Autorelease() NSDerivedAttributeDescription
- func (d NSDerivedAttributeDescription) DerivationExpression() foundation.NSExpression
- func (d NSDerivedAttributeDescription) Init() NSDerivedAttributeDescription
- func (d NSDerivedAttributeDescription) SetDerivationExpression(value foundation.NSExpression)
- type NSDerivedAttributeDescriptionClass
- type NSEntityDescription
- func (e NSEntityDescription) AttributesByName() foundation.INSDictionary
- func (e NSEntityDescription) Autorelease() NSEntityDescription
- func (e NSEntityDescription) CoreSpotlightDisplayNameExpression() foundation.NSExpression
- func (e NSEntityDescription) EncodeWithCoder(coder foundation.INSCoder)
- func (e NSEntityDescription) Indexes() []NSFetchIndexDescription
- func (e NSEntityDescription) Init() NSEntityDescription
- func (e NSEntityDescription) IsAbstract() bool
- func (e NSEntityDescription) IsKindOfEntity(entity INSEntityDescription) bool
- func (e NSEntityDescription) ManagedObjectClassName() string
- func (e NSEntityDescription) ManagedObjectModel() INSManagedObjectModel
- func (e NSEntityDescription) Name() string
- func (e NSEntityDescription) Properties() []NSPropertyDescription
- func (e NSEntityDescription) PropertiesByName() foundation.INSDictionary
- func (e NSEntityDescription) RelationshipsByName() foundation.INSDictionary
- func (e NSEntityDescription) RelationshipsWithDestinationEntity(entity INSEntityDescription) []NSRelationshipDescription
- func (e NSEntityDescription) RenamingIdentifier() string
- func (e NSEntityDescription) SetAbstract(value bool)
- func (e NSEntityDescription) SetCoreSpotlightDisplayNameExpression(value foundation.NSExpression)
- func (e NSEntityDescription) SetIndexes(value []NSFetchIndexDescription)
- func (e NSEntityDescription) SetManagedObjectClassName(value string)
- func (e NSEntityDescription) SetName(value string)
- func (e NSEntityDescription) SetProperties(value []NSPropertyDescription)
- func (e NSEntityDescription) SetRenamingIdentifier(value string)
- func (e NSEntityDescription) SetSubentities(value []NSEntityDescription)
- func (e NSEntityDescription) SetUniquenessConstraints(value []foundation.NSArray)
- func (e NSEntityDescription) SetUserInfo(value foundation.INSDictionary)
- func (e NSEntityDescription) SetVersionHashModifier(value string)
- func (e NSEntityDescription) Subentities() []NSEntityDescription
- func (e NSEntityDescription) SubentitiesByName() foundation.INSDictionary
- func (e NSEntityDescription) Superentity() INSEntityDescription
- func (e NSEntityDescription) UniquenessConstraints() []foundation.NSArray
- func (e NSEntityDescription) UserInfo() foundation.INSDictionary
- func (e NSEntityDescription) VersionHash() foundation.NSData
- func (e NSEntityDescription) VersionHashModifier() string
- type NSEntityDescriptionClass
- func (nc NSEntityDescriptionClass) Alloc() NSEntityDescription
- func (nc NSEntityDescriptionClass) Class() objc.Class
- func (_NSEntityDescriptionClass NSEntityDescriptionClass) EntityForNameInManagedObjectContext(entityName string, context INSManagedObjectContext) NSEntityDescription
- func (_NSEntityDescriptionClass NSEntityDescriptionClass) InsertNewObjectForEntityForNameInManagedObjectContext(entityName string, context INSManagedObjectContext) NSManagedObject
- type NSEntityMapping
- func (e NSEntityMapping) AttributeMappings() []NSPropertyMapping
- func (e NSEntityMapping) Autorelease() NSEntityMapping
- func (e NSEntityMapping) DestinationEntityName() string
- func (e NSEntityMapping) DestinationEntityVersionHash() foundation.NSData
- func (e NSEntityMapping) EntityMigrationPolicyClassName() string
- func (e NSEntityMapping) Init() NSEntityMapping
- func (e NSEntityMapping) MappingType() NSEntityMappingType
- func (e NSEntityMapping) Name() string
- func (e NSEntityMapping) RelationshipMappings() []NSPropertyMapping
- func (e NSEntityMapping) SetAttributeMappings(value []NSPropertyMapping)
- func (e NSEntityMapping) SetDestinationEntityName(value string)
- func (e NSEntityMapping) SetDestinationEntityVersionHash(value foundation.NSData)
- func (e NSEntityMapping) SetEntityMigrationPolicyClassName(value string)
- func (e NSEntityMapping) SetMappingType(value NSEntityMappingType)
- func (e NSEntityMapping) SetName(value string)
- func (e NSEntityMapping) SetRelationshipMappings(value []NSPropertyMapping)
- func (e NSEntityMapping) SetSourceEntityName(value string)
- func (e NSEntityMapping) SetSourceEntityVersionHash(value foundation.NSData)
- func (e NSEntityMapping) SetSourceExpression(value foundation.NSExpression)
- func (e NSEntityMapping) SetUserInfo(value foundation.INSDictionary)
- func (e NSEntityMapping) SourceEntityName() string
- func (e NSEntityMapping) SourceEntityVersionHash() foundation.NSData
- func (e NSEntityMapping) SourceExpression() foundation.NSExpression
- func (e NSEntityMapping) UserInfo() foundation.INSDictionary
- type NSEntityMappingClass
- type NSEntityMappingType
- type NSEntityMigrationPolicy
- func (e NSEntityMigrationPolicy) Autorelease() NSEntityMigrationPolicy
- func (e NSEntityMigrationPolicy) BeginEntityMappingManagerError(mapping INSEntityMapping, manager INSMigrationManager) (bool, error)
- func (e NSEntityMigrationPolicy) CreateDestinationInstancesForSourceInstanceEntityMappingManagerError(sInstance INSManagedObject, mapping INSEntityMapping, ...) (bool, error)
- func (e NSEntityMigrationPolicy) CreateRelationshipsForDestinationInstanceEntityMappingManagerError(dInstance INSManagedObject, mapping INSEntityMapping, ...) (bool, error)
- func (e NSEntityMigrationPolicy) EndEntityMappingManagerError(mapping INSEntityMapping, manager INSMigrationManager) (bool, error)
- func (e NSEntityMigrationPolicy) EndInstanceCreationForEntityMappingManagerError(mapping INSEntityMapping, manager INSMigrationManager) (bool, error)
- func (e NSEntityMigrationPolicy) EndRelationshipCreationForEntityMappingManagerError(mapping INSEntityMapping, manager INSMigrationManager) (bool, error)
- func (e NSEntityMigrationPolicy) Init() NSEntityMigrationPolicy
- func (e NSEntityMigrationPolicy) PerformCustomValidationForEntityMappingManagerError(mapping INSEntityMapping, manager INSMigrationManager) (bool, error)
- type NSEntityMigrationPolicyClass
- type NSExpression
- type NSExpressionDescription
- func (e NSExpressionDescription) Autorelease() NSExpressionDescription
- func (e NSExpressionDescription) Expression() foundation.NSExpression
- func (e NSExpressionDescription) ExpressionResultType() NSAttributeType
- func (e NSExpressionDescription) Init() NSExpressionDescription
- func (e NSExpressionDescription) SetExpression(value foundation.NSExpression)
- func (e NSExpressionDescription) SetExpressionResultType(value NSAttributeType)
- type NSExpressionDescriptionClass
- type NSFetchIndexDescription
- func (f NSFetchIndexDescription) Autorelease() NSFetchIndexDescription
- func (f NSFetchIndexDescription) Elements() []NSFetchIndexElementDescription
- func (f NSFetchIndexDescription) EncodeWithCoder(coder foundation.INSCoder)
- func (f NSFetchIndexDescription) Entity() INSEntityDescription
- func (f NSFetchIndexDescription) Init() NSFetchIndexDescription
- func (f NSFetchIndexDescription) InitWithNameElements(name string, elements []NSFetchIndexElementDescription) NSFetchIndexDescription
- func (f NSFetchIndexDescription) Name() string
- func (f NSFetchIndexDescription) PartialIndexPredicate() foundation.NSPredicate
- func (f NSFetchIndexDescription) SetElements(value []NSFetchIndexElementDescription)
- func (f NSFetchIndexDescription) SetName(value string)
- func (f NSFetchIndexDescription) SetPartialIndexPredicate(value foundation.NSPredicate)
- type NSFetchIndexDescriptionClass
- type NSFetchIndexElementDescription
- func NSFetchIndexElementDescriptionFromID(id objc.ID) NSFetchIndexElementDescription
- func NewFetchIndexElementDescriptionWithPropertyCollationType(property INSPropertyDescription, collationType NSFetchIndexElementType) NSFetchIndexElementDescription
- func NewNSFetchIndexElementDescription() NSFetchIndexElementDescription
- func (f NSFetchIndexElementDescription) Autorelease() NSFetchIndexElementDescription
- func (f NSFetchIndexElementDescription) CollationType() NSFetchIndexElementType
- func (f NSFetchIndexElementDescription) EncodeWithCoder(coder foundation.INSCoder)
- func (f NSFetchIndexElementDescription) IndexDescription() INSFetchIndexDescription
- func (f NSFetchIndexElementDescription) Init() NSFetchIndexElementDescription
- func (f NSFetchIndexElementDescription) InitWithPropertyCollationType(property INSPropertyDescription, collationType NSFetchIndexElementType) NSFetchIndexElementDescription
- func (f NSFetchIndexElementDescription) IsAscending() bool
- func (f NSFetchIndexElementDescription) Property() INSPropertyDescription
- func (f NSFetchIndexElementDescription) PropertyName() string
- func (f NSFetchIndexElementDescription) SetAscending(value bool)
- func (f NSFetchIndexElementDescription) SetCollationType(value NSFetchIndexElementType)
- type NSFetchIndexElementDescriptionClass
- type NSFetchIndexElementType
- type NSFetchRequest
- func (f NSFetchRequest) Autorelease() NSFetchRequest
- func (f NSFetchRequest) Entity() INSEntityDescription
- func (f NSFetchRequest) EntityName() string
- func (f NSFetchRequest) Execute() ([]objectivec.IObject, error)
- func (f NSFetchRequest) FetchBatchSize() uint
- func (f NSFetchRequest) FetchLimit() uint
- func (f NSFetchRequest) FetchOffset() uint
- func (f NSFetchRequest) HavingPredicate() foundation.NSPredicate
- func (f NSFetchRequest) IncludesPendingChanges() bool
- func (f NSFetchRequest) IncludesPropertyValues() bool
- func (f NSFetchRequest) IncludesSubentities() bool
- func (f NSFetchRequest) Init() NSFetchRequest
- func (f NSFetchRequest) InitWithEntityName(entityName string) NSFetchRequest
- func (f NSFetchRequest) Predicate() foundation.NSPredicate
- func (f NSFetchRequest) PropertiesToFetch() foundation.INSArray
- func (f NSFetchRequest) PropertiesToGroupBy() foundation.INSArray
- func (f NSFetchRequest) RelationshipKeyPathsForPrefetching() []string
- func (f NSFetchRequest) ResultType() NSFetchRequestResultType
- func (f NSFetchRequest) ReturnsDistinctResults() bool
- func (f NSFetchRequest) ReturnsObjectsAsFaults() bool
- func (f NSFetchRequest) SetEntity(value INSEntityDescription)
- func (f NSFetchRequest) SetFetchBatchSize(value uint)
- func (f NSFetchRequest) SetFetchLimit(value uint)
- func (f NSFetchRequest) SetFetchOffset(value uint)
- func (f NSFetchRequest) SetHavingPredicate(value foundation.NSPredicate)
- func (f NSFetchRequest) SetIncludesPendingChanges(value bool)
- func (f NSFetchRequest) SetIncludesPropertyValues(value bool)
- func (f NSFetchRequest) SetIncludesSubentities(value bool)
- func (f NSFetchRequest) SetPredicate(value foundation.NSPredicate)
- func (f NSFetchRequest) SetPropertiesToFetch(value foundation.INSArray)
- func (f NSFetchRequest) SetPropertiesToGroupBy(value foundation.INSArray)
- func (f NSFetchRequest) SetRelationshipKeyPathsForPrefetching(value []string)
- func (f NSFetchRequest) SetResultType(value NSFetchRequestResultType)
- func (f NSFetchRequest) SetReturnsDistinctResults(value bool)
- func (f NSFetchRequest) SetReturnsObjectsAsFaults(value bool)
- func (f NSFetchRequest) SetShouldRefreshRefetchedObjects(value bool)
- func (f NSFetchRequest) SetSortDescriptors(value []foundation.NSSortDescriptor)
- func (f NSFetchRequest) ShouldRefreshRefetchedObjects() bool
- func (f NSFetchRequest) SortDescriptors() []foundation.NSSortDescriptor
- type NSFetchRequestClass
- type NSFetchRequestExpression
- func (f NSFetchRequestExpression) Autorelease() NSFetchRequestExpression
- func (f NSFetchRequestExpression) ContextExpression() foundation.NSExpression
- func (f NSFetchRequestExpression) Init() NSFetchRequestExpression
- func (f NSFetchRequestExpression) IsCountOnlyRequest() bool
- func (f NSFetchRequestExpression) RequestExpression() foundation.NSExpression
- type NSFetchRequestExpressionClass
- func (nc NSFetchRequestExpressionClass) Alloc() NSFetchRequestExpression
- func (nc NSFetchRequestExpressionClass) Class() objc.Class
- func (_NSFetchRequestExpressionClass NSFetchRequestExpressionClass) ExpressionForFetchContextCountOnly(fetch foundation.NSExpression, context foundation.NSExpression, countFlag bool) foundation.NSExpression
- type NSFetchRequestResult
- type NSFetchRequestResultObject
- type NSFetchRequestResultType
- type NSFetchedPropertyDescription
- func (f NSFetchedPropertyDescription) Autorelease() NSFetchedPropertyDescription
- func (f NSFetchedPropertyDescription) FetchRequest() INSFetchRequest
- func (f NSFetchedPropertyDescription) Init() NSFetchedPropertyDescription
- func (f NSFetchedPropertyDescription) SetFetchRequest(value INSFetchRequest)
- type NSFetchedPropertyDescriptionClass
- type NSFetchedResultsChangeType
- type NSFetchedResultsController
- func NSFetchedResultsControllerFromID(id objc.ID) NSFetchedResultsController
- func NewFetchedResultsControllerWithFetchRequestManagedObjectContextSectionNameKeyPathCacheName(fetchRequest INSFetchRequest, context INSManagedObjectContext, ...) NSFetchedResultsController
- func NewNSFetchedResultsController() NSFetchedResultsController
- func (f NSFetchedResultsController) Autorelease() NSFetchedResultsController
- func (f NSFetchedResultsController) CacheName() string
- func (f NSFetchedResultsController) Delegate() NSFetchedResultsControllerDelegate
- func (f NSFetchedResultsController) FetchRequest() INSFetchRequest
- func (f NSFetchedResultsController) FetchedObjects() []objectivec.IObject
- func (f NSFetchedResultsController) IndexPathForObject(object unsafe.Pointer) foundation.NSIndexPath
- func (f NSFetchedResultsController) Init() NSFetchedResultsController
- func (f NSFetchedResultsController) InitWithFetchRequestManagedObjectContextSectionNameKeyPathCacheName(fetchRequest INSFetchRequest, context INSManagedObjectContext, ...) NSFetchedResultsController
- func (f NSFetchedResultsController) ManagedObjectContext() INSManagedObjectContext
- func (f NSFetchedResultsController) ObjectAtIndexPath(indexPath foundation.NSIndexPath) unsafe.Pointer
- func (f NSFetchedResultsController) PerformFetch() (bool, error)
- func (f NSFetchedResultsController) SectionForSectionIndexTitleAtIndex(title string, sectionIndex int) int
- func (f NSFetchedResultsController) SectionIndexTitleForSectionName(sectionName string) string
- func (f NSFetchedResultsController) SectionIndexTitles() []string
- func (f NSFetchedResultsController) SectionNameKeyPath() string
- func (f NSFetchedResultsController) Sections() []objectivec.IObject
- func (f NSFetchedResultsController) SetDelegate(value NSFetchedResultsControllerDelegate)
- type NSFetchedResultsControllerClass
- type NSFetchedResultsControllerDelegate
- type NSFetchedResultsControllerDelegateConfig
- type NSFetchedResultsControllerDelegateObject
- func (o NSFetchedResultsControllerDelegateObject) BaseObject() objectivec.Object
- func (o NSFetchedResultsControllerDelegateObject) ControllerDidChangeContent(controller INSFetchedResultsController)
- func (o NSFetchedResultsControllerDelegateObject) ControllerDidChangeContentWithDifference(controller INSFetchedResultsController, ...)
- func (o NSFetchedResultsControllerDelegateObject) ControllerDidChangeContentWithSnapshot(controller INSFetchedResultsController, snapshot objectivec.IObject)
- func (o NSFetchedResultsControllerDelegateObject) ControllerDidChangeObjectAtIndexPathForChangeTypeNewIndexPath(controller INSFetchedResultsController, anObject objectivec.IObject, ...)
- func (o NSFetchedResultsControllerDelegateObject) ControllerDidChangeSectionAtIndexForChangeType(controller INSFetchedResultsController, ...)
- func (o NSFetchedResultsControllerDelegateObject) ControllerSectionIndexTitleForSectionName(controller INSFetchedResultsController, sectionName string) string
- func (o NSFetchedResultsControllerDelegateObject) ControllerWillChangeContent(controller INSFetchedResultsController)
- type NSFetchedResultsSectionInfo
- type NSFetchedResultsSectionInfoObject
- func (o NSFetchedResultsSectionInfoObject) BaseObject() objectivec.Object
- func (o NSFetchedResultsSectionInfoObject) IndexTitle() string
- func (o NSFetchedResultsSectionInfoObject) Name() string
- func (o NSFetchedResultsSectionInfoObject) NumberOfObjects() uint
- func (o NSFetchedResultsSectionInfoObject) Objects() foundation.INSArray
- type NSIncrementalStore
- func (i NSIncrementalStore) Autorelease() NSIncrementalStore
- func (i NSIncrementalStore) ExecuteRequestWithContextError(request INSPersistentStoreRequest, context INSManagedObjectContext) (objectivec.IObject, error)
- func (i NSIncrementalStore) Init() NSIncrementalStore
- func (i NSIncrementalStore) ManagedObjectContextDidRegisterObjectsWithIDs(objectIDs []NSManagedObjectID)
- func (i NSIncrementalStore) ManagedObjectContextDidUnregisterObjectsWithIDs(objectIDs []NSManagedObjectID)
- func (i NSIncrementalStore) NewObjectIDForEntityReferenceObject(entity INSEntityDescription, data objectivec.IObject) INSManagedObjectID
- func (i NSIncrementalStore) NewValueForRelationshipForObjectWithIDWithContextError(relationship INSRelationshipDescription, objectID INSManagedObjectID, ...) (objectivec.IObject, error)
- func (i NSIncrementalStore) NewValuesForObjectWithIDWithContextError(objectID INSManagedObjectID, context INSManagedObjectContext) (INSIncrementalStoreNode, error)
- func (i NSIncrementalStore) ObtainPermanentIDsForObjectsError(array []NSManagedObject) ([]NSManagedObjectID, error)
- func (i NSIncrementalStore) ReferenceObjectForObjectID(objectID INSManagedObjectID) objectivec.IObject
- type NSIncrementalStoreClass
- type NSIncrementalStoreNode
- func (i NSIncrementalStoreNode) Autorelease() NSIncrementalStoreNode
- func (i NSIncrementalStoreNode) Init() NSIncrementalStoreNode
- func (i NSIncrementalStoreNode) InitWithObjectIDWithValuesVersion(objectID INSManagedObjectID, values foundation.INSDictionary, version uint64) NSIncrementalStoreNode
- func (i NSIncrementalStoreNode) ObjectID() INSManagedObjectID
- func (i NSIncrementalStoreNode) UpdateWithValuesVersion(values foundation.INSDictionary, version uint64)
- func (i NSIncrementalStoreNode) ValueForPropertyDescription(prop INSPropertyDescription) objectivec.IObject
- func (i NSIncrementalStoreNode) Version() uint64
- type NSIncrementalStoreNodeClass
- type NSLightweightMigrationStage
- type NSLightweightMigrationStageClass
- type NSManagedObject
- func NSManagedObjectFromID(id objc.ID) NSManagedObject
- func NewManagedObjectWithContext(moc INSManagedObjectContext) NSManagedObject
- func NewManagedObjectWithEntityInsertIntoManagedObjectContext(entity INSEntityDescription, context INSManagedObjectContext) NSManagedObject
- func NewNSManagedObject() NSManagedObject
- func (m NSManagedObject) Autorelease() NSManagedObject
- func (m NSManagedObject) AwakeFromFetch()
- func (m NSManagedObject) AwakeFromInsert()
- func (m NSManagedObject) AwakeFromSnapshotEvents(flags NSSnapshotEventType)
- func (m NSManagedObject) ChangedValues() foundation.INSDictionary
- func (m NSManagedObject) ChangedValuesForCurrentEvent() foundation.INSDictionary
- func (m NSManagedObject) CommittedValuesForKeys(keys []string) foundation.INSDictionary
- func (m NSManagedObject) DidAccessValueForKey(key string)
- func (m NSManagedObject) DidChangeValueForKeyWithSetMutationUsingObjects(inKey string, inMutationKind uint, inObjects foundation.INSSet)
- func (m NSManagedObject) DidSave()
- func (m NSManagedObject) DidTurnIntoFault()
- func (m NSManagedObject) Entity() INSEntityDescription
- func (m NSManagedObject) FaultingState() uint
- func (m NSManagedObject) HasChanges() bool
- func (m NSManagedObject) HasFaultForRelationshipNamed(key string) bool
- func (m NSManagedObject) HasPersistentChangedValues() bool
- func (m NSManagedObject) Init() NSManagedObject
- func (m NSManagedObject) InitWithContext(moc INSManagedObjectContext) NSManagedObject
- func (m NSManagedObject) InitWithEntityInsertIntoManagedObjectContext(entity INSEntityDescription, context INSManagedObjectContext) NSManagedObject
- func (m NSManagedObject) IsDeleted() bool
- func (m NSManagedObject) IsFault() bool
- func (m NSManagedObject) IsInserted() bool
- func (m NSManagedObject) IsUpdated() bool
- func (m NSManagedObject) ManagedObjectContext() INSManagedObjectContext
- func (m NSManagedObject) ObjectID() INSManagedObjectID
- func (m NSManagedObject) ObjectIDsForRelationshipNamed(key string) []NSManagedObjectID
- func (m NSManagedObject) ObservationInfo() unsafe.Pointer
- func (m NSManagedObject) PrepareForDeletion()
- func (m NSManagedObject) PrimitiveValueForKey(key string) objectivec.IObject
- func (m NSManagedObject) SetObservationInfo(inObservationInfo unsafe.Pointer)
- func (m NSManagedObject) SetPrimitiveValueForKey(value objectivec.IObject, key string)
- func (m NSManagedObject) ValidateForDelete() (bool, error)
- func (m NSManagedObject) ValidateForInsert() (bool, error)
- func (m NSManagedObject) ValidateForUpdate() (bool, error)
- func (m NSManagedObject) WillAccessValueForKey(key string)
- func (m NSManagedObject) WillChangeValueForKeyWithSetMutationUsingObjects(inKey string, inMutationKind uint, inObjects foundation.INSSet)
- func (m NSManagedObject) WillSave()
- func (m NSManagedObject) WillTurnIntoFault()
- type NSManagedObjectClass
- func (nc NSManagedObjectClass) Alloc() NSManagedObject
- func (nc NSManagedObjectClass) Class() objc.Class
- func (_NSManagedObjectClass NSManagedObjectClass) ContextShouldIgnoreUnmodeledPropertyChanges() bool
- func (_NSManagedObjectClass NSManagedObjectClass) Entity() NSEntityDescription
- func (_NSManagedObjectClass NSManagedObjectClass) FetchRequest() NSFetchRequest
- type NSManagedObjectContext
- func (m NSManagedObjectContext) AssignObjectToPersistentStore(object objectivec.IObject, store INSPersistentStore)
- func (m NSManagedObjectContext) AutomaticallyMergesChangesFromParent() bool
- func (m NSManagedObjectContext) Autorelease() NSManagedObjectContext
- func (m NSManagedObjectContext) ConcurrencyType() NSManagedObjectContextConcurrencyType
- func (m NSManagedObjectContext) CountForFetchRequestError(request INSFetchRequest) (uint, error)
- func (m NSManagedObjectContext) DeleteObject(object INSManagedObject)
- func (m NSManagedObjectContext) DeletedObjects() foundation.INSSet
- func (m NSManagedObjectContext) DetectConflictsForObject(object INSManagedObject)
- func (m NSManagedObjectContext) EncodeWithCoder(coder foundation.INSCoder)
- func (m NSManagedObjectContext) ExecuteRequestError(request INSPersistentStoreRequest) (INSPersistentStoreResult, error)
- func (m NSManagedObjectContext) ExistingObjectWithIDError(objectID INSManagedObjectID) (INSManagedObject, error)
- func (m NSManagedObjectContext) HasChanges() bool
- func (m NSManagedObjectContext) Init() NSManagedObjectContext
- func (m NSManagedObjectContext) InitWithConcurrencyType(ct NSManagedObjectContextConcurrencyType) NSManagedObjectContext
- func (m NSManagedObjectContext) InsertObject(object INSManagedObject)
- func (m NSManagedObjectContext) InsertedObjects() foundation.INSSet
- func (m NSManagedObjectContext) MergeChangesFromContextDidSaveNotification(notification foundation.NSNotification)
- func (m NSManagedObjectContext) MergePolicy() objectivec.IObject
- func (m NSManagedObjectContext) Name() string
- func (m NSManagedObjectContext) ObjectRegisteredForID(objectID INSManagedObjectID) INSManagedObject
- func (m NSManagedObjectContext) ObjectWithID(objectID INSManagedObjectID) INSManagedObject
- func (m NSManagedObjectContext) ObtainPermanentIDsForObjectsError(objects []NSManagedObject) (bool, error)
- func (m NSManagedObjectContext) ParentContext() INSManagedObjectContext
- func (m NSManagedObjectContext) PerformBlock(block VoidHandler)
- func (m NSManagedObjectContext) PerformBlockAndWait(block VoidHandler)
- func (m NSManagedObjectContext) PerformBlockAndWaitSync(ctx context.Context) error
- func (m NSManagedObjectContext) PerformBlockSync(ctx context.Context) error
- func (m NSManagedObjectContext) PersistentStoreCoordinator() INSPersistentStoreCoordinator
- func (m NSManagedObjectContext) ProcessPendingChanges()
- func (m NSManagedObjectContext) PropagatesDeletesAtEndOfEvent() bool
- func (m NSManagedObjectContext) QueryGenerationToken() INSQueryGenerationToken
- func (m NSManagedObjectContext) Redo()
- func (m NSManagedObjectContext) RefreshAllObjects()
- func (m NSManagedObjectContext) RefreshObjectMergeChanges(object INSManagedObject, flag bool)
- func (m NSManagedObjectContext) RegisteredObjects() foundation.INSSet
- func (m NSManagedObjectContext) Reset()
- func (m NSManagedObjectContext) RetainsRegisteredObjects() bool
- func (m NSManagedObjectContext) Rollback()
- func (m NSManagedObjectContext) Save() (bool, error)
- func (m NSManagedObjectContext) SetAutomaticallyMergesChangesFromParent(value bool)
- func (m NSManagedObjectContext) SetMergePolicy(value objectivec.IObject)
- func (m NSManagedObjectContext) SetName(value string)
- func (m NSManagedObjectContext) SetParentContext(value INSManagedObjectContext)
- func (m NSManagedObjectContext) SetPersistentStoreCoordinator(value INSPersistentStoreCoordinator)
- func (m NSManagedObjectContext) SetPropagatesDeletesAtEndOfEvent(value bool)
- func (m NSManagedObjectContext) SetQueryGenerationFromTokenError(generation INSQueryGenerationToken) (bool, error)
- func (m NSManagedObjectContext) SetRetainsRegisteredObjects(value bool)
- func (m NSManagedObjectContext) SetShouldDeleteInaccessibleFaults(value bool)
- func (m NSManagedObjectContext) SetStalenessInterval(value foundation.NSTimeInterval)
- func (m NSManagedObjectContext) SetTransactionAuthor(value string)
- func (m NSManagedObjectContext) SetUndoManager(value foundation.UndoManager)
- func (m NSManagedObjectContext) ShouldDeleteInaccessibleFaults() bool
- func (m NSManagedObjectContext) ShouldHandleInaccessibleFaultForObjectIDTriggeredByProperty(fault INSManagedObject, oid INSManagedObjectID, ...) bool
- func (m NSManagedObjectContext) StalenessInterval() foundation.NSTimeInterval
- func (m NSManagedObjectContext) TransactionAuthor() string
- func (m NSManagedObjectContext) Undo()
- func (m NSManagedObjectContext) UndoManager() foundation.UndoManager
- func (m NSManagedObjectContext) UpdatedObjects() foundation.INSSet
- func (m NSManagedObjectContext) UserInfo() foundation.INSDictionary
- type NSManagedObjectContextClass
- type NSManagedObjectContextConcurrencyType
- type NSManagedObjectID
- func (m NSManagedObjectID) Autorelease() NSManagedObjectID
- func (m NSManagedObjectID) Entity() INSEntityDescription
- func (m NSManagedObjectID) Init() NSManagedObjectID
- func (m NSManagedObjectID) IsTemporaryID() bool
- func (m NSManagedObjectID) PersistentStore() INSPersistentStore
- func (m NSManagedObjectID) URIRepresentation() foundation.NSURL
- type NSManagedObjectIDClass
- type NSManagedObjectModel
- func NSManagedObjectModelFromID(id objc.ID) NSManagedObjectModel
- func NewManagedObjectModelByMergingModels(models []NSManagedObjectModel) NSManagedObjectModel
- func NewManagedObjectModelByMergingModelsForStoreMetadata(models []NSManagedObjectModel, metadata foundation.INSDictionary) NSManagedObjectModel
- func NewManagedObjectModelWithContentsOfURL(url foundation.NSURL) NSManagedObjectModel
- func NewNSManagedObjectModel() NSManagedObjectModel
- func (m NSManagedObjectModel) Autorelease() NSManagedObjectModel
- func (m NSManagedObjectModel) Configurations() []string
- func (m NSManagedObjectModel) EncodeWithCoder(coder foundation.INSCoder)
- func (m NSManagedObjectModel) Entities() []NSEntityDescription
- func (m NSManagedObjectModel) EntitiesByName() foundation.INSDictionary
- func (m NSManagedObjectModel) EntitiesForConfiguration(configuration string) []NSEntityDescription
- func (m NSManagedObjectModel) EntityVersionHashesByName() foundation.INSDictionary
- func (m NSManagedObjectModel) FetchRequestFromTemplateWithNameSubstitutionVariables(name string, variables foundation.INSDictionary) INSFetchRequest
- func (m NSManagedObjectModel) FetchRequestTemplateForName(name string) INSFetchRequest
- func (m NSManagedObjectModel) FetchRequestTemplatesByName() foundation.INSDictionary
- func (m NSManagedObjectModel) Init() NSManagedObjectModel
- func (m NSManagedObjectModel) InitWithContentsOfURL(url foundation.NSURL) NSManagedObjectModel
- func (m NSManagedObjectModel) IsConfigurationCompatibleWithStoreMetadata(configuration string, metadata foundation.INSDictionary) bool
- func (m NSManagedObjectModel) LocalizationDictionary() foundation.INSDictionary
- func (m NSManagedObjectModel) SetEntities(value []NSEntityDescription)
- func (m NSManagedObjectModel) SetEntitiesForConfiguration(entities []NSEntityDescription, configuration string)
- func (m NSManagedObjectModel) SetFetchRequestTemplateForName(fetchRequestTemplate INSFetchRequest, name string)
- func (m NSManagedObjectModel) SetLocalizationDictionary(value foundation.INSDictionary)
- func (m NSManagedObjectModel) SetVersionIdentifiers(value foundation.INSSet)
- func (m NSManagedObjectModel) VersionChecksum() string
- func (m NSManagedObjectModel) VersionIdentifiers() foundation.INSSet
- type NSManagedObjectModelClass
- func (nc NSManagedObjectModelClass) Alloc() NSManagedObjectModel
- func (nc NSManagedObjectModelClass) Class() objc.Class
- func (_NSManagedObjectModelClass NSManagedObjectModelClass) MergedModelFromBundles(bundles []foundation.NSBundle) NSManagedObjectModel
- func (_NSManagedObjectModelClass NSManagedObjectModelClass) MergedModelFromBundlesForStoreMetadata(bundles []foundation.NSBundle, metadata foundation.INSDictionary) NSManagedObjectModel
- type NSManagedObjectModelReference
- func NSManagedObjectModelReferenceFromID(id objc.ID) NSManagedObjectModelReference
- func NewManagedObjectModelReferenceWithEntityVersionHashesInBundleVersionChecksum(versionHash foundation.INSDictionary, bundle foundation.NSBundle, ...) NSManagedObjectModelReference
- func NewManagedObjectModelReferenceWithFileURLVersionChecksum(fileURL foundation.NSURL, versionChecksum string) NSManagedObjectModelReference
- func NewManagedObjectModelReferenceWithModelVersionChecksum(model INSManagedObjectModel, versionChecksum string) NSManagedObjectModelReference
- func NewManagedObjectModelReferenceWithNameInBundleVersionChecksum(modelName string, bundle foundation.NSBundle, versionChecksum string) NSManagedObjectModelReference
- func NewNSManagedObjectModelReference() NSManagedObjectModelReference
- func (m NSManagedObjectModelReference) Autorelease() NSManagedObjectModelReference
- func (m NSManagedObjectModelReference) Init() NSManagedObjectModelReference
- func (m NSManagedObjectModelReference) InitWithEntityVersionHashesInBundleVersionChecksum(versionHash foundation.INSDictionary, bundle foundation.NSBundle, ...) NSManagedObjectModelReference
- func (m NSManagedObjectModelReference) InitWithFileURLVersionChecksum(fileURL foundation.NSURL, versionChecksum string) NSManagedObjectModelReference
- func (m NSManagedObjectModelReference) InitWithModelVersionChecksum(model INSManagedObjectModel, versionChecksum string) NSManagedObjectModelReference
- func (m NSManagedObjectModelReference) InitWithNameInBundleVersionChecksum(modelName string, bundle foundation.NSBundle, versionChecksum string) NSManagedObjectModelReference
- func (m NSManagedObjectModelReference) ResolvedModel() INSManagedObjectModel
- func (m NSManagedObjectModelReference) VersionChecksum() string
- type NSManagedObjectModelReferenceClass
- type NSManagedObjectValidationErrorConstants
- type NSMappingModel
- func NSMappingModelFromID(id objc.ID) NSMappingModel
- func NewMappingModelFromBundlesForSourceModelDestinationModel(bundles []foundation.NSBundle, sourceModel INSManagedObjectModel, ...) NSMappingModel
- func NewMappingModelWithContentsOfURL(url foundation.NSURL) NSMappingModel
- func NewNSMappingModel() NSMappingModel
- func (m NSMappingModel) Autorelease() NSMappingModel
- func (m NSMappingModel) EntityMappings() []NSEntityMapping
- func (m NSMappingModel) EntityMappingsByName() foundation.INSDictionary
- func (m NSMappingModel) Init() NSMappingModel
- func (m NSMappingModel) InitWithContentsOfURL(url foundation.NSURL) NSMappingModel
- func (m NSMappingModel) SetEntityMappings(value []NSEntityMapping)
- type NSMappingModelClass
- func (nc NSMappingModelClass) Alloc() NSMappingModel
- func (nc NSMappingModelClass) Class() objc.Class
- func (_NSMappingModelClass NSMappingModelClass) InferredMappingModelForSourceModelDestinationModelError(sourceModel INSManagedObjectModel, destinationModel INSManagedObjectModel) (NSMappingModel, error)
- type NSMergeConflict
- func (m NSMergeConflict) Autorelease() NSMergeConflict
- func (m NSMergeConflict) CachedSnapshot() foundation.INSDictionary
- func (m NSMergeConflict) Init() NSMergeConflict
- func (m NSMergeConflict) InitWithSourceNewVersionOldVersionCachedSnapshotPersistedSnapshot(srcObject INSManagedObject, newvers uint, oldvers uint, ...) NSMergeConflict
- func (m NSMergeConflict) NewVersionNumber() uint
- func (m NSMergeConflict) ObjectSnapshot() foundation.INSDictionary
- func (m NSMergeConflict) OldVersionNumber() uint
- func (m NSMergeConflict) PersistedSnapshot() foundation.INSDictionary
- func (m NSMergeConflict) SourceObject() INSManagedObject
- type NSMergeConflictClass
- type NSMergePolicy
- func (m NSMergePolicy) Autorelease() NSMergePolicy
- func (m NSMergePolicy) Init() NSMergePolicy
- func (m NSMergePolicy) InitWithMergeType(ty NSMergePolicyType) NSMergePolicy
- func (m NSMergePolicy) MergeType() NSMergePolicyType
- func (m NSMergePolicy) ResolveConflictsError(list foundation.INSArray) (bool, error)
- func (m NSMergePolicy) ResolveConstraintConflictsError(list []NSConstraintConflict) (bool, error)
- func (m NSMergePolicy) ResolveOptimisticLockingVersionConflictsError(list []NSMergeConflict) (bool, error)
- type NSMergePolicyClass
- func (nc NSMergePolicyClass) Alloc() NSMergePolicy
- func (nc NSMergePolicyClass) Class() objc.Class
- func (_NSMergePolicyClass NSMergePolicyClass) ErrorMergePolicy() NSMergePolicy
- func (_NSMergePolicyClass NSMergePolicyClass) MergeByPropertyObjectTrumpMergePolicy() NSMergePolicy
- func (_NSMergePolicyClass NSMergePolicyClass) MergeByPropertyStoreTrumpMergePolicy() NSMergePolicy
- func (_NSMergePolicyClass NSMergePolicyClass) OverwriteMergePolicy() NSMergePolicy
- func (_NSMergePolicyClass NSMergePolicyClass) RollbackMergePolicy() NSMergePolicy
- type NSMergePolicyType
- type NSMigrationManager
- func (m NSMigrationManager) AssociateSourceInstanceWithDestinationInstanceForEntityMapping(sourceInstance INSManagedObject, destinationInstance INSManagedObject, ...)
- func (m NSMigrationManager) Autorelease() NSMigrationManager
- func (m NSMigrationManager) CancelMigrationWithError(error_ foundation.NSError)
- func (m NSMigrationManager) CurrentEntityMapping() INSEntityMapping
- func (m NSMigrationManager) DestinationContext() INSManagedObjectContext
- func (m NSMigrationManager) DestinationEntityForEntityMapping(mEntity INSEntityMapping) INSEntityDescription
- func (m NSMigrationManager) DestinationInstancesForEntityMappingNamedSourceInstances(mappingName string, sourceInstances []NSManagedObject) []NSManagedObject
- func (m NSMigrationManager) DestinationModel() INSManagedObjectModel
- func (m NSMigrationManager) Init() NSMigrationManager
- func (m NSMigrationManager) InitWithSourceModelDestinationModel(sourceModel INSManagedObjectModel, destinationModel INSManagedObjectModel) NSMigrationManager
- func (m NSMigrationManager) MappingModel() INSMappingModel
- func (m NSMigrationManager) MigrateStoreFromURLTypeOptionsWithMappingModelToDestinationURLDestinationTypeDestinationOptionsError(sourceURL foundation.NSURL, sStoreType string, ...) (bool, error)
- func (m NSMigrationManager) MigrationProgress() float32
- func (m NSMigrationManager) Reset()
- func (m NSMigrationManager) SetUserInfo(value foundation.INSDictionary)
- func (m NSMigrationManager) SetUsesStoreSpecificMigrationManager(value bool)
- func (m NSMigrationManager) SourceContext() INSManagedObjectContext
- func (m NSMigrationManager) SourceEntityForEntityMapping(mEntity INSEntityMapping) INSEntityDescription
- func (m NSMigrationManager) SourceInstancesForEntityMappingNamedDestinationInstances(mappingName string, destinationInstances []NSManagedObject) []NSManagedObject
- func (m NSMigrationManager) SourceModel() INSManagedObjectModel
- func (m NSMigrationManager) UserInfo() foundation.INSDictionary
- func (m NSMigrationManager) UsesStoreSpecificMigrationManager() bool
- type NSMigrationManagerClass
- type NSMigrationStage
- type NSMigrationStageClass
- type NSPersistentCloudKitContainer
- func NSPersistentCloudKitContainerFromID(id objc.ID) NSPersistentCloudKitContainer
- func NewNSPersistentCloudKitContainer() NSPersistentCloudKitContainer
- func NewPersistentCloudKitContainerWithName(name string) NSPersistentCloudKitContainer
- func NewPersistentCloudKitContainerWithNameManagedObjectModel(name string, model INSManagedObjectModel) NSPersistentCloudKitContainer
- func (p NSPersistentCloudKitContainer) Autorelease() NSPersistentCloudKitContainer
- func (p NSPersistentCloudKitContainer) CanDeleteRecordForManagedObjectWithID(objectID INSManagedObjectID) bool
- func (p NSPersistentCloudKitContainer) CanModifyManagedObjectsInStore(store INSPersistentStore) bool
- func (p NSPersistentCloudKitContainer) CanUpdateRecordForManagedObjectWithID(objectID INSManagedObjectID) bool
- func (p NSPersistentCloudKitContainer) Init() NSPersistentCloudKitContainer
- func (p NSPersistentCloudKitContainer) InitializeCloudKitSchemaWithOptionsError(options NSPersistentCloudKitContainerSchemaInitializationOptions) (NSPersistentCloudKitContainer, error)
- type NSPersistentCloudKitContainerClass
- type NSPersistentCloudKitContainerEvent
- func (p NSPersistentCloudKitContainerEvent) Autorelease() NSPersistentCloudKitContainerEvent
- func (p NSPersistentCloudKitContainerEvent) EndDate() foundation.NSDate
- func (p NSPersistentCloudKitContainerEvent) Error() foundation.NSError
- func (p NSPersistentCloudKitContainerEvent) Identifier() foundation.NSUUID
- func (p NSPersistentCloudKitContainerEvent) Init() NSPersistentCloudKitContainerEvent
- func (p NSPersistentCloudKitContainerEvent) StartDate() foundation.NSDate
- func (p NSPersistentCloudKitContainerEvent) StoreIdentifier() string
- func (p NSPersistentCloudKitContainerEvent) Succeeded() bool
- func (p NSPersistentCloudKitContainerEvent) Type() NSPersistentCloudKitContainerEventType
- type NSPersistentCloudKitContainerEventClass
- type NSPersistentCloudKitContainerEventRequest
- func (p NSPersistentCloudKitContainerEventRequest) Autorelease() NSPersistentCloudKitContainerEventRequest
- func (p NSPersistentCloudKitContainerEventRequest) Init() NSPersistentCloudKitContainerEventRequest
- func (p NSPersistentCloudKitContainerEventRequest) ResultType() NSPersistentCloudKitContainerEventResultType
- func (p NSPersistentCloudKitContainerEventRequest) SetResultType(value NSPersistentCloudKitContainerEventResultType)
- type NSPersistentCloudKitContainerEventRequestClass
- func (nc NSPersistentCloudKitContainerEventRequestClass) Alloc() NSPersistentCloudKitContainerEventRequest
- func (nc NSPersistentCloudKitContainerEventRequestClass) Class() objc.Class
- func (_NSPersistentCloudKitContainerEventRequestClass NSPersistentCloudKitContainerEventRequestClass) FetchEventsAfterDate(date foundation.NSDate) NSPersistentCloudKitContainerEventRequest
- func (_NSPersistentCloudKitContainerEventRequestClass NSPersistentCloudKitContainerEventRequestClass) FetchEventsAfterEvent(event INSPersistentCloudKitContainerEvent) NSPersistentCloudKitContainerEventRequest
- func (_NSPersistentCloudKitContainerEventRequestClass NSPersistentCloudKitContainerEventRequestClass) FetchEventsMatchingFetchRequest(fetchRequest INSFetchRequest) NSPersistentCloudKitContainerEventRequest
- func (_NSPersistentCloudKitContainerEventRequestClass NSPersistentCloudKitContainerEventRequestClass) FetchRequestForEvents() NSFetchRequest
- type NSPersistentCloudKitContainerEventResult
- func (p NSPersistentCloudKitContainerEventResult) Autorelease() NSPersistentCloudKitContainerEventResult
- func (p NSPersistentCloudKitContainerEventResult) Init() NSPersistentCloudKitContainerEventResult
- func (p NSPersistentCloudKitContainerEventResult) Result() objectivec.IObject
- func (p NSPersistentCloudKitContainerEventResult) ResultType() NSPersistentCloudKitContainerEventResultType
- type NSPersistentCloudKitContainerEventResultClass
- type NSPersistentCloudKitContainerEventResultType
- type NSPersistentCloudKitContainerEventType
- type NSPersistentCloudKitContainerOptions
- func NSPersistentCloudKitContainerOptionsFromID(id objc.ID) NSPersistentCloudKitContainerOptions
- func NewNSPersistentCloudKitContainerOptions() NSPersistentCloudKitContainerOptions
- func NewPersistentCloudKitContainerOptionsWithContainerIdentifier(containerIdentifier string) NSPersistentCloudKitContainerOptions
- func (p NSPersistentCloudKitContainerOptions) Autorelease() NSPersistentCloudKitContainerOptions
- func (p NSPersistentCloudKitContainerOptions) ContainerIdentifier() string
- func (p NSPersistentCloudKitContainerOptions) DatabaseScope() uint
- func (p NSPersistentCloudKitContainerOptions) Init() NSPersistentCloudKitContainerOptions
- func (p NSPersistentCloudKitContainerOptions) InitWithContainerIdentifier(containerIdentifier string) NSPersistentCloudKitContainerOptions
- func (p NSPersistentCloudKitContainerOptions) SetDatabaseScope(value uint)
- type NSPersistentCloudKitContainerOptionsClass
- type NSPersistentCloudKitContainerSchemaInitializationOptions
- type NSPersistentContainer
- func NSPersistentContainerFromID(id objc.ID) NSPersistentContainer
- func NewNSPersistentContainer() NSPersistentContainer
- func NewPersistentContainerWithName(name string) NSPersistentContainer
- func NewPersistentContainerWithNameManagedObjectModel(name string, model INSManagedObjectModel) NSPersistentContainer
- func (p NSPersistentContainer) Autorelease() NSPersistentContainer
- func (p NSPersistentContainer) Init() NSPersistentContainer
- func (p NSPersistentContainer) InitWithName(name string) NSPersistentContainer
- func (p NSPersistentContainer) InitWithNameManagedObjectModel(name string, model INSManagedObjectModel) NSPersistentContainer
- func (p NSPersistentContainer) LoadPersistentStores(ctx context.Context) (*NSPersistentStoreDescription, error)
- func (p NSPersistentContainer) LoadPersistentStoresWithCompletionHandler(block PersistentStoreDescriptionErrorHandler)
- func (p NSPersistentContainer) ManagedObjectModel() INSManagedObjectModel
- func (p NSPersistentContainer) Name() string
- func (p NSPersistentContainer) NewBackgroundContext() INSManagedObjectContext
- func (p NSPersistentContainer) PerformBackgroundTask(block ManagedObjectContextHandler)
- func (p NSPersistentContainer) PerformBackgroundTaskSync(ctx context.Context) (*NSManagedObjectContext, error)
- func (p NSPersistentContainer) PersistentStoreCoordinator() INSPersistentStoreCoordinator
- func (p NSPersistentContainer) PersistentStoreDescriptions() []NSPersistentStoreDescription
- func (p NSPersistentContainer) SetPersistentStoreDescriptions(value []NSPersistentStoreDescription)
- func (p NSPersistentContainer) ViewContext() INSManagedObjectContext
- type NSPersistentContainerClass
- func (nc NSPersistentContainerClass) Alloc() NSPersistentContainer
- func (nc NSPersistentContainerClass) Class() objc.Class
- func (_NSPersistentContainerClass NSPersistentContainerClass) DefaultDirectoryURL() foundation.NSURL
- func (_NSPersistentContainerClass NSPersistentContainerClass) SetDefaultDirectoryURL(value foundation.NSURL)
- type NSPersistentHistoryChange
- func (p NSPersistentHistoryChange) Autorelease() NSPersistentHistoryChange
- func (p NSPersistentHistoryChange) ChangeID() int64
- func (p NSPersistentHistoryChange) ChangeType() NSPersistentHistoryChangeType
- func (p NSPersistentHistoryChange) ChangedObjectID() INSManagedObjectID
- func (p NSPersistentHistoryChange) Init() NSPersistentHistoryChange
- func (p NSPersistentHistoryChange) Tombstone() foundation.INSDictionary
- func (p NSPersistentHistoryChange) Transaction() INSPersistentHistoryTransaction
- func (p NSPersistentHistoryChange) UpdatedProperties() foundation.INSSet
- type NSPersistentHistoryChangeClass
- func (nc NSPersistentHistoryChangeClass) Alloc() NSPersistentHistoryChange
- func (nc NSPersistentHistoryChangeClass) Class() objc.Class
- func (_NSPersistentHistoryChangeClass NSPersistentHistoryChangeClass) EntityDescription() NSEntityDescription
- func (_NSPersistentHistoryChangeClass NSPersistentHistoryChangeClass) EntityDescriptionWithContext(context INSManagedObjectContext) NSEntityDescription
- func (_NSPersistentHistoryChangeClass NSPersistentHistoryChangeClass) FetchRequest() NSFetchRequest
- type NSPersistentHistoryChangeRequest
- func (p NSPersistentHistoryChangeRequest) Autorelease() NSPersistentHistoryChangeRequest
- func (p NSPersistentHistoryChangeRequest) FetchRequest() INSFetchRequest
- func (p NSPersistentHistoryChangeRequest) Init() NSPersistentHistoryChangeRequest
- func (p NSPersistentHistoryChangeRequest) ResultType() NSPersistentHistoryResultType
- func (p NSPersistentHistoryChangeRequest) SetFetchRequest(value INSFetchRequest)
- func (p NSPersistentHistoryChangeRequest) SetResultType(value NSPersistentHistoryResultType)
- func (p NSPersistentHistoryChangeRequest) Token() INSPersistentHistoryToken
- type NSPersistentHistoryChangeRequestClass
- func (nc NSPersistentHistoryChangeRequestClass) Alloc() NSPersistentHistoryChangeRequest
- func (nc NSPersistentHistoryChangeRequestClass) Class() objc.Class
- func (_NSPersistentHistoryChangeRequestClass NSPersistentHistoryChangeRequestClass) DeleteHistoryBeforeDate(date foundation.NSDate) NSPersistentHistoryChangeRequest
- func (_NSPersistentHistoryChangeRequestClass NSPersistentHistoryChangeRequestClass) DeleteHistoryBeforeToken(token INSPersistentHistoryToken) NSPersistentHistoryChangeRequest
- func (_NSPersistentHistoryChangeRequestClass NSPersistentHistoryChangeRequestClass) DeleteHistoryBeforeTransaction(transaction INSPersistentHistoryTransaction) NSPersistentHistoryChangeRequest
- func (_NSPersistentHistoryChangeRequestClass NSPersistentHistoryChangeRequestClass) FetchHistoryAfterDate(date foundation.NSDate) NSPersistentHistoryChangeRequest
- func (_NSPersistentHistoryChangeRequestClass NSPersistentHistoryChangeRequestClass) FetchHistoryAfterToken(token INSPersistentHistoryToken) NSPersistentHistoryChangeRequest
- func (_NSPersistentHistoryChangeRequestClass NSPersistentHistoryChangeRequestClass) FetchHistoryAfterTransaction(transaction INSPersistentHistoryTransaction) NSPersistentHistoryChangeRequest
- func (_NSPersistentHistoryChangeRequestClass NSPersistentHistoryChangeRequestClass) FetchHistoryWithFetchRequest(fetchRequest INSFetchRequest) NSPersistentHistoryChangeRequest
- type NSPersistentHistoryChangeType
- type NSPersistentHistoryResult
- type NSPersistentHistoryResultClass
- type NSPersistentHistoryResultType
- type NSPersistentHistoryToken
- type NSPersistentHistoryTokenClass
- type NSPersistentHistoryTransaction
- func (p NSPersistentHistoryTransaction) Author() string
- func (p NSPersistentHistoryTransaction) Autorelease() NSPersistentHistoryTransaction
- func (p NSPersistentHistoryTransaction) BundleID() string
- func (p NSPersistentHistoryTransaction) Changes() []NSPersistentHistoryChange
- func (p NSPersistentHistoryTransaction) ContextName() string
- func (p NSPersistentHistoryTransaction) Init() NSPersistentHistoryTransaction
- func (p NSPersistentHistoryTransaction) ObjectIDNotification() foundation.NSNotification
- func (p NSPersistentHistoryTransaction) ProcessID() string
- func (p NSPersistentHistoryTransaction) StoreID() string
- func (p NSPersistentHistoryTransaction) Timestamp() foundation.NSDate
- func (p NSPersistentHistoryTransaction) Token() INSPersistentHistoryToken
- func (p NSPersistentHistoryTransaction) TransactionNumber() int64
- type NSPersistentHistoryTransactionClass
- func (nc NSPersistentHistoryTransactionClass) Alloc() NSPersistentHistoryTransaction
- func (nc NSPersistentHistoryTransactionClass) Class() objc.Class
- func (_NSPersistentHistoryTransactionClass NSPersistentHistoryTransactionClass) EntityDescription() NSEntityDescription
- func (_NSPersistentHistoryTransactionClass NSPersistentHistoryTransactionClass) EntityDescriptionWithContext(context INSManagedObjectContext) NSEntityDescription
- func (_NSPersistentHistoryTransactionClass NSPersistentHistoryTransactionClass) FetchRequest() NSFetchRequest
- type NSPersistentStore
- func (p NSPersistentStore) Autorelease() NSPersistentStore
- func (p NSPersistentStore) ConfigurationName() string
- func (p NSPersistentStore) CoreSpotlightExporter() INSCoreDataCoreSpotlightDelegate
- func (p NSPersistentStore) DidAddToPersistentStoreCoordinator(coordinator INSPersistentStoreCoordinator)
- func (p NSPersistentStore) Identifier() string
- func (p NSPersistentStore) Init() NSPersistentStore
- func (p NSPersistentStore) InitWithPersistentStoreCoordinatorConfigurationNameURLOptions(root INSPersistentStoreCoordinator, name string, url foundation.NSURL, ...) NSPersistentStore
- func (p NSPersistentStore) IsReadOnly() bool
- func (p NSPersistentStore) LoadMetadata() (bool, error)
- func (p NSPersistentStore) Metadata() foundation.INSDictionary
- func (p NSPersistentStore) Options() foundation.INSDictionary
- func (p NSPersistentStore) PersistentStoreCoordinator() INSPersistentStoreCoordinator
- func (p NSPersistentStore) SetIdentifier(value string)
- func (p NSPersistentStore) SetMetadata(value foundation.INSDictionary)
- func (p NSPersistentStore) SetReadOnly(value bool)
- func (p NSPersistentStore) SetURL(value foundation.NSURL)
- func (p NSPersistentStore) Type() string
- func (p NSPersistentStore) URL() foundation.NSURL
- func (p NSPersistentStore) WillRemoveFromPersistentStoreCoordinator(coordinator INSPersistentStoreCoordinator)
- type NSPersistentStoreAsynchronousFetchResultCompletionBlock
- type NSPersistentStoreAsynchronousResult
- func (p NSPersistentStoreAsynchronousResult) Autorelease() NSPersistentStoreAsynchronousResult
- func (p NSPersistentStoreAsynchronousResult) Cancel()
- func (p NSPersistentStoreAsynchronousResult) Init() NSPersistentStoreAsynchronousResult
- func (p NSPersistentStoreAsynchronousResult) ManagedObjectContext() INSManagedObjectContext
- func (p NSPersistentStoreAsynchronousResult) OperationError() foundation.NSError
- func (p NSPersistentStoreAsynchronousResult) Progress() foundation.Progress
- type NSPersistentStoreAsynchronousResultClass
- type NSPersistentStoreClass
- func (nc NSPersistentStoreClass) Alloc() NSPersistentStore
- func (nc NSPersistentStoreClass) Class() objc.Class
- func (_NSPersistentStoreClass NSPersistentStoreClass) MetadataForPersistentStoreWithURLError(url foundation.NSURL) (foundation.INSDictionary, error)
- func (_NSPersistentStoreClass NSPersistentStoreClass) MigrationManagerClass() objectivec.Class
- func (_NSPersistentStoreClass NSPersistentStoreClass) SetMetadataForPersistentStoreWithURLError(metadata foundation.INSDictionary, url foundation.NSURL) (bool, error)
- type NSPersistentStoreCoordinator
- func (p NSPersistentStoreCoordinator) AddPersistentStoreWithDescription(ctx context.Context, storeDescription INSPersistentStoreDescription) (*NSPersistentStoreDescription, error)
- func (p NSPersistentStoreCoordinator) AddPersistentStoreWithDescriptionCompletionHandler(storeDescription INSPersistentStoreDescription, ...)
- func (p NSPersistentStoreCoordinator) AddPersistentStoreWithTypeConfigurationURLOptionsError(storeType string, configuration string, storeURL foundation.NSURL, ...) (INSPersistentStore, error)
- func (p NSPersistentStoreCoordinator) Autorelease() NSPersistentStoreCoordinator
- func (p NSPersistentStoreCoordinator) CurrentPersistentHistoryTokenFromStores(stores foundation.INSArray) INSPersistentHistoryToken
- func (p NSPersistentStoreCoordinator) DestroyPersistentStoreAtURLWithTypeOptionsError(url foundation.NSURL, storeType string, options foundation.INSDictionary) (bool, error)
- func (p NSPersistentStoreCoordinator) ExecuteRequestWithContextError(request INSPersistentStoreRequest, context INSManagedObjectContext) (objectivec.IObject, error)
- func (p NSPersistentStoreCoordinator) FinishDeferredLightweightMigration() (bool, error)
- func (p NSPersistentStoreCoordinator) FinishDeferredLightweightMigrationTask() (bool, error)
- func (p NSPersistentStoreCoordinator) Init() NSPersistentStoreCoordinator
- func (p NSPersistentStoreCoordinator) InitWithManagedObjectModel(model INSManagedObjectModel) NSPersistentStoreCoordinator
- func (p NSPersistentStoreCoordinator) ManagedObjectIDForURIRepresentation(url foundation.NSURL) INSManagedObjectID
- func (p NSPersistentStoreCoordinator) ManagedObjectModel() INSManagedObjectModel
- func (p NSPersistentStoreCoordinator) MetadataForPersistentStore(store INSPersistentStore) foundation.INSDictionary
- func (p NSPersistentStoreCoordinator) MigratePersistentStoreToURLOptionsWithTypeError(store INSPersistentStore, URL foundation.NSURL, ...) (INSPersistentStore, error)
- func (p NSPersistentStoreCoordinator) Name() string
- func (p NSPersistentStoreCoordinator) PerformBlock(block VoidHandler)
- func (p NSPersistentStoreCoordinator) PerformBlockAndWait(block VoidHandler)
- func (p NSPersistentStoreCoordinator) PerformBlockAndWaitSync(ctx context.Context) error
- func (p NSPersistentStoreCoordinator) PerformBlockSync(ctx context.Context) error
- func (p NSPersistentStoreCoordinator) PersistentStoreForURL(URL foundation.NSURL) INSPersistentStore
- func (p NSPersistentStoreCoordinator) PersistentStores() []NSPersistentStore
- func (p NSPersistentStoreCoordinator) RemovePersistentStoreError(store INSPersistentStore) (bool, error)
- func (p NSPersistentStoreCoordinator) ReplacePersistentStoreAtURLDestinationOptionsWithPersistentStoreFromURLSourceOptionsStoreTypeError(destinationURL foundation.NSURL, destinationOptions foundation.INSDictionary, ...) (bool, error)
- func (p NSPersistentStoreCoordinator) SetMetadataForPersistentStore(metadata foundation.INSDictionary, store INSPersistentStore)
- func (p NSPersistentStoreCoordinator) SetName(value string)
- func (p NSPersistentStoreCoordinator) SetURLForPersistentStore(url foundation.NSURL, store INSPersistentStore) bool
- func (p NSPersistentStoreCoordinator) URLForPersistentStore(store INSPersistentStore) foundation.NSURL
- type NSPersistentStoreCoordinatorClass
- func (nc NSPersistentStoreCoordinatorClass) Alloc() NSPersistentStoreCoordinator
- func (_NSPersistentStoreCoordinatorClass NSPersistentStoreCoordinatorClass) CachedModelForPersistentStoreAtURLOptionsError(url foundation.NSURL, options foundation.INSDictionary) (NSManagedObjectModel, error)
- func (nc NSPersistentStoreCoordinatorClass) Class() objc.Class
- func (_NSPersistentStoreCoordinatorClass NSPersistentStoreCoordinatorClass) MetadataForPersistentStoreOfTypeURLOptionsError(storeType string, url foundation.NSURL, options foundation.INSDictionary) (foundation.INSDictionary, error)
- func (_NSPersistentStoreCoordinatorClass NSPersistentStoreCoordinatorClass) RegisterStoreClassForStoreType(storeClass objectivec.Class, storeType string)
- func (_NSPersistentStoreCoordinatorClass NSPersistentStoreCoordinatorClass) RegisteredStoreTypes() foundation.INSDictionary
- func (_NSPersistentStoreCoordinatorClass NSPersistentStoreCoordinatorClass) SetMetadataForPersistentStoreOfTypeURLOptionsError(metadata foundation.INSDictionary, storeType string, url foundation.NSURL, ...) (bool, error)
- type NSPersistentStoreDescription
- func (p NSPersistentStoreDescription) Autorelease() NSPersistentStoreDescription
- func (p NSPersistentStoreDescription) CloudKitContainerOptions() INSPersistentCloudKitContainerOptions
- func (p NSPersistentStoreDescription) Configuration() string
- func (p NSPersistentStoreDescription) Init() NSPersistentStoreDescription
- func (p NSPersistentStoreDescription) InitWithURL(url foundation.NSURL) NSPersistentStoreDescription
- func (p NSPersistentStoreDescription) IsReadOnly() bool
- func (p NSPersistentStoreDescription) Options() foundation.INSDictionary
- func (p NSPersistentStoreDescription) SetCloudKitContainerOptions(value INSPersistentCloudKitContainerOptions)
- func (p NSPersistentStoreDescription) SetConfiguration(value string)
- func (p NSPersistentStoreDescription) SetOptionForKey(option objectivec.NSObject, key string)
- func (p NSPersistentStoreDescription) SetReadOnly(value bool)
- func (p NSPersistentStoreDescription) SetShouldAddStoreAsynchronously(value bool)
- func (p NSPersistentStoreDescription) SetShouldInferMappingModelAutomatically(value bool)
- func (p NSPersistentStoreDescription) SetShouldMigrateStoreAutomatically(value bool)
- func (p NSPersistentStoreDescription) SetTimeout(value foundation.NSTimeInterval)
- func (p NSPersistentStoreDescription) SetType(value string)
- func (p NSPersistentStoreDescription) SetURL(value foundation.NSURL)
- func (p NSPersistentStoreDescription) SetValueForPragmaNamed(value objectivec.NSObject, name string)
- func (p NSPersistentStoreDescription) ShouldAddStoreAsynchronously() bool
- func (p NSPersistentStoreDescription) ShouldInferMappingModelAutomatically() bool
- func (p NSPersistentStoreDescription) ShouldMigrateStoreAutomatically() bool
- func (p NSPersistentStoreDescription) SqlitePragmas() foundation.INSDictionary
- func (p NSPersistentStoreDescription) Timeout() foundation.NSTimeInterval
- func (p NSPersistentStoreDescription) Type() string
- func (p NSPersistentStoreDescription) URL() foundation.NSURL
- type NSPersistentStoreDescriptionClass
- type NSPersistentStoreRequest
- func (p NSPersistentStoreRequest) AffectedStores() []NSPersistentStore
- func (p NSPersistentStoreRequest) Autorelease() NSPersistentStoreRequest
- func (p NSPersistentStoreRequest) Init() NSPersistentStoreRequest
- func (p NSPersistentStoreRequest) RequestType() NSPersistentStoreRequestType
- func (p NSPersistentStoreRequest) SetAffectedStores(value []NSPersistentStore)
- type NSPersistentStoreRequestClass
- type NSPersistentStoreRequestType
- type NSPersistentStoreResult
- type NSPersistentStoreResultClass
- type NSPersistentStoreUbiquitousTransitionType
- type NSPropertyDescription
- func (p NSPropertyDescription) Autorelease() NSPropertyDescription
- func (p NSPropertyDescription) EncodeWithCoder(coder foundation.INSCoder)
- func (p NSPropertyDescription) Entity() INSEntityDescription
- func (p NSPropertyDescription) Init() NSPropertyDescription
- func (p NSPropertyDescription) IsIndexedBySpotlight() bool
- func (p NSPropertyDescription) IsOptional() bool
- func (p NSPropertyDescription) IsTransient() bool
- func (p NSPropertyDescription) Name() string
- func (p NSPropertyDescription) RenamingIdentifier() string
- func (p NSPropertyDescription) SetIndexedBySpotlight(value bool)
- func (p NSPropertyDescription) SetName(value string)
- func (p NSPropertyDescription) SetOptional(value bool)
- func (p NSPropertyDescription) SetRenamingIdentifier(value string)
- func (p NSPropertyDescription) SetTransient(value bool)
- func (p NSPropertyDescription) SetUserInfo(value foundation.INSDictionary)
- func (p NSPropertyDescription) SetValidationPredicatesWithValidationWarnings(validationPredicates []foundation.NSPredicate, validationWarnings []string)
- func (p NSPropertyDescription) SetVersionHashModifier(value string)
- func (p NSPropertyDescription) UserInfo() foundation.INSDictionary
- func (p NSPropertyDescription) ValidationPredicates() []foundation.NSPredicate
- func (p NSPropertyDescription) ValidationWarnings() foundation.INSArray
- func (p NSPropertyDescription) VersionHash() foundation.NSData
- func (p NSPropertyDescription) VersionHashModifier() string
- type NSPropertyDescriptionClass
- type NSPropertyMapping
- func (p NSPropertyMapping) Autorelease() NSPropertyMapping
- func (p NSPropertyMapping) Init() NSPropertyMapping
- func (p NSPropertyMapping) Name() string
- func (p NSPropertyMapping) SetName(value string)
- func (p NSPropertyMapping) SetUserInfo(value foundation.INSDictionary)
- func (p NSPropertyMapping) SetValueExpression(value foundation.NSExpression)
- func (p NSPropertyMapping) UserInfo() foundation.INSDictionary
- func (p NSPropertyMapping) ValueExpression() foundation.NSExpression
- type NSPropertyMappingClass
- type NSQueryGenerationToken
- type NSQueryGenerationTokenClass
- type NSRelationshipDescription
- func (r NSRelationshipDescription) Autorelease() NSRelationshipDescription
- func (r NSRelationshipDescription) DeleteRule() NSDeleteRule
- func (r NSRelationshipDescription) DestinationEntity() INSEntityDescription
- func (r NSRelationshipDescription) Init() NSRelationshipDescription
- func (r NSRelationshipDescription) InverseRelationship() INSRelationshipDescription
- func (r NSRelationshipDescription) IsOrdered() bool
- func (r NSRelationshipDescription) IsToMany() bool
- func (r NSRelationshipDescription) MaxCount() uint
- func (r NSRelationshipDescription) MinCount() uint
- func (r NSRelationshipDescription) SetDeleteRule(value NSDeleteRule)
- func (r NSRelationshipDescription) SetDestinationEntity(value INSEntityDescription)
- func (r NSRelationshipDescription) SetInverseRelationship(value INSRelationshipDescription)
- func (r NSRelationshipDescription) SetMaxCount(value uint)
- func (r NSRelationshipDescription) SetMinCount(value uint)
- func (r NSRelationshipDescription) SetOrdered(value bool)
- type NSRelationshipDescriptionClass
- type NSSaveChangesRequest
- func (s NSSaveChangesRequest) Autorelease() NSSaveChangesRequest
- func (s NSSaveChangesRequest) DeletedObjects() foundation.INSSet
- func (s NSSaveChangesRequest) Init() NSSaveChangesRequest
- func (s NSSaveChangesRequest) InitWithInsertedObjectsUpdatedObjectsDeletedObjectsLockedObjects(insertedObjects foundation.INSSet, updatedObjects foundation.INSSet, ...) NSSaveChangesRequest
- func (s NSSaveChangesRequest) InsertedObjects() foundation.INSSet
- func (s NSSaveChangesRequest) LockedObjects() foundation.INSSet
- func (s NSSaveChangesRequest) UpdatedObjects() foundation.INSSet
- type NSSaveChangesRequestClass
- type NSSnapshotEventType
- type NSStagedMigrationManager
- type NSStagedMigrationManagerClass
- type PersistentStoreDescriptionErrorHandler
- type ResultType
- type VoidHandler
Constants ¶
This section is empty.
Variables ¶
var ( // AddedPersistentStoresKey is key for the array of stores that were added. // // See: https://developer.apple.com/documentation/CoreData/NSAddedPersistentStoresKey AddedPersistentStoresKey string // AffectedObjectsErrorKey is the key for objects prompting an error. // // See: https://developer.apple.com/documentation/CoreData/NSAffectedObjectsErrorKey AffectedObjectsErrorKey string // AffectedStoresErrorKey is the key for stores prompting an error. // // See: https://developer.apple.com/documentation/CoreData/NSAffectedStoresErrorKey AffectedStoresErrorKey string // BinaryStoreInsecureDecodingCompatibilityOption is a flag that indicates Core Data decodes the binary store insecurely. // // See: https://developer.apple.com/documentation/CoreData/NSBinaryStoreInsecureDecodingCompatibilityOption BinaryStoreInsecureDecodingCompatibilityOption string // BinaryStoreSecureDecodingClasses is an additional set of classes to use while decoding a binary store. // // See: https://developer.apple.com/documentation/CoreData/NSBinaryStoreSecureDecodingClasses BinaryStoreSecureDecodingClasses string // BinaryStoreType is the binary store type. // // See: https://developer.apple.com/documentation/CoreData/NSBinaryStoreType BinaryStoreType string // CoreDataCoreSpotlightExporter is the key you use to specify your Core Spotlight delegate. // // See: https://developer.apple.com/documentation/CoreData/NSCoreDataCoreSpotlightExporter CoreDataCoreSpotlightExporter string // DeletedObjectIDsKey is a user info key to identify deleted object identifiers in notifications after saving a managed object context. // // See: https://developer.apple.com/documentation/CoreData/NSDeletedObjectIDsKey DeletedObjectIDsKey string // DeletedObjectsKey is a key for the set of objects that were marked for deletion during the previous event. // // See: https://developer.apple.com/documentation/CoreData/NSDeletedObjectsKey DeletedObjectsKey string // DetailedErrorsKey is if multiple validation errors occur in one operation, they are collected in an array and added with this key to the “top-level error” of the operation. // // See: https://developer.apple.com/documentation/CoreData/NSDetailedErrorsKey DetailedErrorsKey string // IgnorePersistentStoreVersioningOption is key to ignore the built-in versioning provided by Core Data. // // See: https://developer.apple.com/documentation/CoreData/NSIgnorePersistentStoreVersioningOption IgnorePersistentStoreVersioningOption string // InMemoryStoreType is the in-memory store type. // // See: https://developer.apple.com/documentation/CoreData/NSInMemoryStoreType InMemoryStoreType string // InferMappingModelAutomaticallyOption is key to attempt to create the mapping model automatically. // // See: https://developer.apple.com/documentation/CoreData/NSInferMappingModelAutomaticallyOption InferMappingModelAutomaticallyOption string // InsertedObjectIDsKey is a user info key to identify inserted object identifiers in notifications after saving a managed object context. // // See: https://developer.apple.com/documentation/CoreData/NSInsertedObjectIDsKey InsertedObjectIDsKey string // InsertedObjectsKey is a key for the set of objects that were inserted into the context. // // See: https://developer.apple.com/documentation/CoreData/NSInsertedObjectsKey InsertedObjectsKey string // InvalidatedAllObjectsKey is a key that specifies that all objects in the context have been invalidated. // // See: https://developer.apple.com/documentation/CoreData/NSInvalidatedAllObjectsKey InvalidatedAllObjectsKey string // InvalidatedObjectIDsKey is a user info key to identify invalidated object identifiers in notifications after saving a managed object context. // // See: https://developer.apple.com/documentation/CoreData/NSInvalidatedObjectIDsKey InvalidatedObjectIDsKey string // InvalidatedObjectsKey is a key for the set of objects that were invalidated. // // See: https://developer.apple.com/documentation/CoreData/NSInvalidatedObjectsKey InvalidatedObjectsKey string // See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContextDidMergeChangesObjectIDsNotification ManagedObjectContextDidMergeChangesObjectIDsNotification string // ManagedObjectContextDidSaveNotification is a notification that posts after a context finishes writing unsaved changes. // // See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContextDidSaveNotification ManagedObjectContextDidSaveNotification string // ManagedObjectContextDidSaveObjectIDsNotification is a notification that posts after a context finishes writing changes. // // See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContextDidSaveObjectIDsNotification ManagedObjectContextDidSaveObjectIDsNotification string // ManagedObjectContextObjectsDidChangeNotification is a notification that posts when there are changes to context’s registered managed objects. // // See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContextObjectsDidChangeNotification ManagedObjectContextObjectsDidChangeNotification string // ManagedObjectContextQueryGenerationKey is constant used to reference the query generation token. // // See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContextQueryGenerationKey ManagedObjectContextQueryGenerationKey string // ManagedObjectContextWillSaveNotification is a notification that posts before a context writes unsaved changes. // // See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContextWillSaveNotification ManagedObjectContextWillSaveNotification string // MigratePersistentStoresAutomaticallyOption is key to automatically attempt to migrate versioned stores. // // See: https://developer.apple.com/documentation/CoreData/NSMigratePersistentStoresAutomaticallyOption MigratePersistentStoresAutomaticallyOption string // MigrationDestinationObjectKey is key for the destination object. // // See: https://developer.apple.com/documentation/CoreData/NSMigrationDestinationObjectKey MigrationDestinationObjectKey string // MigrationEntityMappingKey is key for the entity mapping object. // // See: https://developer.apple.com/documentation/CoreData/NSMigrationEntityMappingKey MigrationEntityMappingKey string // MigrationEntityPolicyKey is key for the entity migration policy object. // // See: https://developer.apple.com/documentation/CoreData/NSMigrationEntityPolicyKey MigrationEntityPolicyKey string // MigrationManagerKey is key for the migration manager. // // See: https://developer.apple.com/documentation/CoreData/NSMigrationManagerKey MigrationManagerKey string // MigrationPropertyMappingKey is key for the property mapping object. // // See: https://developer.apple.com/documentation/CoreData/NSMigrationPropertyMappingKey MigrationPropertyMappingKey string // MigrationSourceObjectKey is key for the source object. // // See: https://developer.apple.com/documentation/CoreData/NSMigrationSourceObjectKey MigrationSourceObjectKey string // PersistentCloudKitContainerEventUserInfoKey is the user info dictionary key for the persistent CloudKit container event. // // See: https://developer.apple.com/documentation/CoreData/NSPersistentCloudKitContainer/eventNotificationUserInfoKey PersistentCloudKitContainerEventUserInfoKey string // PersistentHistoryTokenKey is a user info key to identify the history token in persistent store remote change notifications. // // See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryTokenKey PersistentHistoryTokenKey string // PersistentHistoryTrackingKey is the key you use to enable persistent history tracking. // // See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryTrackingKey PersistentHistoryTrackingKey string // PersistentStoreConnectionPoolMaxSizeKey is the maximum connection pool size to use on a store that supports concurrent request handling. // // See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreConnectionPoolMaxSizeKey PersistentStoreConnectionPoolMaxSizeKey string // PersistentStoreCoordinatorStoresDidChangeNotification is a notification that the coordinator posts after its registered stores change. // // See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreCoordinatorStoresDidChangeNotification PersistentStoreCoordinatorStoresDidChangeNotification string // PersistentStoreCoordinatorStoresWillChangeNotification is a notification that posts before a coordinator changes its registered stores. // // See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreCoordinatorStoresWillChangeNotification PersistentStoreCoordinatorStoresWillChangeNotification string // PersistentStoreCoordinatorWillRemoveStoreNotification is a notification that posts before a coordinator removes a store. // // See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreCoordinatorWillRemoveStoreNotification PersistentStoreCoordinatorWillRemoveStoreNotification string // PersistentStoreDeferredLightweightMigrationOptionKey is the key for enabling deferred lightweight migrations. // // See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreDeferredLightweightMigrationOptionKey PersistentStoreDeferredLightweightMigrationOptionKey string // PersistentStoreForceDestroyOption is a flag that indicates the coordinator destroys the store file even if the operation might be unsafe, overriding locks, if necessary. // // See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreForceDestroyOption PersistentStoreForceDestroyOption string // See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreModelVersionChecksumKey PersistentStoreModelVersionChecksumKey string // PersistentStoreOSCompatibility is key to represent the earliest version of the operation system that the persistent store supports. // // See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreOSCompatibility PersistentStoreOSCompatibility string // See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreRemoteChangeNotification PersistentStoreRemoteChangeNotification string // PersistentStoreRemoteChangeNotificationPostOptionKey is a key that indicates a persistent store posts a remote change notification for every write to the store, including writes by other processes. // // See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreRemoteChangeNotificationPostOptionKey PersistentStoreRemoteChangeNotificationPostOptionKey string // PersistentStoreSaveConflictsErrorKey is the key for the array of merge conflict objects (instances of [NSMergeConflict]). // // See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreSaveConflictsErrorKey PersistentStoreSaveConflictsErrorKey string // PersistentStoreStagedMigrationManagerOptionKey is the key for specifying your staged migration manager. // // See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreStagedMigrationManagerOptionKey PersistentStoreStagedMigrationManagerOptionKey string // PersistentStoreTimeoutOption is options key that specifies the connection timeout for Core Data stores. // // See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreTimeoutOption PersistentStoreTimeoutOption string // PersistentStoreURLKey is a user info key to identify the store URL in persistent store remote change notifications. // // See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreURLKey PersistentStoreURLKey string // ReadOnlyPersistentStoreOption is a flag that indicates whether a store is treated as read-only or not. // // See: https://developer.apple.com/documentation/CoreData/NSReadOnlyPersistentStoreOption ReadOnlyPersistentStoreOption string // RefreshedObjectIDsKey is a user info key to identify refreshed object identifiers in notifications after saving a managed object context. // // See: https://developer.apple.com/documentation/CoreData/NSRefreshedObjectIDsKey RefreshedObjectIDsKey string // RefreshedObjectsKey is a key for the set of objects that were refreshed but were not dirtied in the scope of this context. // // See: https://developer.apple.com/documentation/CoreData/NSRefreshedObjectsKey RefreshedObjectsKey string // RemovedPersistentStoresKey is key for the array of stores that were removed. // // See: https://developer.apple.com/documentation/CoreData/NSRemovedPersistentStoresKey RemovedPersistentStoresKey string // SQLiteAnalyzeOption is option key to run an analysis of the store data to optimize indices based on statistical information when the store is added to the coordinator. // // See: https://developer.apple.com/documentation/CoreData/NSSQLiteAnalyzeOption SQLiteAnalyzeOption string // SQLiteErrorDomain is domain for SQLite errors. // // See: https://developer.apple.com/documentation/CoreData/NSSQLiteErrorDomain SQLiteErrorDomain string // SQLiteManualVacuumOption is option key to rebuild the store file, forcing a database wide defragmentation when the store is added to the coordinator. // // See: https://developer.apple.com/documentation/CoreData/NSSQLiteManualVacuumOption SQLiteManualVacuumOption string // SQLitePragmasOption is options key for a dictionary of SQLite pragma settings with pragma values indexed by pragma names as keys. // // See: https://developer.apple.com/documentation/CoreData/NSSQLitePragmasOption SQLitePragmasOption string // SQLiteStoreType is the SQLite database store type. // // See: https://developer.apple.com/documentation/CoreData/NSSQLiteStoreType SQLiteStoreType string // StoreModelVersionHashesKey is key to represent the version hash information for the model used to create the store. // // See: https://developer.apple.com/documentation/CoreData/NSStoreModelVersionHashesKey StoreModelVersionHashesKey string // StoreModelVersionIdentifiersKey is key to represent the version identifiers for the model used to create the store. // // See: https://developer.apple.com/documentation/CoreData/NSStoreModelVersionIdentifiersKey StoreModelVersionIdentifiersKey string // StoreTypeKey is a key that identifies the store type. // // See: https://developer.apple.com/documentation/CoreData/NSStoreTypeKey StoreTypeKey string // StoreUUIDKey is a key that provides the store’s UUID. // // See: https://developer.apple.com/documentation/CoreData/NSStoreUUIDKey StoreUUIDKey string // UUIDChangedPersistentStoresKey is key for an array containing the old and new stores. // // See: https://developer.apple.com/documentation/CoreData/NSUUIDChangedPersistentStoresKey UUIDChangedPersistentStoresKey string // UpdatedObjectIDsKey is a user info key to identify updated object identifiers in notifications after saving a managed object context. // // See: https://developer.apple.com/documentation/CoreData/NSUpdatedObjectIDsKey UpdatedObjectIDsKey string // UpdatedObjectsKey is a key for the set of objects that were updated. // // See: https://developer.apple.com/documentation/CoreData/NSUpdatedObjectsKey UpdatedObjectsKey string // ValidateXMLStoreOption is a flag that indicates whether an XML file should be validated with the DTD while opening. // // See: https://developer.apple.com/documentation/CoreData/NSValidateXMLStoreOption ValidateXMLStoreOption string // ValidationKeyErrorKey is the error key for the attribute that failed to validate. // // See: https://developer.apple.com/documentation/CoreData/NSValidationKeyErrorKey ValidationKeyErrorKey string // ValidationObjectErrorKey is the error key for the object that failed to validate. // // See: https://developer.apple.com/documentation/CoreData/NSValidationObjectErrorKey ValidationObjectErrorKey string // ValidationPredicateErrorKey is the error key for the predicate that failed to validate. // // See: https://developer.apple.com/documentation/CoreData/NSValidationPredicateErrorKey ValidationPredicateErrorKey string // ValidationValueErrorKey is the error key for the value that failed to validate. // // See: https://developer.apple.com/documentation/CoreData/NSValidationValueErrorKey ValidationValueErrorKey string // XMLStoreType is the XML store type. // // See: https://developer.apple.com/documentation/CoreData/NSXMLStoreType XMLStoreType string )
var ( // See: https://developer.apple.com/documentation/CoreData/NSCoreDataCoreSpotlightDelegateIndexDidUpdateNotification CoreDataCoreSpotlightDelegateIndexDidUpdateNotification foundation.NSNotificationName // PersistentCloudKitContainerEventChangedNotification is a notification that contains details about an event in a persistent CloudKit container. // // See: https://developer.apple.com/documentation/CoreData/NSPersistentCloudKitContainer/eventChangedNotification PersistentCloudKitContainerEventChangedNotification foundation.NSNotificationName )
var ( // ErrorMergePolicy is the default merge policy for all managed object contexts. // // See: https://developer.apple.com/documentation/CoreData/NSErrorMergePolicy ErrorMergePolicy objectivec.Object // MergeByPropertyObjectTrumpMergePolicy is a property-based merge policy that applies in-memory changes. // // See: https://developer.apple.com/documentation/CoreData/NSMergeByPropertyObjectTrumpMergePolicy MergeByPropertyObjectTrumpMergePolicy objectivec.Object // MergeByPropertyStoreTrumpMergePolicy is a property-based merge policy that applies external changes. // // See: https://developer.apple.com/documentation/CoreData/NSMergeByPropertyStoreTrumpMergePolicy MergeByPropertyStoreTrumpMergePolicy objectivec.Object // OverwriteMergePolicy is a merge policy that overwrites the entire stored object. // // See: https://developer.apple.com/documentation/CoreData/NSOverwriteMergePolicy OverwriteMergePolicy objectivec.Object // RollbackMergePolicy is a merge policy that discards unsaved changes. // // See: https://developer.apple.com/documentation/CoreData/NSRollbackMergePolicy RollbackMergePolicy objectivec.Object )
var ( // CoreDataVersionNumber is the version of Core Data available in the current process. // // See: https://developer.apple.com/documentation/CoreData/NSCoreDataVersionNumber CoreDataVersionNumber float64 )
Functions ¶
func NewAsynchronousFetchResultBlock ¶
func NewAsynchronousFetchResultBlock(handler AsynchronousFetchResultHandler) (objc.ID, func())
NewAsynchronousFetchResultBlock wraps a Go AsynchronousFetchResultHandler as an Objective-C block. The caller must defer the returned cleanup function.
func NewBoolManagedObjectBlock ¶
func NewBoolManagedObjectBlock(handler BoolManagedObjectHandler) (objc.ID, func())
NewBoolManagedObjectBlock wraps a Go BoolManagedObjectHandler as an Objective-C block. The caller must defer the returned cleanup function.
Used by:
func NewErrorBlock ¶
func NewErrorBlock(handler ErrorHandler) (objc.ID, func())
NewErrorBlock wraps a Go ErrorHandler as an Objective-C block. The caller must defer the returned cleanup function.
Used by:
func NewManagedObjectContextBlock ¶
func NewManagedObjectContextBlock(handler ManagedObjectContextHandler) (objc.ID, func())
NewManagedObjectContextBlock wraps a Go ManagedObjectContextHandler as an Objective-C block. The caller must defer the returned cleanup function.
Used by:
func NewNSPersistentStoreAsynchronousFetchResultCompletionBlock ¶
func NewNSPersistentStoreAsynchronousFetchResultCompletionBlock(handler NSPersistentStoreAsynchronousFetchResultCompletionBlock) (objc.ID, func())
NewNSPersistentStoreAsynchronousFetchResultCompletionBlock wraps a Go NSPersistentStoreAsynchronousFetchResultCompletionBlock as an Objective-C block. The caller must defer the returned cleanup function.
func NewPersistentStoreDescriptionErrorBlock ¶
func NewPersistentStoreDescriptionErrorBlock(handler PersistentStoreDescriptionErrorHandler) (objc.ID, func())
NewPersistentStoreDescriptionErrorBlock wraps a Go PersistentStoreDescriptionErrorHandler as an Objective-C block. The caller must defer the returned cleanup function.
Used by:
func NewVoidBlock ¶
func NewVoidBlock(handler VoidHandler) (objc.ID, func())
NewVoidBlock wraps a Go VoidHandler as an Objective-C block. The caller must defer the returned cleanup function.
Used by:
- NSCoreDataCoreSpotlightDelegate.SearchableIndexReindexAllSearchableItemsWithAcknowledgementHandler
- NSCoreDataCoreSpotlightDelegate.SearchableIndexReindexSearchableItemsWithIdentifiersAcknowledgementHandler
- NSManagedObjectContext.PerformBlockAndWait
- NSManagedObjectContext.PerformBlock
- NSPersistentStoreCoordinator.PerformBlockAndWait
- NSPersistentStoreCoordinator.PerformBlock
func NewidNSFetchRequestResultAsynchronousFetchResultBlock ¶
func NewidNSFetchRequestResultAsynchronousFetchResultBlock(handler idNSFetchRequestResultAsynchronousFetchResultHandler) (objc.ID, func())
NewidNSFetchRequestResultAsynchronousFetchResultBlock wraps a Go [idNSFetchRequestResultAsynchronousFetchResultHandler] as an Objective-C block. The caller must defer the returned cleanup function.
Used by:
Types ¶
type AsynchronousFetchResultHandler ¶
type AsynchronousFetchResultHandler = func(*NSAsynchronousFetchResult)
AsynchronousFetchResultHandler is the signature for a completion handler block.
type BoolManagedObjectHandler ¶
type BoolManagedObjectHandler = func(*NSManagedObject) bool
BoolManagedObjectHandler handles A closure that inserts data into the managed entity.
Used by:
type BoolStringidMutableDictionaryHandler ¶
type BoolStringidMutableDictionaryHandler = func(*foundation.INSDictionary) bool
BoolStringidMutableDictionaryHandler handles A closure that provides a dictionary that represents an object to insert.
Used by:
- [NSBatchInsertRequest.InitWithEntityDictionaryHandler]
- [NSBatchInsertRequest.InitWithEntityNameDictionaryHandler]
type ErrorHandler ¶
type ErrorHandler = func(error)
ErrorHandler is the signature for a completion handler block.
Used by:
type INSAsynchronousFetchRequest ¶
type INSAsynchronousFetchRequest interface {
INSPersistentStoreRequest
// Initializes a new asynchronous fetch request configured with the provided fetch request and completion block.
InitWithFetchRequestCompletionBlock(request INSFetchRequest, blk idNSFetchRequestResultAsynchronousFetchResultHandler) NSAsynchronousFetchRequest
// A configuration parameter that assists Core Data with scheduling the asynchronous fetch request.
EstimatedResultCount() int
SetEstimatedResultCount(value int)
// The underlying fetch request that is executed asynchronously.
FetchRequest() INSFetchRequest
}
An interface definition for the NSAsynchronousFetchRequest class.
Initializing a Request ¶
- INSAsynchronousFetchRequest.InitWithFetchRequestCompletionBlock: Initializes a new asynchronous fetch request configured with the provided fetch request and completion block.
Preparing a Request ¶
- INSAsynchronousFetchRequest.EstimatedResultCount: A configuration parameter that assists Core Data with scheduling the asynchronous fetch request.
- INSAsynchronousFetchRequest.SetEstimatedResultCount
- INSAsynchronousFetchRequest.FetchRequest: The underlying fetch request that is executed asynchronously.
See: https://developer.apple.com/documentation/CoreData/NSAsynchronousFetchRequest
type INSAsynchronousFetchResult ¶
type INSAsynchronousFetchResult interface {
INSPersistentStoreAsynchronousResult
// The underlying fetch request that was executed.
FetchRequest() INSAsynchronousFetchRequest
// The results that were received from the fetch request.
FinalResult() []objectivec.IObject
}
An interface definition for the NSAsynchronousFetchResult class.
Getting Information About a Result ¶
- INSAsynchronousFetchResult.FetchRequest: The underlying fetch request that was executed.
- INSAsynchronousFetchResult.FinalResult: The results that were received from the fetch request.
See: https://developer.apple.com/documentation/CoreData/NSAsynchronousFetchResult
type INSAtomicStore ¶
type INSAtomicStore interface {
INSPersistentStore
// Loads the cache nodes for the receiver.
Load() (bool, error)
// Returns a managed object ID from the reference data for a specified entity.
ObjectIDForEntityReferenceObject(entity INSEntityDescription, data objectivec.IObject) INSManagedObjectID
// Registers a set of cache nodes with the receiver.
AddCacheNodes(cacheNodes foundation.INSSet)
// Returns a new cache node for a given managed object.
NewCacheNodeForManagedObject(managedObject INSManagedObject) INSAtomicStoreCacheNode
// Returns a new reference object for a given managed object.
NewReferenceObjectForManagedObject(managedObject INSManagedObject) objectivec.IObject
// Updates the given cache node using the values in a given managed object.
UpdateCacheNodeFromManagedObject(node INSAtomicStoreCacheNode, managedObject INSManagedObject)
// Method invoked before the store removes the given collection of cache nodes.
WillRemoveCacheNodes(cacheNodes foundation.INSSet)
// Saves the cache nodes.
Save() (bool, error)
// Returns the set of cache nodes registered with the receiver.
CacheNodes() foundation.INSSet
// Returns the cache node for a given managed object ID.
CacheNodeForObjectID(objectID INSManagedObjectID) INSAtomicStoreCacheNode
// Returns the reference object for a given managed object ID.
ReferenceObjectForObjectID(objectID INSManagedObjectID) objectivec.IObject
}
An interface definition for the NSAtomicStore class.
Loading a Store ¶
- INSAtomicStore.Load: Loads the cache nodes for the receiver.
- INSAtomicStore.ObjectIDForEntityReferenceObject: Returns a managed object ID from the reference data for a specified entity.
- INSAtomicStore.AddCacheNodes: Registers a set of cache nodes with the receiver.
Updating Cache Nodes ¶
- INSAtomicStore.NewCacheNodeForManagedObject: Returns a new cache node for a given managed object.
- INSAtomicStore.NewReferenceObjectForManagedObject: Returns a new reference object for a given managed object.
- INSAtomicStore.UpdateCacheNodeFromManagedObject: Updates the given cache node using the values in a given managed object.
- INSAtomicStore.WillRemoveCacheNodes: Method invoked before the store removes the given collection of cache nodes.
Saving a Store ¶
- INSAtomicStore.Save: Saves the cache nodes.
Utility Methods ¶
- INSAtomicStore.CacheNodes: Returns the set of cache nodes registered with the receiver.
- INSAtomicStore.CacheNodeForObjectID: Returns the cache node for a given managed object ID.
- INSAtomicStore.ReferenceObjectForObjectID: Returns the reference object for a given managed object ID.
See: https://developer.apple.com/documentation/CoreData/NSAtomicStore
type INSAtomicStoreCacheNode ¶
type INSAtomicStoreCacheNode interface {
objectivec.IObject
// Returns a cache node for the given managed object ID.
InitWithObjectID(moid INSManagedObjectID) NSAtomicStoreCacheNode
// The managed object ID of the node.
ObjectID() INSManagedObjectID
// The property cache dictionary of the node.
PropertyCache() foundation.INSDictionary
SetPropertyCache(value foundation.INSDictionary)
}
An interface definition for the NSAtomicStoreCacheNode class.
Initializing a Cache Node ¶
- INSAtomicStoreCacheNode.InitWithObjectID: Returns a cache node for the given managed object ID.
Managing Node Data ¶
- INSAtomicStoreCacheNode.ObjectID: The managed object ID of the node.
- INSAtomicStoreCacheNode.PropertyCache: The property cache dictionary of the node.
- INSAtomicStoreCacheNode.SetPropertyCache
See: https://developer.apple.com/documentation/CoreData/NSAtomicStoreCacheNode
type INSAttributeDescription ¶
type INSAttributeDescription interface {
INSPropertyDescription
// The class name that represents the attribute’s value.
AttributeValueClassName() string
SetAttributeValueClassName(value string)
// The attribute’s type.
AttributeType() NSAttributeType
SetAttributeType(value NSAttributeType)
// A Boolean value that determines whether to encrypt the attribute’s value.
AllowsCloudEncryption() bool
SetAllowsCloudEncryption(value bool)
// A Boolean value that indicates whether the attribute allows external binary storage.
AllowsExternalBinaryDataStorage() bool
SetAllowsExternalBinaryDataStorage(value bool)
// The default value of the attribute.
DefaultValue() objectivec.IObject
SetDefaultValue(value objectivec.IObject)
// A Boolean value that indicates whether the attribute records its value in the persistent history transaction for a managed object’s deletion.
PreservesValueInHistoryOnDeletion() bool
SetPreservesValueInHistoryOnDeletion(value bool)
// The name of the transformer to use for the attribute value.
ValueTransformerName() string
SetValueTransformerName(value string)
}
An interface definition for the NSAttributeDescription class.
Managing the type ¶
- INSAttributeDescription.AttributeValueClassName: The class name that represents the attribute’s value.
- INSAttributeDescription.SetAttributeValueClassName
- INSAttributeDescription.AttributeType: The attribute’s type.
- INSAttributeDescription.SetAttributeType
Configuring the behavior ¶
- INSAttributeDescription.AllowsCloudEncryption: A Boolean value that determines whether to encrypt the attribute’s value.
- INSAttributeDescription.SetAllowsCloudEncryption
- INSAttributeDescription.AllowsExternalBinaryDataStorage: A Boolean value that indicates whether the attribute allows external binary storage.
- INSAttributeDescription.SetAllowsExternalBinaryDataStorage
- INSAttributeDescription.DefaultValue: The default value of the attribute.
- INSAttributeDescription.SetDefaultValue
- INSAttributeDescription.PreservesValueInHistoryOnDeletion: A Boolean value that indicates whether the attribute records its value in the persistent history transaction for a managed object’s deletion.
- INSAttributeDescription.SetPreservesValueInHistoryOnDeletion
- INSAttributeDescription.ValueTransformerName: The name of the transformer to use for the attribute value.
- INSAttributeDescription.SetValueTransformerName
See: https://developer.apple.com/documentation/CoreData/NSAttributeDescription
type INSBatchDeleteRequest ¶
type INSBatchDeleteRequest interface {
INSPersistentStoreRequest
// Creates a request that deletes the results of the specified fetch request.
InitWithFetchRequest(fetch INSFetchRequest) NSBatchDeleteRequest
// Creates a request that deletes the managed objects with the specified identifiers.
InitWithObjectIDs(objects []NSManagedObjectID) NSBatchDeleteRequest
// The fetch request that identifies the managed objects to delete.
FetchRequest() INSFetchRequest
// The type of result the request provides when it executes.
ResultType() NSBatchDeleteRequestResultType
SetResultType(value NSBatchDeleteRequestResultType)
}
An interface definition for the NSBatchDeleteRequest class.
Creating a Request ¶
- INSBatchDeleteRequest.InitWithFetchRequest: Creates a request that deletes the results of the specified fetch request.
- INSBatchDeleteRequest.InitWithObjectIDs: Creates a request that deletes the managed objects with the specified identifiers.
Accessing the Fetch Request ¶
- INSBatchDeleteRequest.FetchRequest: The fetch request that identifies the managed objects to delete.
Configuring the Result Type ¶
- INSBatchDeleteRequest.ResultType: The type of result the request provides when it executes.
- INSBatchDeleteRequest.SetResultType
See: https://developer.apple.com/documentation/CoreData/NSBatchDeleteRequest
type INSBatchDeleteResult ¶
type INSBatchDeleteResult interface {
INSPersistentStoreResult
// The value the request returns after it executes.
Result() objectivec.IObject
// The data type of the request’s result value.
ResultType() NSBatchDeleteRequestResultType
}
An interface definition for the NSBatchDeleteResult class.
Accessing the Result ¶
- INSBatchDeleteResult.Result: The value the request returns after it executes.
- INSBatchDeleteResult.ResultType: The data type of the request’s result value.
See: https://developer.apple.com/documentation/CoreData/NSBatchDeleteResult
type INSBatchInsertRequest ¶
type INSBatchInsertRequest interface {
INSPersistentStoreRequest
// Creates a batch-insertion request for a managed entity, and specifies a closure that inserts data into the entity.
InitWithEntityManagedObjectHandler(entity INSEntityDescription, handler BoolManagedObjectHandler) NSBatchInsertRequest
// Creates a batch-insertion request for a named managed entity, and specifies a closure that inserts data into the entity.
InitWithEntityNameManagedObjectHandler(entityName string, handler BoolManagedObjectHandler) NSBatchInsertRequest
// Creates a batch-insertion request for a managed entity, and provides an array of data dictionaries for insertion.
InitWithEntityObjects(entity INSEntityDescription, dictionaries foundation.INSDictionary) NSBatchInsertRequest
// Creates a batch-insertion request for a named managed entity, and provides an array of data dictionaries for insertion.
InitWithEntityNameObjects(entityName string, dictionaries foundation.INSDictionary) NSBatchInsertRequest
// A closure that provides a dictionary for your app to insert data into.
DictionaryHandler() objectivec.IObject
SetDictionaryHandler(value objc.ID)
// The managed entity to insert data into.
Entity() INSEntityDescription
// The name of the managed entity to insert data into.
EntityName() string
// A closure that provides a managed object for your app to insert data into.
ManagedObjectHandler() BoolManagedObjectHandler
SetManagedObjectHandler(value BoolManagedObjectHandler)
// An array of dictionaries that represents the objects to insert with the keys as attribute names and their assigned values.
ObjectsToInsert() foundation.INSDictionary
SetObjectsToInsert(value foundation.INSDictionary)
// The type of result that Core Data returns from this request.
ResultType() NSBatchInsertRequestResultType
SetResultType(value NSBatchInsertRequestResultType)
}
An interface definition for the NSBatchInsertRequest class.
Creating a Request ¶
- INSBatchInsertRequest.InitWithEntityManagedObjectHandler: Creates a batch-insertion request for a managed entity, and specifies a closure that inserts data into the entity.
- INSBatchInsertRequest.InitWithEntityNameManagedObjectHandler: Creates a batch-insertion request for a named managed entity, and specifies a closure that inserts data into the entity.
- INSBatchInsertRequest.InitWithEntityObjects: Creates a batch-insertion request for a managed entity, and provides an array of data dictionaries for insertion.
- INSBatchInsertRequest.InitWithEntityNameObjects: Creates a batch-insertion request for a named managed entity, and provides an array of data dictionaries for insertion.
Configuring a Request ¶
- INSBatchInsertRequest.DictionaryHandler: A closure that provides a dictionary for your app to insert data into.
- INSBatchInsertRequest.SetDictionaryHandler
- INSBatchInsertRequest.Entity: The managed entity to insert data into.
- INSBatchInsertRequest.EntityName: The name of the managed entity to insert data into.
- INSBatchInsertRequest.ManagedObjectHandler: A closure that provides a managed object for your app to insert data into.
- INSBatchInsertRequest.SetManagedObjectHandler
- INSBatchInsertRequest.ObjectsToInsert: An array of dictionaries that represents the objects to insert with the keys as attribute names and their assigned values.
- INSBatchInsertRequest.SetObjectsToInsert
- INSBatchInsertRequest.ResultType: The type of result that Core Data returns from this request.
- INSBatchInsertRequest.SetResultType
See: https://developer.apple.com/documentation/CoreData/NSBatchInsertRequest
type INSBatchInsertResult ¶
type INSBatchInsertResult interface {
INSPersistentStoreResult
// The result of a batch-insertion request.
Result() objectivec.IObject
// The type of result that Core Data returns from this request.
ResultType() NSBatchInsertRequestResultType
}
An interface definition for the NSBatchInsertResult class.
Accessing Results ¶
- INSBatchInsertResult.Result: The result of a batch-insertion request.
- INSBatchInsertResult.ResultType: The type of result that Core Data returns from this request.
See: https://developer.apple.com/documentation/CoreData/NSBatchInsertResult
type INSBatchUpdateRequest ¶
type INSBatchUpdateRequest interface {
INSPersistentStoreRequest
// Creates a batch-update request for a managed entity.
InitWithEntity(entity INSEntityDescription) NSBatchUpdateRequest
// Creates a batch-update request for a named managed entity.
InitWithEntityName(entityName string) NSBatchUpdateRequest
// The managed entity to update data for.
Entity() INSEntityDescription
// The name of the managed entity to update data for.
EntityName() string
// A Boolean value that indicates whether to update subentities.
IncludesSubentities() bool
SetIncludesSubentities(value bool)
// A predicate that identifies the objects to update.
Predicate() foundation.NSPredicate
SetPredicate(value foundation.NSPredicate)
// A dictionary of property description pairs that describe the updates.
PropertiesToUpdate() foundation.INSDictionary
SetPropertiesToUpdate(value foundation.INSDictionary)
// The type of result that Core Data returns from the request.
ResultType() NSBatchUpdateRequestResultType
SetResultType(value NSBatchUpdateRequestResultType)
}
An interface definition for the NSBatchUpdateRequest class.
Creating a Request ¶
- INSBatchUpdateRequest.InitWithEntity: Creates a batch-update request for a managed entity.
- INSBatchUpdateRequest.InitWithEntityName: Creates a batch-update request for a named managed entity.
Configuring a Request ¶
- INSBatchUpdateRequest.Entity: The managed entity to update data for.
- INSBatchUpdateRequest.EntityName: The name of the managed entity to update data for.
- INSBatchUpdateRequest.IncludesSubentities: A Boolean value that indicates whether to update subentities.
- INSBatchUpdateRequest.SetIncludesSubentities
- INSBatchUpdateRequest.Predicate: A predicate that identifies the objects to update.
- INSBatchUpdateRequest.SetPredicate
- INSBatchUpdateRequest.PropertiesToUpdate: A dictionary of property description pairs that describe the updates.
- INSBatchUpdateRequest.SetPropertiesToUpdate
- INSBatchUpdateRequest.ResultType: The type of result that Core Data returns from the request.
- INSBatchUpdateRequest.SetResultType
See: https://developer.apple.com/documentation/CoreData/NSBatchUpdateRequest
type INSBatchUpdateResult ¶
type INSBatchUpdateResult interface {
INSPersistentStoreResult
// The result of a batch-update request, either the number of updated objects, the identifiers of the updated objects, or a status value.
Result() objectivec.IObject
// The type of result that Core Data returns from the request.
ResultType() NSBatchUpdateRequestResultType
}
An interface definition for the NSBatchUpdateResult class.
Accessing Results ¶
- INSBatchUpdateResult.Result: The result of a batch-update request, either the number of updated objects, the identifiers of the updated objects, or a status value.
- INSBatchUpdateResult.ResultType: The type of result that Core Data returns from the request.
See: https://developer.apple.com/documentation/CoreData/NSBatchUpdateResult
type INSCompositeAttributeDescription ¶
type INSCompositeAttributeDescription interface {
INSAttributeDescription
// The composed attribute descriptions.
Elements() []NSAttributeDescription
SetElements(value []NSAttributeDescription)
}
An interface definition for the NSCompositeAttributeDescription class.
Composing attributes ¶
- INSCompositeAttributeDescription.Elements: The composed attribute descriptions.
- INSCompositeAttributeDescription.SetElements
See: https://developer.apple.com/documentation/CoreData/NSCompositeAttributeDescription
type INSConstraintConflict ¶
type INSConstraintConflict interface {
objectivec.IObject
// Initializes a constraint conflict.
InitWithConstraintDatabaseObjectDatabaseSnapshotConflictingObjectsConflictingSnapshots(contraint []string, databaseObject INSManagedObject, databaseSnapshot foundation.INSDictionary, conflictingObjects []NSManagedObject, conflictingSnapshots foundation.INSArray) NSConstraintConflict
// The managed objects that are in conflict.
ConflictingObjects() []NSManagedObject
// The original property values of objects in violation of the constraint.
ConflictingSnapshots() foundation.INSDictionary
// The constraint that has been violated.
Constraint() []string
// The values that the conflicting objects had when the conflict was created.
ConstraintValues() foundation.INSDictionary
// The object whose database row is using constraint values.
DatabaseObject() INSManagedObject
// The values currently stored in the database.
DatabaseSnapshot() foundation.INSDictionary
}
An interface definition for the NSConstraintConflict class.
Initializing a Conflict ¶
- INSConstraintConflict.InitWithConstraintDatabaseObjectDatabaseSnapshotConflictingObjectsConflictingSnapshots: Initializes a constraint conflict.
Inspecting a Conflict ¶
- INSConstraintConflict.ConflictingObjects: The managed objects that are in conflict.
- INSConstraintConflict.ConflictingSnapshots: The original property values of objects in violation of the constraint.
- INSConstraintConflict.Constraint: The constraint that has been violated.
- INSConstraintConflict.ConstraintValues: The values that the conflicting objects had when the conflict was created.
- INSConstraintConflict.DatabaseObject: The object whose database row is using constraint values.
- INSConstraintConflict.DatabaseSnapshot: The values currently stored in the database.
See: https://developer.apple.com/documentation/CoreData/NSConstraintConflict
type INSCoreDataCoreSpotlightDelegate ¶
type INSCoreDataCoreSpotlightDelegate interface {
objectivec.IObject
// Creates a Core Spotlight delegate with the specified store description and coordinator.
InitForStoreWithDescriptionCoordinator(description INSPersistentStoreDescription, psc INSPersistentStoreCoordinator) NSCoreDataCoreSpotlightDelegate
// A Boolean value that indicates whether Core Data is currently updating the Core Spotlight index with the persistent store’s entities.
IsIndexingEnabled() bool
// Returns the domain identifier.
DomainIdentifier() string
// Returns the index’s name.
IndexName() string
// Returns the searchable attributes for the specified managed object.
AttributeSetForObject(object INSManagedObject) corespotlight.CSSearchableItemAttributeSet
// Deletes all searchable items from the configured index.
DeleteSpotlightIndexWithCompletionHandler(completionHandler ErrorHandler)
// Starts the indexing of the store’s entities.
StartSpotlightIndexing()
// Stops the indexing of the store’s entities.
StopSpotlightIndexing()
// Reindexes all searchable items and clears any local state.
SearchableIndexReindexAllSearchableItemsWithAcknowledgementHandler(searchableIndex *corespotlight.CSSearchableIndex, acknowledgementHandler VoidHandler)
// Reindexes the searchable items for the specified identifiers.
SearchableIndexReindexSearchableItemsWithIdentifiersAcknowledgementHandler(searchableIndex *corespotlight.CSSearchableIndex, identifiers []string, acknowledgementHandler VoidHandler)
}
An interface definition for the NSCoreDataCoreSpotlightDelegate class.
Creating a Core Spotlight Delegate ¶
- INSCoreDataCoreSpotlightDelegate.InitForStoreWithDescriptionCoordinator: Creates a Core Spotlight delegate with the specified store description and coordinator.
Configuring the Index ¶
- INSCoreDataCoreSpotlightDelegate.IsIndexingEnabled: A Boolean value that indicates whether Core Data is currently updating the Core Spotlight index with the persistent store’s entities.
- INSCoreDataCoreSpotlightDelegate.DomainIdentifier: Returns the domain identifier.
- INSCoreDataCoreSpotlightDelegate.IndexName: Returns the index’s name.
Managing the Index ¶
- INSCoreDataCoreSpotlightDelegate.AttributeSetForObject: Returns the searchable attributes for the specified managed object.
- INSCoreDataCoreSpotlightDelegate.DeleteSpotlightIndexWithCompletionHandler: Deletes all searchable items from the configured index.
- INSCoreDataCoreSpotlightDelegate.StartSpotlightIndexing: Starts the indexing of the store’s entities.
- INSCoreDataCoreSpotlightDelegate.StopSpotlightIndexing: Stops the indexing of the store’s entities.
Updating the Index ¶
- INSCoreDataCoreSpotlightDelegate.SearchableIndexReindexAllSearchableItemsWithAcknowledgementHandler: Reindexes all searchable items and clears any local state.
- INSCoreDataCoreSpotlightDelegate.SearchableIndexReindexSearchableItemsWithIdentifiersAcknowledgementHandler: Reindexes the searchable items for the specified identifiers.
See: https://developer.apple.com/documentation/CoreData/NSCoreDataCoreSpotlightDelegate
type INSCustomMigrationStage ¶
type INSCustomMigrationStage interface {
INSMigrationStage
// The reference that represents the migration’s source model.
CurrentModel() INSManagedObjectModelReference
// The reference that represents the migration’s destination model.
NextModel() INSManagedObjectModelReference
// The handler to execute before the stage runs.
WillMigrateHandler() objectivec.IObject
SetWillMigrateHandler(value objectivec.IObject)
// The handler to execute after the stage runs.
DidMigrateHandler() objectivec.IObject
SetDidMigrateHandler(value objectivec.IObject)
}
An interface definition for the NSCustomMigrationStage class.
Accessing model references ¶
- INSCustomMigrationStage.CurrentModel: The reference that represents the migration’s source model.
- INSCustomMigrationStage.NextModel: The reference that represents the migration’s destination model.
Assigning event handlers ¶
- INSCustomMigrationStage.WillMigrateHandler: The handler to execute before the stage runs.
- INSCustomMigrationStage.SetWillMigrateHandler
- INSCustomMigrationStage.DidMigrateHandler: The handler to execute after the stage runs.
- INSCustomMigrationStage.SetDidMigrateHandler
See: https://developer.apple.com/documentation/CoreData/NSCustomMigrationStage
type INSDerivedAttributeDescription ¶
type INSDerivedAttributeDescription interface {
INSAttributeDescription
// An expression for generating derived data.
DerivationExpression() foundation.NSExpression
SetDerivationExpression(value foundation.NSExpression)
}
An interface definition for the NSDerivedAttributeDescription class.
Specifying the Derivation Expression ¶
- INSDerivedAttributeDescription.DerivationExpression: An expression for generating derived data.
- INSDerivedAttributeDescription.SetDerivationExpression
See: https://developer.apple.com/documentation/CoreData/NSDerivedAttributeDescription
type INSEntityDescription ¶
type INSEntityDescription interface {
objectivec.IObject
// The entity name of the receiver.
Name() string
SetName(value string)
// The managed object model with which the receiver is associated.
ManagedObjectModel() INSManagedObjectModel
// The name of the class that represents the receiver’s entity.
ManagedObjectClassName() string
SetManagedObjectClassName(value string)
// The renaming identifier for the receiver.
RenamingIdentifier() string
SetRenamingIdentifier(value string)
// A Boolean value that indicates whether the receiver represents an abstract entity.
IsAbstract() bool
SetAbstract(value bool)
// The user info dictionary of the receiver.
UserInfo() foundation.INSDictionary
SetUserInfo(value foundation.INSDictionary)
// The expression that computes the CoreSpotlight display name for instances of the entity.
CoreSpotlightDisplayNameExpression() foundation.NSExpression
SetCoreSpotlightDisplayNameExpression(value foundation.NSExpression)
// A dictionary containing the receiver’s sub-entities.
SubentitiesByName() foundation.INSDictionary
// An array containing the sub-entities of the receiver.
Subentities() []NSEntityDescription
SetSubentities(value []NSEntityDescription)
// The super-entity of the receiver.
Superentity() INSEntityDescription
// Returns a Boolean value that indicates whether the receiver is a sub-entity of another given entity.
IsKindOfEntity(entity INSEntityDescription) bool
// A dictionary containing the properties of the receiver.
PropertiesByName() foundation.INSDictionary
// An array containing the properties of the receiver.
Properties() []NSPropertyDescription
SetProperties(value []NSPropertyDescription)
// The attributes of the receiver in a dictionary.
AttributesByName() foundation.INSDictionary
// The relationships of the receiver in a dictionary.
RelationshipsByName() foundation.INSDictionary
// Returns an array containing the relationships of the receiver where the entity description of the relationship is a given entity.
RelationshipsWithDestinationEntity(entity INSEntityDescription) []NSRelationshipDescription
// An array of fetch index descriptions for the entity.
Indexes() []NSFetchIndexDescription
SetIndexes(value []NSFetchIndexDescription)
// An array of arrays that contains one or more attributes with a value that must be unique over the instances of that entity.
UniquenessConstraints() []foundation.NSArray
SetUniquenessConstraints(value []foundation.NSArray)
// The version hash for the receiver.
VersionHash() foundation.NSData
// The version hash modifier for the receiver.
VersionHashModifier() string
SetVersionHashModifier(value string)
EncodeWithCoder(coder foundation.INSCoder)
}
An interface definition for the NSEntityDescription class.
Getting descriptive information ¶
- INSEntityDescription.Name: The entity name of the receiver.
- INSEntityDescription.SetName
- INSEntityDescription.ManagedObjectModel: The managed object model with which the receiver is associated.
- INSEntityDescription.ManagedObjectClassName: The name of the class that represents the receiver’s entity.
- INSEntityDescription.SetManagedObjectClassName
- INSEntityDescription.RenamingIdentifier: The renaming identifier for the receiver.
- INSEntityDescription.SetRenamingIdentifier
- INSEntityDescription.IsAbstract: A Boolean value that indicates whether the receiver represents an abstract entity.
- INSEntityDescription.SetAbstract
- INSEntityDescription.UserInfo: The user info dictionary of the receiver.
- INSEntityDescription.SetUserInfo
- INSEntityDescription.CoreSpotlightDisplayNameExpression: The expression that computes the CoreSpotlight display name for instances of the entity.
- INSEntityDescription.SetCoreSpotlightDisplayNameExpression
Managing inheritance ¶
- INSEntityDescription.SubentitiesByName: A dictionary containing the receiver’s sub-entities.
- INSEntityDescription.Subentities: An array containing the sub-entities of the receiver.
- INSEntityDescription.SetSubentities
- INSEntityDescription.Superentity: The super-entity of the receiver.
- INSEntityDescription.IsKindOfEntity: Returns a Boolean value that indicates whether the receiver is a sub-entity of another given entity.
Working with properties ¶
- INSEntityDescription.PropertiesByName: A dictionary containing the properties of the receiver.
- INSEntityDescription.Properties: An array containing the properties of the receiver.
- INSEntityDescription.SetProperties
- INSEntityDescription.AttributesByName: The attributes of the receiver in a dictionary.
- INSEntityDescription.RelationshipsByName: The relationships of the receiver in a dictionary.
- INSEntityDescription.RelationshipsWithDestinationEntity: Returns an array containing the relationships of the receiver where the entity description of the relationship is a given entity.
Configuring indexes and constraints ¶
- INSEntityDescription.Indexes: An array of fetch index descriptions for the entity.
- INSEntityDescription.SetIndexes
- INSEntityDescription.UniquenessConstraints: An array of arrays that contains one or more attributes with a value that must be unique over the instances of that entity.
- INSEntityDescription.SetUniquenessConstraints
Managing versioning ¶
- INSEntityDescription.VersionHash: The version hash for the receiver.
- INSEntityDescription.VersionHashModifier: The version hash modifier for the receiver.
- INSEntityDescription.SetVersionHashModifier
See: https://developer.apple.com/documentation/CoreData/NSEntityDescription
type INSEntityMapping ¶
type INSEntityMapping interface {
objectivec.IObject
// The source entity name for the entity mapping.
SourceEntityName() string
SetSourceEntityName(value string)
// The version hash of the source entity for the entity mapping.
SourceEntityVersionHash() foundation.NSData
SetSourceEntityVersionHash(value foundation.NSData)
// The source expression for the entity mapping.
SourceExpression() foundation.NSExpression
SetSourceExpression(value foundation.NSExpression)
// The destination entity name for the entity mapping.
DestinationEntityName() string
SetDestinationEntityName(value string)
// The version hash for the destination entity for the entity mapping.
DestinationEntityVersionHash() foundation.NSData
SetDestinationEntityVersionHash(value foundation.NSData)
// The name of the entity mapping.
Name() string
SetName(value string)
// The mapping type for the entity mapping.
MappingType() NSEntityMappingType
SetMappingType(value NSEntityMappingType)
// The class name of the migration policy for the entity mapping.
EntityMigrationPolicyClassName() string
SetEntityMigrationPolicyClassName(value string)
// The array of attribute mappings for the entity mapping.
AttributeMappings() []NSPropertyMapping
SetAttributeMappings(value []NSPropertyMapping)
// The array of relationship mappings for the entity mapping.
RelationshipMappings() []NSPropertyMapping
SetRelationshipMappings(value []NSPropertyMapping)
// The user info dictionary for the entity mapping.
UserInfo() foundation.INSDictionary
SetUserInfo(value foundation.INSDictionary)
}
An interface definition for the NSEntityMapping class.
Managing Source Information ¶
- INSEntityMapping.SourceEntityName: The source entity name for the entity mapping.
- INSEntityMapping.SetSourceEntityName
- INSEntityMapping.SourceEntityVersionHash: The version hash of the source entity for the entity mapping.
- INSEntityMapping.SetSourceEntityVersionHash
- INSEntityMapping.SourceExpression: The source expression for the entity mapping.
- INSEntityMapping.SetSourceExpression
Managing Destination Information ¶
- INSEntityMapping.DestinationEntityName: The destination entity name for the entity mapping.
- INSEntityMapping.SetDestinationEntityName
- INSEntityMapping.DestinationEntityVersionHash: The version hash for the destination entity for the entity mapping.
- INSEntityMapping.SetDestinationEntityVersionHash
Managing Mapping Information ¶
- INSEntityMapping.Name: The name of the entity mapping.
- INSEntityMapping.SetName
- INSEntityMapping.MappingType: The mapping type for the entity mapping.
- INSEntityMapping.SetMappingType
- INSEntityMapping.EntityMigrationPolicyClassName: The class name of the migration policy for the entity mapping.
- INSEntityMapping.SetEntityMigrationPolicyClassName
- INSEntityMapping.AttributeMappings: The array of attribute mappings for the entity mapping.
- INSEntityMapping.SetAttributeMappings
- INSEntityMapping.RelationshipMappings: The array of relationship mappings for the entity mapping.
- INSEntityMapping.SetRelationshipMappings
- INSEntityMapping.UserInfo: The user info dictionary for the entity mapping.
- INSEntityMapping.SetUserInfo
See: https://developer.apple.com/documentation/CoreData/NSEntityMapping
type INSEntityMigrationPolicy ¶
type INSEntityMigrationPolicy interface {
objectivec.IObject
// Sets up state information before the start of a given entity mapping.
BeginEntityMappingManagerError(mapping INSEntityMapping, manager INSMigrationManager) (bool, error)
// Creates the destination instance(s) for a given source instance.
CreateDestinationInstancesForSourceInstanceEntityMappingManagerError(sInstance INSManagedObject, mapping INSEntityMapping, manager INSMigrationManager) (bool, error)
// Indicates the end of the instance creation stage for the specified entity mapping, and the precursor to the next migration stage.
EndInstanceCreationForEntityMappingManagerError(mapping INSEntityMapping, manager INSMigrationManager) (bool, error)
// Constructs the relationships between the newly-created destination instances.
CreateRelationshipsForDestinationInstanceEntityMappingManagerError(dInstance INSManagedObject, mapping INSEntityMapping, manager INSMigrationManager) (bool, error)
// Indicates the end of the relationship creation stage for the specified entity mapping.
EndRelationshipCreationForEntityMappingManagerError(mapping INSEntityMapping, manager INSMigrationManager) (bool, error)
// Provides the option to perform custom validation on migrated objects during the validation stage of the entity migration policy.
PerformCustomValidationForEntityMappingManagerError(mapping INSEntityMapping, manager INSMigrationManager) (bool, error)
// Performs cleanup at the end of the migration, from any phase of the mapping.
EndEntityMappingManagerError(mapping INSEntityMapping, manager INSMigrationManager) (bool, error)
}
An interface definition for the NSEntityMigrationPolicy class.
Customizing Stages of the Mapping Life Cycle ¶
- INSEntityMigrationPolicy.BeginEntityMappingManagerError: Sets up state information before the start of a given entity mapping.
- INSEntityMigrationPolicy.CreateDestinationInstancesForSourceInstanceEntityMappingManagerError: Creates the destination instance(s) for a given source instance.
- INSEntityMigrationPolicy.EndInstanceCreationForEntityMappingManagerError: Indicates the end of the instance creation stage for the specified entity mapping, and the precursor to the next migration stage.
- INSEntityMigrationPolicy.CreateRelationshipsForDestinationInstanceEntityMappingManagerError: Constructs the relationships between the newly-created destination instances.
- INSEntityMigrationPolicy.EndRelationshipCreationForEntityMappingManagerError: Indicates the end of the relationship creation stage for the specified entity mapping.
- INSEntityMigrationPolicy.PerformCustomValidationForEntityMappingManagerError: Provides the option to perform custom validation on migrated objects during the validation stage of the entity migration policy.
- INSEntityMigrationPolicy.EndEntityMappingManagerError: Performs cleanup at the end of the migration, from any phase of the mapping.
See: https://developer.apple.com/documentation/CoreData/NSEntityMigrationPolicy
type INSExpressionDescription ¶
type INSExpressionDescription interface {
INSPropertyDescription
// The expression to evaluate.
Expression() foundation.NSExpression
SetExpression(value foundation.NSExpression)
// The attribute type of the expression’s result.
ExpressionResultType() NSAttributeType
SetExpressionResultType(value NSAttributeType)
}
An interface definition for the NSExpressionDescription class.
Configuring the Expression Description ¶
- INSExpressionDescription.Expression: The expression to evaluate.
- INSExpressionDescription.SetExpression
- INSExpressionDescription.ExpressionResultType: The attribute type of the expression’s result.
- INSExpressionDescription.SetExpressionResultType
See: https://developer.apple.com/documentation/CoreData/NSExpressionDescription
type INSFetchIndexDescription ¶
type INSFetchIndexDescription interface {
objectivec.IObject
// Creates a fetch index description using the specified name and element descriptions.
InitWithNameElements(name string, elements []NSFetchIndexElementDescription) NSFetchIndexDescription
// An array of fetch index element descriptions.
Elements() []NSFetchIndexElementDescription
SetElements(value []NSFetchIndexElementDescription)
// The entity description for the fetch index description.
Entity() INSEntityDescription
// The name of the fetch index description.
Name() string
SetName(value string)
// A predicate that selects rows for indexing, if the index is a partial index.
PartialIndexPredicate() foundation.NSPredicate
SetPartialIndexPredicate(value foundation.NSPredicate)
EncodeWithCoder(coder foundation.INSCoder)
}
An interface definition for the NSFetchIndexDescription class.
Creating an Index Description ¶
- INSFetchIndexDescription.InitWithNameElements: Creates a fetch index description using the specified name and element descriptions.
Inspecting an Index Description ¶
- INSFetchIndexDescription.Elements: An array of fetch index element descriptions.
- INSFetchIndexDescription.SetElements
- INSFetchIndexDescription.Entity: The entity description for the fetch index description.
- INSFetchIndexDescription.Name: The name of the fetch index description.
- INSFetchIndexDescription.SetName
- INSFetchIndexDescription.PartialIndexPredicate: A predicate that selects rows for indexing, if the index is a partial index.
- INSFetchIndexDescription.SetPartialIndexPredicate
See: https://developer.apple.com/documentation/CoreData/NSFetchIndexDescription
type INSFetchIndexElementDescription ¶
type INSFetchIndexElementDescription interface {
objectivec.IObject
// Creates an index element description using the specified property description and collation type.
InitWithPropertyCollationType(property INSPropertyDescription, collationType NSFetchIndexElementType) NSFetchIndexElementDescription
// The type of collation that the index element uses, either binary or R-tree.
CollationType() NSFetchIndexElementType
SetCollationType(value NSFetchIndexElementType)
IndexDescription() INSFetchIndexDescription
// A Boolean value that controls whether an index that supports direction is an ascending or descending index.
IsAscending() bool
SetAscending(value bool)
// A property description.
Property() INSPropertyDescription
// The specified name in the property description.
PropertyName() string
EncodeWithCoder(coder foundation.INSCoder)
}
An interface definition for the NSFetchIndexElementDescription class.
Creating an Index Element Description ¶
- INSFetchIndexElementDescription.InitWithPropertyCollationType: Creates an index element description using the specified property description and collation type.
Inspecting an Index Element Description ¶
- INSFetchIndexElementDescription.CollationType: The type of collation that the index element uses, either binary or R-tree.
- INSFetchIndexElementDescription.SetCollationType
- INSFetchIndexElementDescription.IndexDescription
- INSFetchIndexElementDescription.IsAscending: A Boolean value that controls whether an index that supports direction is an ascending or descending index.
- INSFetchIndexElementDescription.SetAscending
- INSFetchIndexElementDescription.Property: A property description.
- INSFetchIndexElementDescription.PropertyName: The specified name in the property description.
See: https://developer.apple.com/documentation/CoreData/NSFetchIndexElementDescription
type INSFetchRequest ¶
type INSFetchRequest interface {
INSPersistentStoreRequest
// Initializes a fetch request configured with a given entity name.
InitWithEntityName(entityName string) NSFetchRequest
// The name of the entity the request is configured to fetch.
EntityName() string
// The entity specified for the fetch request.
Entity() INSEntityDescription
SetEntity(value INSEntityDescription)
// A Boolean value that indicates whether the fetch request includes subentities in the results.
IncludesSubentities() bool
SetIncludesSubentities(value bool)
// The predicate of the fetch request.
Predicate() foundation.NSPredicate
SetPredicate(value foundation.NSPredicate)
// The fetch limit of the fetch request.
FetchLimit() uint
SetFetchLimit(value uint)
// The fetch offset of the fetch request.
FetchOffset() uint
SetFetchOffset(value uint)
// The batch size of the objects specified in the fetch request.
FetchBatchSize() uint
SetFetchBatchSize(value uint)
// The sort descriptors of the fetch request.
SortDescriptors() []foundation.NSSortDescriptor
SetSortDescriptors(value []foundation.NSSortDescriptor)
// The relationship key paths to prefetch along with the entity for the request.
RelationshipKeyPathsForPrefetching() []string
SetRelationshipKeyPathsForPrefetching(value []string)
// The result type of the fetch request.
ResultType() NSFetchRequestResultType
SetResultType(value NSFetchRequestResultType)
// A Boolean value that indicates whether, when the fetch is executed, it matches against currently unsaved changes in the managed object context.
IncludesPendingChanges() bool
SetIncludesPendingChanges(value bool)
// A collection of either property descriptions or string property names that specify which properties should be returned by the fetch.
PropertiesToFetch() foundation.INSArray
SetPropertiesToFetch(value foundation.INSArray)
// A Boolean value that indicates whether the fetch request returns only distinct values for the fields specified by [propertiesToFetch](<https://developer.apple.com/documentation/CoreData/NSFetchRequest/propertiesToFetch>).
ReturnsDistinctResults() bool
SetReturnsDistinctResults(value bool)
// A Boolean value that indicates whether, when the fetch is executed, property data is obtained from the persistent store.
IncludesPropertyValues() bool
SetIncludesPropertyValues(value bool)
// A Boolean value that indicates whether the property values of fetched objects will be updated with the current values in the persistent store.
ShouldRefreshRefetchedObjects() bool
SetShouldRefreshRefetchedObjects(value bool)
// A Boolean value that indicates whether the objects resulting from a fetch request are faults.
ReturnsObjectsAsFaults() bool
SetReturnsObjectsAsFaults(value bool)
// An array of objects that indicates how data should be grouped before a select statement is run in a SQL database.
PropertiesToGroupBy() foundation.INSArray
SetPropertiesToGroupBy(value foundation.INSArray)
// The predicate used to filter rows being returned by a query containing a GROUP BY directive.
HavingPredicate() foundation.NSPredicate
SetHavingPredicate(value foundation.NSPredicate)
// Executes the fetch request against the managed object context that is associated with the current queue.
Execute() ([]objectivec.IObject, error)
}
An interface definition for the NSFetchRequest class.
Managing the Fetch Request’s Entity ¶
- INSFetchRequest.InitWithEntityName: Initializes a fetch request configured with a given entity name.
- INSFetchRequest.EntityName: The name of the entity the request is configured to fetch.
- INSFetchRequest.Entity: The entity specified for the fetch request.
- INSFetchRequest.SetEntity
- INSFetchRequest.IncludesSubentities: A Boolean value that indicates whether the fetch request includes subentities in the results.
- INSFetchRequest.SetIncludesSubentities
Specifying Fetch Constraints ¶
- INSFetchRequest.Predicate: The predicate of the fetch request.
- INSFetchRequest.SetPredicate
- INSFetchRequest.FetchLimit: The fetch limit of the fetch request.
- INSFetchRequest.SetFetchLimit
- INSFetchRequest.FetchOffset: The fetch offset of the fetch request.
- INSFetchRequest.SetFetchOffset
- INSFetchRequest.FetchBatchSize: The batch size of the objects specified in the fetch request.
- INSFetchRequest.SetFetchBatchSize
Sorting the Results ¶
- INSFetchRequest.SortDescriptors: The sort descriptors of the fetch request.
- INSFetchRequest.SetSortDescriptors
Prefetching Related Objects ¶
- INSFetchRequest.RelationshipKeyPathsForPrefetching: The relationship key paths to prefetch along with the entity for the request.
- INSFetchRequest.SetRelationshipKeyPathsForPrefetching
Managing How Results Are Returned ¶
- INSFetchRequest.ResultType: The result type of the fetch request.
- INSFetchRequest.SetResultType
- INSFetchRequest.IncludesPendingChanges: A Boolean value that indicates whether, when the fetch is executed, it matches against currently unsaved changes in the managed object context.
- INSFetchRequest.SetIncludesPendingChanges
- INSFetchRequest.PropertiesToFetch: A collection of either property descriptions or string property names that specify which properties should be returned by the fetch.
- INSFetchRequest.SetPropertiesToFetch
- INSFetchRequest.ReturnsDistinctResults: A Boolean value that indicates whether the fetch request returns only distinct values for the fields specified by [propertiesToFetch](<https://developer.apple.com/documentation/CoreData/NSFetchRequest/propertiesToFetch>).
- INSFetchRequest.SetReturnsDistinctResults
- INSFetchRequest.IncludesPropertyValues: A Boolean value that indicates whether, when the fetch is executed, property data is obtained from the persistent store.
- INSFetchRequest.SetIncludesPropertyValues
- INSFetchRequest.ShouldRefreshRefetchedObjects: A Boolean value that indicates whether the property values of fetched objects will be updated with the current values in the persistent store.
- INSFetchRequest.SetShouldRefreshRefetchedObjects
- INSFetchRequest.ReturnsObjectsAsFaults: A Boolean value that indicates whether the objects resulting from a fetch request are faults.
- INSFetchRequest.SetReturnsObjectsAsFaults
Grouping and Filtering Dictionary Results ¶
- INSFetchRequest.PropertiesToGroupBy: An array of objects that indicates how data should be grouped before a select statement is run in a SQL database.
- INSFetchRequest.SetPropertiesToGroupBy
- INSFetchRequest.HavingPredicate: The predicate used to filter rows being returned by a query containing a GROUP BY directive.
- INSFetchRequest.SetHavingPredicate
Executing a Fetch Request Directly ¶
- INSFetchRequest.Execute: Executes the fetch request against the managed object context that is associated with the current queue.
See: https://developer.apple.com/documentation/CoreData/NSFetchRequest
type INSFetchRequestExpression ¶
type INSFetchRequestExpression interface {
foundation.INSExpression
// The expression for the receiver’s fetch request.
RequestExpression() foundation.NSExpression
// The expression for the receiver’s managed object context.
ContextExpression() foundation.NSExpression
// Returns a Boolean value that indicates whether the receiver represents a count-only fetch request.
IsCountOnlyRequest() bool
}
An interface definition for the NSFetchRequestExpression class.
Examining a Fetch Request Expression ¶
- INSFetchRequestExpression.RequestExpression: The expression for the receiver’s fetch request.
- INSFetchRequestExpression.ContextExpression: The expression for the receiver’s managed object context.
- INSFetchRequestExpression.IsCountOnlyRequest: Returns a Boolean value that indicates whether the receiver represents a count-only fetch request.
See: https://developer.apple.com/documentation/CoreData/NSFetchRequestExpression
type INSFetchedPropertyDescription ¶
type INSFetchedPropertyDescription interface {
INSPropertyDescription
// The fetch request of the receiver.
FetchRequest() INSFetchRequest
SetFetchRequest(value INSFetchRequest)
}
An interface definition for the NSFetchedPropertyDescription class.
Getting and setting the fetch request ¶
- INSFetchedPropertyDescription.FetchRequest: The fetch request of the receiver.
- INSFetchedPropertyDescription.SetFetchRequest
See: https://developer.apple.com/documentation/CoreData/NSFetchedPropertyDescription
type INSFetchedResultsController ¶
type INSFetchedResultsController interface {
objectivec.IObject
// Returns a fetch request controller initialized using the given arguments.
InitWithFetchRequestManagedObjectContextSectionNameKeyPathCacheName(fetchRequest INSFetchRequest, context INSManagedObjectContext, sectionNameKeyPath string, name string) NSFetchedResultsController
// Executes the controller’s fetch request.
PerformFetch() (bool, error)
// The fetch request used to do the fetching.
FetchRequest() INSFetchRequest
// The managed object context used to fetch objects.
ManagedObjectContext() INSManagedObjectContext
// The key path of the attribute that determines which section the fetched entity belongs to.
SectionNameKeyPath() string
// The name of the file used to cache section information.
CacheName() string
// The object that is notified when the fetched results changed.
Delegate() NSFetchedResultsControllerDelegate
SetDelegate(value NSFetchedResultsControllerDelegate)
// The results of the fetch.
FetchedObjects() []objectivec.IObject
// Returns the object at the given index path in the fetch results.
ObjectAtIndexPath(indexPath foundation.NSIndexPath) unsafe.Pointer
// Returns the index path of a given object.
IndexPathForObject(object unsafe.Pointer) foundation.NSIndexPath
// The sections for the fetch results.
Sections() []objectivec.IObject
// Returns the section number for a given section title and index in the section index.
SectionForSectionIndexTitleAtIndex(title string, sectionIndex int) int
// Returns the corresponding section index entry for a given section name.
SectionIndexTitleForSectionName(sectionName string) string
// The array of section index titles.
SectionIndexTitles() []string
}
An interface definition for the NSFetchedResultsController class.
Initializing a Fetched Results Controller ¶
- INSFetchedResultsController.InitWithFetchRequestManagedObjectContextSectionNameKeyPathCacheName: Returns a fetch request controller initialized using the given arguments.
- INSFetchedResultsController.PerformFetch: Executes the controller’s fetch request.
Getting Configuration Information ¶
- INSFetchedResultsController.FetchRequest: The fetch request used to do the fetching.
- INSFetchedResultsController.ManagedObjectContext: The managed object context used to fetch objects.
- INSFetchedResultsController.SectionNameKeyPath: The key path of the attribute that determines which section the fetched entity belongs to.
- INSFetchedResultsController.CacheName: The name of the file used to cache section information.
- INSFetchedResultsController.Delegate: The object that is notified when the fetched results changed.
- INSFetchedResultsController.SetDelegate
Accessing Results ¶
- INSFetchedResultsController.FetchedObjects: The results of the fetch.
- INSFetchedResultsController.ObjectAtIndexPath: Returns the object at the given index path in the fetch results.
- INSFetchedResultsController.IndexPathForObject: Returns the index path of a given object.
Querying Section Information ¶
- INSFetchedResultsController.Sections: The sections for the fetch results.
- INSFetchedResultsController.SectionForSectionIndexTitleAtIndex: Returns the section number for a given section title and index in the section index.
Configuring Section Information ¶
- INSFetchedResultsController.SectionIndexTitleForSectionName: Returns the corresponding section index entry for a given section name.
- INSFetchedResultsController.SectionIndexTitles: The array of section index titles.
See: https://developer.apple.com/documentation/CoreData/NSFetchedResultsController
type INSIncrementalStore ¶
type INSIncrementalStore interface {
INSPersistentStore
// Returns a value as appropriate for the given request, or nil if the request cannot be completed.
ExecuteRequestWithContextError(request INSPersistentStoreRequest, context INSManagedObjectContext) (objectivec.IObject, error)
// Returns an incremental store node encapsulating the persistent external values of the object with a given object ID.
NewValuesForObjectWithIDWithContextError(objectID INSManagedObjectID, context INSManagedObjectContext) (INSIncrementalStoreNode, error)
// Returns the relationship for the given relationship of the object with a given object ID.
NewValueForRelationshipForObjectWithIDWithContextError(relationship INSRelationshipDescription, objectID INSManagedObjectID, context INSManagedObjectContext) (objectivec.IObject, error)
// Returns an array containing the object IDs for a given array of newly-inserted objects.
ObtainPermanentIDsForObjectsError(array []NSManagedObject) ([]NSManagedObjectID, error)
// Returns a new object ID that uses given data as the key.
NewObjectIDForEntityReferenceObject(entity INSEntityDescription, data objectivec.IObject) INSManagedObjectID
// Returns the reference data used to construct a given object ID.
ReferenceObjectForObjectID(objectID INSManagedObjectID) objectivec.IObject
// Indicates that objects identified by a given array of object IDs are in use in a managed object context.
ManagedObjectContextDidRegisterObjectsWithIDs(objectIDs []NSManagedObjectID)
// Indicates that objects identified by a given array of object IDs are no longer being used by a managed object context.
ManagedObjectContextDidUnregisterObjectsWithIDs(objectIDs []NSManagedObjectID)
}
An interface definition for the NSIncrementalStore class.
Manipulating Managed Objects ¶
- INSIncrementalStore.ExecuteRequestWithContextError: Returns a value as appropriate for the given request, or nil if the request cannot be completed.
- INSIncrementalStore.NewValuesForObjectWithIDWithContextError: Returns an incremental store node encapsulating the persistent external values of the object with a given object ID.
- INSIncrementalStore.NewValueForRelationshipForObjectWithIDWithContextError: Returns the relationship for the given relationship of the object with a given object ID.
- INSIncrementalStore.ObtainPermanentIDsForObjectsError: Returns an array containing the object IDs for a given array of newly-inserted objects.
- INSIncrementalStore.NewObjectIDForEntityReferenceObject: Returns a new object ID that uses given data as the key.
- INSIncrementalStore.ReferenceObjectForObjectID: Returns the reference data used to construct a given object ID.
Responding to Context Changes ¶
- INSIncrementalStore.ManagedObjectContextDidRegisterObjectsWithIDs: Indicates that objects identified by a given array of object IDs are in use in a managed object context.
- INSIncrementalStore.ManagedObjectContextDidUnregisterObjectsWithIDs: Indicates that objects identified by a given array of object IDs are no longer being used by a managed object context.
See: https://developer.apple.com/documentation/CoreData/NSIncrementalStore
type INSIncrementalStoreNode ¶
type INSIncrementalStoreNode interface {
objectivec.IObject
// Returns an object initialized with the given values.
InitWithObjectIDWithValuesVersion(objectID INSManagedObjectID, values foundation.INSDictionary, version uint64) NSIncrementalStoreNode
// The object ID that identifies the data stored by the receiver.
ObjectID() INSManagedObjectID
// Update the values and version to reflect new data being saved to or loaded from the external store.
UpdateWithValuesVersion(values foundation.INSDictionary, version uint64)
// Returns the value for the given property.
ValueForPropertyDescription(prop INSPropertyDescription) objectivec.IObject
// The version of data in the receiver.
Version() uint64
}
An interface definition for the NSIncrementalStoreNode class.
Initializing a Node ¶
- INSIncrementalStoreNode.InitWithObjectIDWithValuesVersion: Returns an object initialized with the given values.
Managing Node Data ¶
- INSIncrementalStoreNode.ObjectID: The object ID that identifies the data stored by the receiver.
- INSIncrementalStoreNode.UpdateWithValuesVersion: Update the values and version to reflect new data being saved to or loaded from the external store.
- INSIncrementalStoreNode.ValueForPropertyDescription: Returns the value for the given property.
- INSIncrementalStoreNode.Version: The version of data in the receiver.
See: https://developer.apple.com/documentation/CoreData/NSIncrementalStoreNode
type INSLightweightMigrationStage ¶
type INSLightweightMigrationStage interface {
INSMigrationStage
// The array of version checksums.
VersionChecksums() []string
}
An interface definition for the NSLightweightMigrationStage class.
Accessing the checksums ¶
- INSLightweightMigrationStage.VersionChecksums: The array of version checksums.
See: https://developer.apple.com/documentation/CoreData/NSLightweightMigrationStage
type INSManagedObject ¶
type INSManagedObject interface {
objectivec.IObject
NSFetchRequestResult
// Initializes a managed object from an entity description and inserts it into the specified managed object context.
InitWithEntityInsertIntoManagedObjectContext(entity INSEntityDescription, context INSManagedObjectContext) NSManagedObject
// Initializes a managed object subclass and inserts it into the specified managed object context.
InitWithContext(moc INSManagedObjectContext) NSManagedObject
// The entity description of the managed object.
Entity() INSEntityDescription
// The object ID of the managed object.
ObjectID() INSManagedObjectID
// The managed object context with which the managed object is registered.
ManagedObjectContext() INSManagedObjectContext
// A Boolean value that indicates whether the managed object has been inserted, has been deleted, or has unsaved changes.
HasChanges() bool
// A Boolean value that indicates whether the managed object has been inserted in a managed object context.
IsInserted() bool
// A Boolean value that indicates whether the managed object has unsaved changes.
IsUpdated() bool
// A Boolean value that indicates whether the managed object will be deleted during the next save.
IsDeleted() bool
// A Boolean value that indicates whether the managed object is a fault.
IsFault() bool
// The faulting state of the managed object.
FaultingState() uint
// Returns a Boolean value that indicates whether the relationship for a given key is a fault.
HasFaultForRelationshipNamed(key string) bool
// A Boolean value that indicates whether the managed object has persistent changes.
HasPersistentChangedValues() bool
// Provides an opportunity to add code into the life cycle of the managed object when fufilling it from a fault.
AwakeFromFetch()
// Provides an opportunity to add code into the life cycle of the managed object when initially creating it.
AwakeFromInsert()
// Provides an opportunity to add code into the life cycle of the managed object when fulfilling it from a snapshot.
AwakeFromSnapshotEvents(flags NSSnapshotEventType)
// Returns a dictionary containing the keys and new values of persistent properties with changes since the last fetching or saving of the managed object.
ChangedValues() foundation.INSDictionary
// Returns a dictionary containing the keys and new values of persistent properties with changes since the last fetching or saving of the managed object.
ChangedValuesForCurrentEvent() foundation.INSDictionary
// Returns a dictionary of the most recent fetched or saved values of the managed object for the properties of the specified keys.
CommittedValuesForKeys(keys []string) foundation.INSDictionary
// Provides an opportunity to add code into the life cycle of the managed object before deleting it.
PrepareForDeletion()
// Provides an opportunity to add code into the life cycle of the managed object before saving it.
WillSave()
// Provides an opportunity to add code into the life cycle of the managed object after the managed object’s context completes a save operation.
DidSave()
// Provides an opportunity to add code into the life cycle of the managed object before converting it to a fault.
WillTurnIntoFault()
// Provides an opportunity to add code into the life cycle of the managed object after converting it to a fault.
DidTurnIntoFault()
// Returns the value for the specified property from the managed object’s private internal storage .
PrimitiveValueForKey(key string) objectivec.IObject
// Sets the value of a given property in the managed object’s private internal storage.
SetPrimitiveValueForKey(value objectivec.IObject, key string)
// Returns the object IDs for all of the managed objects that are in the named relationship.
ObjectIDsForRelationshipNamed(key string) []NSManagedObjectID
// Determines whether the managed object can be deleted in its current state.
ValidateForDelete() (bool, error)
// Determines whether the managed object can be inserted in its current state.
ValidateForInsert() (bool, error)
// Determines whether the managed object’s current state is valid.
ValidateForUpdate() (bool, error)
// Provides support for key-value observing access notification.
DidAccessValueForKey(key string)
// Returns the observation info of the managed object.
ObservationInfo() unsafe.Pointer
// Sets the observation info of the managed object.
SetObservationInfo(inObservationInfo unsafe.Pointer)
// Provides support for key-value observing access notification.
WillAccessValueForKey(key string)
// Provides an opportunity to respond when a change was made to a specified to-many relationship.
DidChangeValueForKeyWithSetMutationUsingObjects(inKey string, inMutationKind uint, inObjects foundation.INSSet)
// Provides an opportunity to respond when a change is about to be made to a specified to-many relationship.
WillChangeValueForKeyWithSetMutationUsingObjects(inKey string, inMutationKind uint, inObjects foundation.INSSet)
}
An interface definition for the NSManagedObject class.
Creating a Managed Object ¶
- INSManagedObject.InitWithEntityInsertIntoManagedObjectContext: Initializes a managed object from an entity description and inserts it into the specified managed object context.
- INSManagedObject.InitWithContext: Initializes a managed object subclass and inserts it into the specified managed object context.
Getting a Managed Object’s Identity ¶
- INSManagedObject.Entity: The entity description of the managed object.
- INSManagedObject.ObjectID: The object ID of the managed object.
Getting State Information ¶
- INSManagedObject.ManagedObjectContext: The managed object context with which the managed object is registered.
- INSManagedObject.HasChanges: A Boolean value that indicates whether the managed object has been inserted, has been deleted, or has unsaved changes.
- INSManagedObject.IsInserted: A Boolean value that indicates whether the managed object has been inserted in a managed object context.
- INSManagedObject.IsUpdated: A Boolean value that indicates whether the managed object has unsaved changes.
- INSManagedObject.IsDeleted: A Boolean value that indicates whether the managed object will be deleted during the next save.
- INSManagedObject.IsFault: A Boolean value that indicates whether the managed object is a fault.
- INSManagedObject.FaultingState: The faulting state of the managed object.
- INSManagedObject.HasFaultForRelationshipNamed: Returns a Boolean value that indicates whether the relationship for a given key is a fault.
- INSManagedObject.HasPersistentChangedValues: A Boolean value that indicates whether the managed object has persistent changes.
Managing Change Events ¶
- INSManagedObject.AwakeFromFetch: Provides an opportunity to add code into the life cycle of the managed object when fufilling it from a fault.
- INSManagedObject.AwakeFromInsert: Provides an opportunity to add code into the life cycle of the managed object when initially creating it.
- INSManagedObject.AwakeFromSnapshotEvents: Provides an opportunity to add code into the life cycle of the managed object when fulfilling it from a snapshot.
- INSManagedObject.ChangedValues: Returns a dictionary containing the keys and new values of persistent properties with changes since the last fetching or saving of the managed object.
- INSManagedObject.ChangedValuesForCurrentEvent: Returns a dictionary containing the keys and new values of persistent properties with changes since the last fetching or saving of the managed object.
- INSManagedObject.CommittedValuesForKeys: Returns a dictionary of the most recent fetched or saved values of the managed object for the properties of the specified keys.
- INSManagedObject.PrepareForDeletion: Provides an opportunity to add code into the life cycle of the managed object before deleting it.
- INSManagedObject.WillSave: Provides an opportunity to add code into the life cycle of the managed object before saving it.
- INSManagedObject.DidSave: Provides an opportunity to add code into the life cycle of the managed object after the managed object’s context completes a save operation.
- INSManagedObject.WillTurnIntoFault: Provides an opportunity to add code into the life cycle of the managed object before converting it to a fault.
- INSManagedObject.DidTurnIntoFault: Provides an opportunity to add code into the life cycle of the managed object after converting it to a fault.
Supporting Key-Value Coding ¶
- INSManagedObject.PrimitiveValueForKey: Returns the value for the specified property from the managed object’s private internal storage .
- INSManagedObject.SetPrimitiveValueForKey: Sets the value of a given property in the managed object’s private internal storage.
- INSManagedObject.ObjectIDsForRelationshipNamed: Returns the object IDs for all of the managed objects that are in the named relationship.
Managing Data Validation ¶
- INSManagedObject.ValidateForDelete: Determines whether the managed object can be deleted in its current state.
- INSManagedObject.ValidateForInsert: Determines whether the managed object can be inserted in its current state.
- INSManagedObject.ValidateForUpdate: Determines whether the managed object’s current state is valid.
Supporting Key-Value Observing ¶
- INSManagedObject.DidAccessValueForKey: Provides support for key-value observing access notification.
- INSManagedObject.ObservationInfo: Returns the observation info of the managed object.
- INSManagedObject.SetObservationInfo: Sets the observation info of the managed object.
- INSManagedObject.WillAccessValueForKey: Provides support for key-value observing access notification.
- INSManagedObject.DidChangeValueForKeyWithSetMutationUsingObjects: Provides an opportunity to respond when a change was made to a specified to-many relationship.
- INSManagedObject.WillChangeValueForKeyWithSetMutationUsingObjects: Provides an opportunity to respond when a change is about to be made to a specified to-many relationship.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject
type INSManagedObjectContext ¶
type INSManagedObjectContext interface {
objectivec.IObject
// Creates a context that uses the specified concurrency type.
InitWithConcurrencyType(ct NSManagedObjectContextConcurrencyType) NSManagedObjectContext
// The persistent store coordinator of the context.
PersistentStoreCoordinator() INSPersistentStoreCoordinator
SetPersistentStoreCoordinator(value INSPersistentStoreCoordinator)
// The parent of the context.
ParentContext() INSManagedObjectContext
SetParentContext(value INSManagedObjectContext)
// The developer-provided name of the context.
Name() string
SetName(value string)
// The user information for the context.
UserInfo() foundation.INSDictionary
// Returns the number of objects the specified request fetches when it executes.
CountForFetchRequestError(request INSFetchRequest) (uint, error)
// Returns an object that exists in the context.
ObjectRegisteredForID(objectID INSManagedObjectID) INSManagedObject
// Returns either an existing object from the context or a fault that represents that object.
ObjectWithID(objectID INSManagedObjectID) INSManagedObject
// Returns an existing object from either the context or the persistent store.
ExistingObjectWithIDError(objectID INSManagedObjectID) (INSManagedObject, error)
// The set of registered managed objects in the context.
RegisteredObjects() foundation.INSSet
// Passes a request to the persistent store without affecting the contents of the managed object context, and returns a persistent store result.
ExecuteRequestError(request INSPersistentStoreRequest) (INSPersistentStoreResult, error)
// Refreshes all of the registered managed objects in the context.
RefreshAllObjects()
// A Boolean value that indicates whether the context keeps strong references to all registered managed objects.
RetainsRegisteredObjects() bool
SetRetainsRegisteredObjects(value bool)
// A Boolean value that determines whether the context turns inaccessible faults into deleted objects.
ShouldDeleteInaccessibleFaults() bool
SetShouldDeleteInaccessibleFaults(value bool)
// The set of objects that have been inserted into the context but not yet saved in a persistent store.
InsertedObjects() foundation.INSSet
// The set of objects registered with the context that have uncommitted changes.
UpdatedObjects() foundation.INSSet
// The set of objects that will be removed from their persistent store during the next save operation.
DeletedObjects() foundation.INSSet
// Creates a log of the inaccessible fault.
ShouldHandleInaccessibleFaultForObjectIDTriggeredByProperty(fault INSManagedObject, oid INSManagedObjectID, property INSPropertyDescription) bool
// Registers an object to be inserted in the context’s persistent store the next time changes are saved.
InsertObject(object INSManagedObject)
// Specifies an object that should be removed from its persistent store when changes are committed.
DeleteObject(object INSManagedObject)
// Specifies the store in which a newly inserted object will be saved.
AssignObjectToPersistentStore(object objectivec.IObject, store INSPersistentStore)
// Converts to permanent IDs the object IDs of the objects in a given array.
ObtainPermanentIDsForObjectsError(objects []NSManagedObject) (bool, error)
// Marks an object for conflict detection.
DetectConflictsForObject(object INSManagedObject)
// Updates the persistent properties of a managed object to use the latest values from the persistent store.
RefreshObjectMergeChanges(object INSManagedObject, flag bool)
// Forces the context to process changes to the object graph.
ProcessPendingChanges()
// A Boolean value that indicates whether the context automatically merges changes saved to its persistent store coordinator or parent context.
AutomaticallyMergesChangesFromParent() bool
SetAutomaticallyMergesChangesFromParent(value bool)
// The concurrency type for the context.
ConcurrencyType() NSManagedObjectContextConcurrencyType
// The merge policy of the context.
MergePolicy() objectivec.IObject
SetMergePolicy(value objectivec.IObject)
// Returns the token associated with the query generation currently in use by this context.
QueryGenerationToken() INSQueryGenerationToken
// The author for the context that is used as an identifier in persistent history transactions.
TransactionAuthor() string
SetTransactionAuthor(value string)
// Merges the changes specified in a given notification.
MergeChangesFromContextDidSaveNotification(notification foundation.NSNotification)
// Sets the query generation this context should use.
SetQueryGenerationFromTokenError(generation INSQueryGenerationToken) (bool, error)
// Attempts to commit unsaved changes to registered objects to the context’s parent store.
Save() (bool, error)
// A Boolean value that indicates whether the context has uncommitted changes.
HasChanges() bool
// The object that provides undo support for the context.
UndoManager() foundation.UndoManager
SetUndoManager(value foundation.UndoManager)
// Sends an undo message to the context’s undo manager, asking it to reverse the latest uncommitted changes applied to objects in the object graph.
Undo()
// Sends a redo message to the context’s undo manager, asking it to reverse the latest undo operation applied to objects in the object graph.
Redo()
// Returns the context to its base state.
Reset()
// Removes everything from the undo stack, discards all insertions and deletions, and restores updated objects to their last committed values.
Rollback()
// A Boolean value that indicates whether the context propagates deletes at the end of the event in which a change was made.
PropagatesDeletesAtEndOfEvent() bool
SetPropagatesDeletesAtEndOfEvent(value bool)
// The maximum length of time that may have elapsed since the store previously fetched data before fulfilling a fault issues a new fetch.
StalenessInterval() foundation.NSTimeInterval
SetStalenessInterval(value foundation.NSTimeInterval)
// Asynchronously performs the specified closure on the context’s queue.
PerformBlock(block VoidHandler)
// Synchronously performs the specified closure on the context’s queue.
PerformBlockAndWait(block VoidHandler)
EncodeWithCoder(coder foundation.INSCoder)
}
An interface definition for the NSManagedObjectContext class.
Creating a context ¶
- INSManagedObjectContext.InitWithConcurrencyType: Creates a context that uses the specified concurrency type.
Configuring a context ¶
- INSManagedObjectContext.PersistentStoreCoordinator: The persistent store coordinator of the context.
- INSManagedObjectContext.SetPersistentStoreCoordinator
- INSManagedObjectContext.ParentContext: The parent of the context.
- INSManagedObjectContext.SetParentContext
- INSManagedObjectContext.Name: The developer-provided name of the context.
- INSManagedObjectContext.SetName
- INSManagedObjectContext.UserInfo: The user information for the context.
Registering and fetching objects ¶
- INSManagedObjectContext.CountForFetchRequestError: Returns the number of objects the specified request fetches when it executes.
- INSManagedObjectContext.ObjectRegisteredForID: Returns an object that exists in the context.
- INSManagedObjectContext.ObjectWithID: Returns either an existing object from the context or a fault that represents that object.
- INSManagedObjectContext.ExistingObjectWithIDError: Returns an existing object from either the context or the persistent store.
- INSManagedObjectContext.RegisteredObjects: The set of registered managed objects in the context.
- INSManagedObjectContext.ExecuteRequestError: Passes a request to the persistent store without affecting the contents of the managed object context, and returns a persistent store result.
- INSManagedObjectContext.RefreshAllObjects: Refreshes all of the registered managed objects in the context.
- INSManagedObjectContext.RetainsRegisteredObjects: A Boolean value that indicates whether the context keeps strong references to all registered managed objects.
- INSManagedObjectContext.SetRetainsRegisteredObjects
Handling managed objects ¶
- INSManagedObjectContext.ShouldDeleteInaccessibleFaults: A Boolean value that determines whether the context turns inaccessible faults into deleted objects.
- INSManagedObjectContext.SetShouldDeleteInaccessibleFaults
- INSManagedObjectContext.InsertedObjects: The set of objects that have been inserted into the context but not yet saved in a persistent store.
- INSManagedObjectContext.UpdatedObjects: The set of objects registered with the context that have uncommitted changes.
- INSManagedObjectContext.DeletedObjects: The set of objects that will be removed from their persistent store during the next save operation.
- INSManagedObjectContext.ShouldHandleInaccessibleFaultForObjectIDTriggeredByProperty: Creates a log of the inaccessible fault.
- INSManagedObjectContext.InsertObject: Registers an object to be inserted in the context’s persistent store the next time changes are saved.
- INSManagedObjectContext.DeleteObject: Specifies an object that should be removed from its persistent store when changes are committed.
- INSManagedObjectContext.AssignObjectToPersistentStore: Specifies the store in which a newly inserted object will be saved.
- INSManagedObjectContext.ObtainPermanentIDsForObjectsError: Converts to permanent IDs the object IDs of the objects in a given array.
- INSManagedObjectContext.DetectConflictsForObject: Marks an object for conflict detection.
- INSManagedObjectContext.RefreshObjectMergeChanges: Updates the persistent properties of a managed object to use the latest values from the persistent store.
- INSManagedObjectContext.ProcessPendingChanges: Forces the context to process changes to the object graph.
Managing concurrency ¶
- INSManagedObjectContext.AutomaticallyMergesChangesFromParent: A Boolean value that indicates whether the context automatically merges changes saved to its persistent store coordinator or parent context.
- INSManagedObjectContext.SetAutomaticallyMergesChangesFromParent
- INSManagedObjectContext.ConcurrencyType: The concurrency type for the context.
- INSManagedObjectContext.MergePolicy: The merge policy of the context.
- INSManagedObjectContext.SetMergePolicy
- INSManagedObjectContext.QueryGenerationToken: Returns the token associated with the query generation currently in use by this context.
- INSManagedObjectContext.TransactionAuthor: The author for the context that is used as an identifier in persistent history transactions.
- INSManagedObjectContext.SetTransactionAuthor
- INSManagedObjectContext.MergeChangesFromContextDidSaveNotification: Merges the changes specified in a given notification.
- INSManagedObjectContext.SetQueryGenerationFromTokenError: Sets the query generation this context should use.
Managing unsaved and uncommitted changes ¶
- INSManagedObjectContext.Save: Attempts to commit unsaved changes to registered objects to the context’s parent store.
- INSManagedObjectContext.HasChanges: A Boolean value that indicates whether the context has uncommitted changes.
Undoing changes ¶
- INSManagedObjectContext.UndoManager: The object that provides undo support for the context.
- INSManagedObjectContext.SetUndoManager
- INSManagedObjectContext.Undo: Sends an undo message to the context’s undo manager, asking it to reverse the latest uncommitted changes applied to objects in the object graph.
- INSManagedObjectContext.Redo: Sends a redo message to the context’s undo manager, asking it to reverse the latest undo operation applied to objects in the object graph.
- INSManagedObjectContext.Reset: Returns the context to its base state.
- INSManagedObjectContext.Rollback: Removes everything from the undo stack, discards all insertions and deletions, and restores updated objects to their last committed values.
Handling delete propagation ¶
- INSManagedObjectContext.PropagatesDeletesAtEndOfEvent: A Boolean value that indicates whether the context propagates deletes at the end of the event in which a change was made.
- INSManagedObjectContext.SetPropagatesDeletesAtEndOfEvent
Managing the staleness interval ¶
- INSManagedObjectContext.StalenessInterval: The maximum length of time that may have elapsed since the store previously fetched data before fulfilling a fault issues a new fetch.
- INSManagedObjectContext.SetStalenessInterval
Performing block operations ¶
- INSManagedObjectContext.PerformBlock: Asynchronously performs the specified closure on the context’s queue.
- INSManagedObjectContext.PerformBlockAndWait: Synchronously performs the specified closure on the context’s queue.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext
type INSManagedObjectID ¶
type INSManagedObjectID interface {
objectivec.IObject
NSFetchRequestResult
// The entity description associated with the object ID.
Entity() INSEntityDescription
// A Boolean value that indicates whether the object ID is temporary.
IsTemporaryID() bool
// The persistent store that fetched the object for the object ID.
PersistentStore() INSPersistentStore
// Returns a URI that provides an archiveable reference to the object for the object ID.
URIRepresentation() foundation.NSURL
}
An interface definition for the NSManagedObjectID class.
Getting Managed Object ID Information ¶
- INSManagedObjectID.Entity: The entity description associated with the object ID.
- INSManagedObjectID.IsTemporaryID: A Boolean value that indicates whether the object ID is temporary.
- INSManagedObjectID.PersistentStore: The persistent store that fetched the object for the object ID.
- INSManagedObjectID.URIRepresentation: Returns a URI that provides an archiveable reference to the object for the object ID.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectID
type INSManagedObjectModel ¶
type INSManagedObjectModel interface {
objectivec.IObject
// Initializes the managed object model using the model file at the specified URL.
InitWithContentsOfURL(url foundation.NSURL) NSManagedObjectModel
// The entities in the model.
Entities() []NSEntityDescription
SetEntities(value []NSEntityDescription)
// The entities of the model, keyed by name.
EntitiesByName() foundation.INSDictionary
// All the available configuration names of the model.
Configurations() []string
// Returns the entities of the model for a specified configuration.
EntitiesForConfiguration(configuration string) []NSEntityDescription
// Associates the specified entities with the model using the given configuration name.
SetEntitiesForConfiguration(entities []NSEntityDescription, configuration string)
// A dictionary of the receiver’s fetch request templates, keyed by name.
FetchRequestTemplatesByName() foundation.INSDictionary
// Returns the fetch request with a specified name.
FetchRequestTemplateForName(name string) INSFetchRequest
// Returns a copy of the fetch request template with the variables substituted by values from the substitutions dictionary.
FetchRequestFromTemplateWithNameSubstitutionVariables(name string, variables foundation.INSDictionary) INSFetchRequest
// Associates the specified fetch request with the receiver using the given name.
SetFetchRequestTemplateForName(fetchRequestTemplate INSFetchRequest, name string)
// The localization dictionary of the model.
LocalizationDictionary() foundation.INSDictionary
SetLocalizationDictionary(value foundation.INSDictionary)
// The Base64-encoded 128-bit model version hash.
VersionChecksum() string
// The set of developer-defined version identifiers for the object model.
VersionIdentifiers() foundation.INSSet
SetVersionIdentifiers(value foundation.INSSet)
// The dictionary of the model’s entity names and their corresponding version hashes.
EntityVersionHashesByName() foundation.INSDictionary
// Returns a Boolean value that indicates whether a given configuration in the model is compatible with given metadata from a persistent store.
IsConfigurationCompatibleWithStoreMetadata(configuration string, metadata foundation.INSDictionary) bool
EncodeWithCoder(coder foundation.INSCoder)
}
An interface definition for the NSManagedObjectModel class.
Creating a managed object model ¶
- INSManagedObjectModel.InitWithContentsOfURL: Initializes the managed object model using the model file at the specified URL.
Managing entities and configurations ¶
- INSManagedObjectModel.Entities: The entities in the model.
- INSManagedObjectModel.SetEntities
- INSManagedObjectModel.EntitiesByName: The entities of the model, keyed by name.
- INSManagedObjectModel.Configurations: All the available configuration names of the model.
- INSManagedObjectModel.EntitiesForConfiguration: Returns the entities of the model for a specified configuration.
- INSManagedObjectModel.SetEntitiesForConfiguration: Associates the specified entities with the model using the given configuration name.
Manipulating fetch request templates ¶
- INSManagedObjectModel.FetchRequestTemplatesByName: A dictionary of the receiver’s fetch request templates, keyed by name.
- INSManagedObjectModel.FetchRequestTemplateForName: Returns the fetch request with a specified name.
- INSManagedObjectModel.FetchRequestFromTemplateWithNameSubstitutionVariables: Returns a copy of the fetch request template with the variables substituted by values from the substitutions dictionary.
- INSManagedObjectModel.SetFetchRequestTemplateForName: Associates the specified fetch request with the receiver using the given name.
Handling localization ¶
- INSManagedObjectModel.LocalizationDictionary: The localization dictionary of the model.
- INSManagedObjectModel.SetLocalizationDictionary
Versioning and migrating entities ¶
- INSManagedObjectModel.VersionChecksum: The Base64-encoded 128-bit model version hash.
- INSManagedObjectModel.VersionIdentifiers: The set of developer-defined version identifiers for the object model.
- INSManagedObjectModel.SetVersionIdentifiers
- INSManagedObjectModel.EntityVersionHashesByName: The dictionary of the model’s entity names and their corresponding version hashes.
- INSManagedObjectModel.IsConfigurationCompatibleWithStoreMetadata: Returns a Boolean value that indicates whether a given configuration in the model is compatible with given metadata from a persistent store.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectModel
type INSManagedObjectModelReference ¶
type INSManagedObjectModelReference interface {
objectivec.IObject
// Creates an object model reference for the specified model.
InitWithModelVersionChecksum(model INSManagedObjectModel, versionChecksum string) NSManagedObjectModelReference
// Creates an object model reference for the model at the specified file URL.
InitWithFileURLVersionChecksum(fileURL foundation.NSURL, versionChecksum string) NSManagedObjectModelReference
// Creates an object model reference for the named model in the specified bundle.
InitWithNameInBundleVersionChecksum(modelName string, bundle foundation.NSBundle, versionChecksum string) NSManagedObjectModelReference
// Creates an object model reference with the entities corresponding to the specified entity version hashes.
InitWithEntityVersionHashesInBundleVersionChecksum(versionHash foundation.INSDictionary, bundle foundation.NSBundle, versionChecksum string) NSManagedObjectModelReference
// The resolved object model.
ResolvedModel() INSManagedObjectModel
// The version checksum of the resolved model.
VersionChecksum() string
}
An interface definition for the NSManagedObjectModelReference class.
Creating a reference ¶
- INSManagedObjectModelReference.InitWithModelVersionChecksum: Creates an object model reference for the specified model.
- INSManagedObjectModelReference.InitWithFileURLVersionChecksum: Creates an object model reference for the model at the specified file URL.
- INSManagedObjectModelReference.InitWithNameInBundleVersionChecksum: Creates an object model reference for the named model in the specified bundle.
- INSManagedObjectModelReference.InitWithEntityVersionHashesInBundleVersionChecksum: Creates an object model reference with the entities corresponding to the specified entity version hashes.
Resolving the model object ¶
- INSManagedObjectModelReference.ResolvedModel: The resolved object model.
- INSManagedObjectModelReference.VersionChecksum: The version checksum of the resolved model.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectModelReference
type INSMappingModel ¶
type INSMappingModel interface {
objectivec.IObject
// Returns a mapping model initialized from a given URL.
InitWithContentsOfURL(url foundation.NSURL) NSMappingModel
// The entity mappings for the mapping model.
EntityMappings() []NSEntityMapping
SetEntityMappings(value []NSEntityMapping)
// The entity mappings for the mapping model, keyed by name.
EntityMappingsByName() foundation.INSDictionary
}
An interface definition for the NSMappingModel class.
Creating a Mapping ¶
- INSMappingModel.InitWithContentsOfURL: Returns a mapping model initialized from a given URL.
Managing Entity Mappings ¶
- INSMappingModel.EntityMappings: The entity mappings for the mapping model.
- INSMappingModel.SetEntityMappings
- INSMappingModel.EntityMappingsByName: The entity mappings for the mapping model, keyed by name.
See: https://developer.apple.com/documentation/CoreData/NSMappingModel
type INSMergeConflict ¶
type INSMergeConflict interface {
objectivec.IObject
// Initializes a merge conflict.
InitWithSourceNewVersionOldVersionCachedSnapshotPersistedSnapshot(srcObject INSManagedObject, newvers uint, oldvers uint, cachesnap foundation.INSDictionary, persnap foundation.INSDictionary) NSMergeConflict
// The source object for the conflict.
SourceObject() INSManagedObject
// A dictionary containing the values of the source object.
ObjectSnapshot() foundation.INSDictionary
// A dictionary containing the values of the source object held in the persistent store coordinator layer.
CachedSnapshot() foundation.INSDictionary
// A dictionary containing the values of the source object held in the persistent store.
PersistedSnapshot() foundation.INSDictionary
// The new version number for the change.
NewVersionNumber() uint
// The old version number for the change.
OldVersionNumber() uint
}
An interface definition for the NSMergeConflict class.
Initializing a Merge Conflict ¶
- INSMergeConflict.InitWithSourceNewVersionOldVersionCachedSnapshotPersistedSnapshot: Initializes a merge conflict.
Accessing Merge Conflict Details ¶
- INSMergeConflict.SourceObject: The source object for the conflict.
- INSMergeConflict.ObjectSnapshot: A dictionary containing the values of the source object.
- INSMergeConflict.CachedSnapshot: A dictionary containing the values of the source object held in the persistent store coordinator layer.
- INSMergeConflict.PersistedSnapshot: A dictionary containing the values of the source object held in the persistent store.
- INSMergeConflict.NewVersionNumber: The new version number for the change.
- INSMergeConflict.OldVersionNumber: The old version number for the change.
See: https://developer.apple.com/documentation/CoreData/NSMergeConflict
type INSMergePolicy ¶
type INSMergePolicy interface {
objectivec.IObject
// Returns a merge policy initialized with a given policy type.
InitWithMergeType(ty NSMergePolicyType) NSMergePolicy
// The merge type.
MergeType() NSMergePolicyType
// Resolves the conflicts in a given list.
ResolveConflictsError(list foundation.INSArray) (bool, error)
// Resolves the conflicts in a given list.
ResolveConstraintConflictsError(list []NSConstraintConflict) (bool, error)
// Resolves the conflicts in a given list.
ResolveOptimisticLockingVersionConflictsError(list []NSMergeConflict) (bool, error)
}
An interface definition for the NSMergePolicy class.
Getting a Merge Policy ¶
- INSMergePolicy.InitWithMergeType: Returns a merge policy initialized with a given policy type.
- INSMergePolicy.MergeType: The merge type.
Resolving a Conflict ¶
- INSMergePolicy.ResolveConflictsError: Resolves the conflicts in a given list.
- INSMergePolicy.ResolveConstraintConflictsError: Resolves the conflicts in a given list.
- INSMergePolicy.ResolveOptimisticLockingVersionConflictsError: Resolves the conflicts in a given list.
See: https://developer.apple.com/documentation/CoreData/NSMergePolicy
type INSMigrationManager ¶
type INSMigrationManager interface {
objectivec.IObject
// Initializes a migration manager instance with given source and destination models.
InitWithSourceModelDestinationModel(sourceModel INSManagedObjectModel, destinationModel INSManagedObjectModel) NSMigrationManager
// The managed object context the migration manager uses for writing the destination persistent store.
DestinationContext() INSManagedObjectContext
// The destination model for the migration manager.
DestinationModel() INSManagedObjectModel
// The mapping model for the migration manager.
MappingModel() INSMappingModel
// The managed object context the migration manager uses for reading the source persistent store.
SourceContext() INSManagedObjectContext
// The source model for the migration manager.
SourceModel() INSManagedObjectModel
// Returns the entity description for the destination entity of a given entity mapping.
DestinationEntityForEntityMapping(mEntity INSEntityMapping) INSEntityDescription
// Returns the entity description for the source entity of a given entity mapping.
SourceEntityForEntityMapping(mEntity INSEntityMapping) INSEntityDescription
// The user info for the migration manager.
UserInfo() foundation.INSDictionary
SetUserInfo(value foundation.INSDictionary)
// A Boolean value that indicates whether the migration manager tries to use a store specific migration manager to perform the migration.
UsesStoreSpecificMigrationManager() bool
SetUsesStoreSpecificMigrationManager(value bool)
// Associates a given source managed object instance with an array of destination instances for a given property mapping.
AssociateSourceInstanceWithDestinationInstanceForEntityMapping(sourceInstance INSManagedObject, destinationInstance INSManagedObject, entityMapping INSEntityMapping)
// Returns the managed object instances created in the destination store for the named entity mapping for the given array of source instances.
DestinationInstancesForEntityMappingNamedSourceInstances(mappingName string, sourceInstances []NSManagedObject) []NSManagedObject
// Returns the managed object instances in the source store used to create the given destination instances for the passed in property mapping.
SourceInstancesForEntityMappingNamedDestinationInstances(mappingName string, destinationInstances []NSManagedObject) []NSManagedObject
// Migrates the store at a given source URL to the store at a given destination URL, performing all of the mappings specified in a given mapping model.
MigrateStoreFromURLTypeOptionsWithMappingModelToDestinationURLDestinationTypeDestinationOptionsError(sourceURL foundation.NSURL, sStoreType string, sOptions foundation.INSDictionary, mappings INSMappingModel, dURL foundation.NSURL, dStoreType string, dOptions foundation.INSDictionary) (bool, error)
// A number between `0` and `1` that indicates the proportion of completeness of the migration.
MigrationProgress() float32
// The entity mapping currently being processed.
CurrentEntityMapping() INSEntityMapping
// Cancels the migration with a given error.
CancelMigrationWithError(error_ foundation.NSError)
// Resets the association tables for the migration.
Reset()
}
An interface definition for the NSMigrationManager class.
Creating a Migration Manager ¶
- INSMigrationManager.InitWithSourceModelDestinationModel: Initializes a migration manager instance with given source and destination models.
Getting the Manager’s Configuration ¶
- INSMigrationManager.DestinationContext: The managed object context the migration manager uses for writing the destination persistent store.
- INSMigrationManager.DestinationModel: The destination model for the migration manager.
- INSMigrationManager.MappingModel: The mapping model for the migration manager.
- INSMigrationManager.SourceContext: The managed object context the migration manager uses for reading the source persistent store.
- INSMigrationManager.SourceModel: The source model for the migration manager.
- INSMigrationManager.DestinationEntityForEntityMapping: Returns the entity description for the destination entity of a given entity mapping.
- INSMigrationManager.SourceEntityForEntityMapping: Returns the entity description for the source entity of a given entity mapping.
Customizing the Manager ¶
- INSMigrationManager.UserInfo: The user info for the migration manager.
- INSMigrationManager.SetUserInfo
- INSMigrationManager.UsesStoreSpecificMigrationManager: A Boolean value that indicates whether the migration manager tries to use a store specific migration manager to perform the migration.
- INSMigrationManager.SetUsesStoreSpecificMigrationManager
Managing Sources and Destinations ¶
- INSMigrationManager.AssociateSourceInstanceWithDestinationInstanceForEntityMapping: Associates a given source managed object instance with an array of destination instances for a given property mapping.
- INSMigrationManager.DestinationInstancesForEntityMappingNamedSourceInstances: Returns the managed object instances created in the destination store for the named entity mapping for the given array of source instances.
- INSMigrationManager.SourceInstancesForEntityMappingNamedDestinationInstances: Returns the managed object instances in the source store used to create the given destination instances for the passed in property mapping.
Performing a Migration ¶
- INSMigrationManager.MigrateStoreFromURLTypeOptionsWithMappingModelToDestinationURLDestinationTypeDestinationOptionsError: Migrates the store at a given source URL to the store at a given destination URL, performing all of the mappings specified in a given mapping model.
Monitoring a Migration’s Progress ¶
- INSMigrationManager.MigrationProgress: A number between `0` and `1` that indicates the proportion of completeness of the migration.
- INSMigrationManager.CurrentEntityMapping: The entity mapping currently being processed.
Aborting a Migration ¶
- INSMigrationManager.CancelMigrationWithError: Cancels the migration with a given error.
- INSMigrationManager.Reset: Resets the association tables for the migration.
See: https://developer.apple.com/documentation/CoreData/NSMigrationManager
type INSMigrationStage ¶
type INSMigrationStage interface {
objectivec.IObject
// The textual description of the migration stage’s purpose.
Label() string
SetLabel(value string)
}
An interface definition for the NSMigrationStage class.
Describing the purpose ¶
- INSMigrationStage.Label: The textual description of the migration stage’s purpose.
- INSMigrationStage.SetLabel
See: https://developer.apple.com/documentation/CoreData/NSMigrationStage
type INSPersistentCloudKitContainer ¶
type INSPersistentCloudKitContainer interface {
INSPersistentContainer
// Returns a Boolean value that indicates whether the user can modify the managed object’s underlying CloudKit record.
CanUpdateRecordForManagedObjectWithID(objectID INSManagedObjectID) bool
// Returns a Boolean value that indicates whether the user can delete the managed object’s underlying CloudKit record.
CanDeleteRecordForManagedObjectWithID(objectID INSManagedObjectID) bool
// Returns a Boolean value that indicates whether the user can modify the specified persistent store.
CanModifyManagedObjectsInStore(store INSPersistentStore) bool
// Creates the CloudKit schema for all stores in the container that manage a CloudKit database.
InitializeCloudKitSchemaWithOptionsError(options NSPersistentCloudKitContainerSchemaInitializationOptions) (NSPersistentCloudKitContainer, error)
}
An interface definition for the NSPersistentCloudKitContainer class.
Checking Permissions ¶
- INSPersistentCloudKitContainer.CanUpdateRecordForManagedObjectWithID: Returns a Boolean value that indicates whether the user can modify the managed object’s underlying CloudKit record.
- INSPersistentCloudKitContainer.CanDeleteRecordForManagedObjectWithID: Returns a Boolean value that indicates whether the user can delete the managed object’s underlying CloudKit record.
- INSPersistentCloudKitContainer.CanModifyManagedObjectsInStore: Returns a Boolean value that indicates whether the user can modify the specified persistent store.
Promoting Your Schema ¶
- INSPersistentCloudKitContainer.InitializeCloudKitSchemaWithOptionsError: Creates the CloudKit schema for all stores in the container that manage a CloudKit database.
See: https://developer.apple.com/documentation/CoreData/NSPersistentCloudKitContainer
type INSPersistentCloudKitContainerEvent ¶
type INSPersistentCloudKitContainerEvent interface {
objectivec.IObject
// The type of event, either setup, import, or export.
Type() NSPersistentCloudKitContainerEventType
// A unique identifier for the event in a container.
Identifier() foundation.NSUUID
// The associated store identifier in the container for the event.
StoreIdentifier() string
// A Boolean value that indicates whether the operation the event represents is successful.
Succeeded() bool
// The start date of the operation that the event represents.
StartDate() foundation.NSDate
// The end date of the operation that the event represents.
EndDate() foundation.NSDate
// An error that indicates why an operation fails.
Error() foundation.NSError
}
An interface definition for the NSPersistentCloudKitContainerEvent class.
Inspecting Event Properties ¶
- INSPersistentCloudKitContainerEvent.Type: The type of event, either setup, import, or export.
- INSPersistentCloudKitContainerEvent.Identifier: A unique identifier for the event in a container.
- INSPersistentCloudKitContainerEvent.StoreIdentifier: The associated store identifier in the container for the event.
- INSPersistentCloudKitContainerEvent.Succeeded: A Boolean value that indicates whether the operation the event represents is successful.
- INSPersistentCloudKitContainerEvent.StartDate: The start date of the operation that the event represents.
- INSPersistentCloudKitContainerEvent.EndDate: The end date of the operation that the event represents.
- INSPersistentCloudKitContainerEvent.Error: An error that indicates why an operation fails.
See: https://developer.apple.com/documentation/CoreData/NSPersistentCloudKitContainer/Event
type INSPersistentCloudKitContainerEventRequest ¶
type INSPersistentCloudKitContainerEventRequest interface {
INSPersistentStoreRequest
// The type of result that the request returns.
ResultType() NSPersistentCloudKitContainerEventResultType
SetResultType(value NSPersistentCloudKitContainerEventResultType)
}
An interface definition for the NSPersistentCloudKitContainerEventRequest class.
Fetching Events ¶
- INSPersistentCloudKitContainerEventRequest.ResultType: The type of result that the request returns.
- INSPersistentCloudKitContainerEventRequest.SetResultType
See: https://developer.apple.com/documentation/CoreData/NSPersistentCloudKitContainerEventRequest
type INSPersistentCloudKitContainerEventResult ¶
type INSPersistentCloudKitContainerEventResult interface {
INSPersistentStoreResult
// The result of the persistent CloudKit container event request, which the result type determines.
Result() objectivec.IObject
// The type of result that the CloudKit container event fetch request returns.
ResultType() NSPersistentCloudKitContainerEventResultType
}
An interface definition for the NSPersistentCloudKitContainerEventResult class.
Handling Event Results ¶
- INSPersistentCloudKitContainerEventResult.Result: The result of the persistent CloudKit container event request, which the result type determines.
- INSPersistentCloudKitContainerEventResult.ResultType: The type of result that the CloudKit container event fetch request returns.
See: https://developer.apple.com/documentation/CoreData/NSPersistentCloudKitContainerEventResult
type INSPersistentCloudKitContainerOptions ¶
type INSPersistentCloudKitContainerOptions interface {
objectivec.IObject
// Initializes container options using the given CloudKit container identifier.
InitWithContainerIdentifier(containerIdentifier string) NSPersistentCloudKitContainerOptions
// The identifier of the CloudKit container associated with a given store description.
ContainerIdentifier() string
// The database scope — public, private, or shared — to use for a specified store in a persistent CloudKit container.
DatabaseScope() uint
SetDatabaseScope(value uint)
}
An interface definition for the NSPersistentCloudKitContainerOptions class.
Creating Container Options ¶
- INSPersistentCloudKitContainerOptions.InitWithContainerIdentifier: Initializes container options using the given CloudKit container identifier.
- INSPersistentCloudKitContainerOptions.ContainerIdentifier: The identifier of the CloudKit container associated with a given store description.
- INSPersistentCloudKitContainerOptions.DatabaseScope: The database scope — public, private, or shared — to use for a specified store in a persistent CloudKit container.
- INSPersistentCloudKitContainerOptions.SetDatabaseScope
See: https://developer.apple.com/documentation/CoreData/NSPersistentCloudKitContainerOptions
type INSPersistentContainer ¶
type INSPersistentContainer interface {
objectivec.IObject
// Creates a container with the specified name.
InitWithName(name string) NSPersistentContainer
// Create a container with the specified name and managed object model.
InitWithNameManagedObjectModel(name string, model INSManagedObjectModel) NSPersistentContainer
// The container’s managed object model.
ManagedObjectModel() INSManagedObjectModel
// The container’s name.
Name() string
// The container’s persistent store coordinator.
PersistentStoreCoordinator() INSPersistentStoreCoordinator
// The descriptions of the container’s persistent stores.
PersistentStoreDescriptions() []NSPersistentStoreDescription
SetPersistentStoreDescriptions(value []NSPersistentStoreDescription)
// Loads the persistent stores.
LoadPersistentStoresWithCompletionHandler(block PersistentStoreDescriptionErrorHandler)
// Returns a new managed object context that executes on a private queue.
NewBackgroundContext() INSManagedObjectContext
// The main queue’s managed object context.
ViewContext() INSManagedObjectContext
// Executes a closure on a private queue using an ephemeral managed object context.
PerformBackgroundTask(block ManagedObjectContextHandler)
}
An interface definition for the NSPersistentContainer class.
Creating a Container ¶
- INSPersistentContainer.InitWithName: Creates a container with the specified name.
- INSPersistentContainer.InitWithNameManagedObjectModel: Create a container with the specified name and managed object model.
Getting the Container’s Configuration ¶
- INSPersistentContainer.ManagedObjectModel: The container’s managed object model.
- INSPersistentContainer.Name: The container’s name.
- INSPersistentContainer.PersistentStoreCoordinator: The container’s persistent store coordinator.
Managing Persistent Stores ¶
- INSPersistentContainer.PersistentStoreDescriptions: The descriptions of the container’s persistent stores.
- INSPersistentContainer.SetPersistentStoreDescriptions
- INSPersistentContainer.LoadPersistentStoresWithCompletionHandler: Loads the persistent stores.
Acquiring Contexts ¶
- INSPersistentContainer.NewBackgroundContext: Returns a new managed object context that executes on a private queue.
- INSPersistentContainer.ViewContext: The main queue’s managed object context.
Performing Background Tasks ¶
- INSPersistentContainer.PerformBackgroundTask: Executes a closure on a private queue using an ephemeral managed object context.
See: https://developer.apple.com/documentation/CoreData/NSPersistentContainer
type INSPersistentHistoryChange ¶
type INSPersistentHistoryChange interface {
objectivec.IObject
// The change’s numeric identifier.
ChangeID() int64
// The type of change to the managed object in the persistent store.
ChangeType() NSPersistentHistoryChangeType
// The identifier of the managed object that changed. (swift) Declaration: @property(readonly, copy) NSManagedObjectID *changedObjectID; (objc) Availability: iOS: 11.0 — iPadOS: 11.0 — Mac Catalyst: 13.1 — macOS: 10.13 — tvOS: 11.0 — visionOS: 1.0 — watchOS: 4.0 (objc,swift) }
ChangedObjectID() INSManagedObjectID
// A dictionary of attributes marked for preservation after deletion, and their values when deleted.
Tombstone() foundation.INSDictionary
// The persistent history transaction containing this change.
Transaction() INSPersistentHistoryTransaction
// The set of properties that were updated on the managed object.
UpdatedProperties() foundation.INSSet
}
An interface definition for the NSPersistentHistoryChange class.
Inspecting Change Details ¶
- INSPersistentHistoryChange.ChangeID: The change’s numeric identifier.
- INSPersistentHistoryChange.ChangeType: The type of change to the managed object in the persistent store.
- INSPersistentHistoryChange.ChangedObjectID: The identifier of the managed object that changed. (swift) Declaration: @property(readonly, copy) NSManagedObjectID *changedObjectID; (objc) Availability: iOS: 11.0 — iPadOS: 11.0 — Mac Catalyst: 13.1 — macOS: 10.13 — tvOS: 11.0 — visionOS: 1.0 — watchOS: 4.0 (objc,swift) }
- INSPersistentHistoryChange.Tombstone: A dictionary of attributes marked for preservation after deletion, and their values when deleted.
- INSPersistentHistoryChange.Transaction: The persistent history transaction containing this change.
- INSPersistentHistoryChange.UpdatedProperties: The set of properties that were updated on the managed object.
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryChange
type INSPersistentHistoryChangeRequest ¶
type INSPersistentHistoryChangeRequest interface {
INSPersistentStoreRequest
// The specified fetch request, when retrieving history.
FetchRequest() INSFetchRequest
SetFetchRequest(value INSFetchRequest)
// The type of result that this request returns.
ResultType() NSPersistentHistoryResultType
SetResultType(value NSPersistentHistoryResultType)
// The specified token, when retrieving history defined by a token.
Token() INSPersistentHistoryToken
}
An interface definition for the NSPersistentHistoryChangeRequest class.
Configuring the Request ¶
- INSPersistentHistoryChangeRequest.FetchRequest: The specified fetch request, when retrieving history.
- INSPersistentHistoryChangeRequest.SetFetchRequest
- INSPersistentHistoryChangeRequest.ResultType: The type of result that this request returns.
- INSPersistentHistoryChangeRequest.SetResultType
Getting the Token ¶
- INSPersistentHistoryChangeRequest.Token: The specified token, when retrieving history defined by a token.
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryChangeRequest
type INSPersistentHistoryResult ¶
type INSPersistentHistoryResult interface {
INSPersistentStoreResult
// The result of the history request determined by the persistent history result type.
Result() objectivec.IObject
// The type of result that the persistent history change request returns.
ResultType() NSPersistentHistoryResultType
}
An interface definition for the NSPersistentHistoryResult class.
Inspecting History Results ¶
- INSPersistentHistoryResult.Result: The result of the history request determined by the persistent history result type.
- INSPersistentHistoryResult.ResultType: The type of result that the persistent history change request returns.
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryResult
type INSPersistentHistoryToken ¶
type INSPersistentHistoryToken interface {
objectivec.IObject
EncodeWithCoder(coder foundation.INSCoder)
}
An interface definition for the NSPersistentHistoryToken class.
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryToken
type INSPersistentHistoryTransaction ¶
type INSPersistentHistoryTransaction interface {
objectivec.IObject
// Obtains a notification for use in merging the transaction’s changes into a managed object context.
ObjectIDNotification() foundation.NSNotification
// A granular description of the context that made the persistent history change, if available.
Author() string
// The originating bundle’s identifier.
BundleID() string
// The array of persistent history changes.
Changes() []NSPersistentHistoryChange
// The originating context’s name.
ContextName() string
// The originating process’s identifier.
ProcessID() string
// The originating store’s identifier.
StoreID() string
// The date of the persistent history change.
Timestamp() foundation.NSDate
// The token that represents this transaction in the persistent history.
Token() INSPersistentHistoryToken
// The transaction’s numeric identifier.
TransactionNumber() int64
}
An interface definition for the NSPersistentHistoryTransaction class.
Requesting Notifications ¶
- INSPersistentHistoryTransaction.ObjectIDNotification: Obtains a notification for use in merging the transaction’s changes into a managed object context.
Inspecting Transaction Details ¶
- INSPersistentHistoryTransaction.Author: A granular description of the context that made the persistent history change, if available.
- INSPersistentHistoryTransaction.BundleID: The originating bundle’s identifier.
- INSPersistentHistoryTransaction.Changes: The array of persistent history changes.
- INSPersistentHistoryTransaction.ContextName: The originating context’s name.
- INSPersistentHistoryTransaction.ProcessID: The originating process’s identifier.
- INSPersistentHistoryTransaction.StoreID: The originating store’s identifier.
- INSPersistentHistoryTransaction.Timestamp: The date of the persistent history change.
- INSPersistentHistoryTransaction.Token: The token that represents this transaction in the persistent history.
- INSPersistentHistoryTransaction.TransactionNumber: The transaction’s numeric identifier.
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryTransaction
type INSPersistentStore ¶
type INSPersistentStore interface {
objectivec.IObject
// Returns a store initialized with the given arguments.
InitWithPersistentStoreCoordinatorConfigurationNameURLOptions(root INSPersistentStoreCoordinator, name string, url foundation.NSURL, options foundation.INSDictionary) NSPersistentStore
// The name of the managed object model configuration that creates the persistent store.
ConfigurationName() string
// The options that Core Data uses to create the store.
Options() foundation.INSDictionary
// The persistent store coordinator that loads the persistent store.
PersistentStoreCoordinator() INSPersistentStoreCoordinator
// The type string of the persistent store.
Type() string
// The unique identifier for the persistent store.
Identifier() string
SetIdentifier(value string)
// A Boolean value that indicates whether the persistent store is read-only.
IsReadOnly() bool
SetReadOnly(value bool)
// The URL for the persistent store.
URL() foundation.NSURL
SetURL(value foundation.NSURL)
// Instructs the persistent store to load its metadata.
LoadMetadata() (bool, error)
// The metadata for the persistent store.
Metadata() foundation.INSDictionary
SetMetadata(value foundation.INSDictionary)
// Invoked after the persistent store has been added to the persistent store coordinator.
DidAddToPersistentStoreCoordinator(coordinator INSPersistentStoreCoordinator)
// Invoked before the persistent store is removed from the persistent store coordinator.
WillRemoveFromPersistentStoreCoordinator(coordinator INSPersistentStoreCoordinator)
// The spotlight exporter associated with this persistent store.
CoreSpotlightExporter() INSCoreDataCoreSpotlightDelegate
}
An interface definition for the NSPersistentStore class.
Creating a Persistent Store ¶
- INSPersistentStore.InitWithPersistentStoreCoordinatorConfigurationNameURLOptions: Returns a store initialized with the given arguments.
Getting Store Configuration ¶
- INSPersistentStore.ConfigurationName: The name of the managed object model configuration that creates the persistent store.
- INSPersistentStore.Options: The options that Core Data uses to create the store.
- INSPersistentStore.PersistentStoreCoordinator: The persistent store coordinator that loads the persistent store.
- INSPersistentStore.Type: The type string of the persistent store.
Managing Store Attributes ¶
- INSPersistentStore.Identifier: The unique identifier for the persistent store.
- INSPersistentStore.SetIdentifier
- INSPersistentStore.IsReadOnly: A Boolean value that indicates whether the persistent store is read-only.
- INSPersistentStore.SetReadOnly
- INSPersistentStore.URL: The URL for the persistent store.
- INSPersistentStore.SetURL
Managing Store Metadata ¶
- INSPersistentStore.LoadMetadata: Instructs the persistent store to load its metadata.
- INSPersistentStore.Metadata: The metadata for the persistent store.
- INSPersistentStore.SetMetadata
Responding to the Store Life Cycle ¶
- INSPersistentStore.DidAddToPersistentStoreCoordinator: Invoked after the persistent store has been added to the persistent store coordinator.
- INSPersistentStore.WillRemoveFromPersistentStoreCoordinator: Invoked before the persistent store is removed from the persistent store coordinator.
Integrating with Spotlight ¶
- INSPersistentStore.CoreSpotlightExporter: The spotlight exporter associated with this persistent store.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStore
type INSPersistentStoreAsynchronousResult ¶
type INSPersistentStoreAsynchronousResult interface {
INSPersistentStoreResult
// The managed object context for the result.
ManagedObjectContext() INSManagedObjectContext
// An error that contains details if the asynchronous fetch request fails.
OperationError() foundation.NSError
// An object that reports progress for the asynchronous fetch request.
Progress() foundation.Progress
// Cancels the asynchronous fetch request.
Cancel()
}
An interface definition for the NSPersistentStoreAsynchronousResult class.
Inspecting the Result ¶
- INSPersistentStoreAsynchronousResult.ManagedObjectContext: The managed object context for the result.
- INSPersistentStoreAsynchronousResult.OperationError: An error that contains details if the asynchronous fetch request fails.
- INSPersistentStoreAsynchronousResult.Progress: An object that reports progress for the asynchronous fetch request.
Canceling the Result ¶
- INSPersistentStoreAsynchronousResult.Cancel: Cancels the asynchronous fetch request.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreAsynchronousResult
type INSPersistentStoreCoordinator ¶
type INSPersistentStoreCoordinator interface {
objectivec.IObject
// Creates a persistent store coordinator with the specified managed object model.
InitWithManagedObjectModel(model INSManagedObjectModel) NSPersistentStoreCoordinator
// The coordinator’s name.
Name() string
SetName(value string)
// The coordinator’s managed object model.
ManagedObjectModel() INSManagedObjectModel
// The coordinator’s persistent stores.
PersistentStores() []NSPersistentStore
// Adds a specific type of persistent store at the provided location.
AddPersistentStoreWithTypeConfigurationURLOptionsError(storeType string, configuration string, storeURL foundation.NSURL, options foundation.INSDictionary) (INSPersistentStore, error)
// Adds a persistent store using the provided description.
AddPersistentStoreWithDescriptionCompletionHandler(storeDescription INSPersistentStoreDescription, block PersistentStoreDescriptionErrorHandler)
// Removes the specified persistent store from the coordinator.
RemovePersistentStoreError(store INSPersistentStore) (bool, error)
// Deletes a specific type of persistent store at the provided location.
DestroyPersistentStoreAtURLWithTypeOptionsError(url foundation.NSURL, storeType string, options foundation.INSDictionary) (bool, error)
// Changes the location and, if necessary, the store type of the specified persistent store.
MigratePersistentStoreToURLOptionsWithTypeError(store INSPersistentStore, URL foundation.NSURL, options foundation.INSDictionary, storeType string) (INSPersistentStore, error)
// Replaces one persistent store with another.
ReplacePersistentStoreAtURLDestinationOptionsWithPersistentStoreFromURLSourceOptionsStoreTypeError(destinationURL foundation.NSURL, destinationOptions foundation.INSDictionary, sourceURL foundation.NSURL, sourceOptions foundation.INSDictionary, storeType string) (bool, error)
// Changes the location of the specified persistent store.
SetURLForPersistentStore(url foundation.NSURL, store INSPersistentStore) bool
// Returns the persistent store for the specified file URL.
PersistentStoreForURL(URL foundation.NSURL) INSPersistentStore
// Returns the location of the provided persistent store.
URLForPersistentStore(store INSPersistentStore) foundation.NSURL
// Returns the metadata of the specified persistent store.
MetadataForPersistentStore(store INSPersistentStore) foundation.INSDictionary
// Updates the metadata for the specified persistent store.
SetMetadataForPersistentStore(metadata foundation.INSDictionary, store INSPersistentStore)
// Executes a single pending task of a deferred lightweight migration.
FinishDeferredLightweightMigrationTask() (bool, error)
// Executes all remaining tasks of a deferred lightweight migration.
FinishDeferredLightweightMigration() (bool, error)
// Executes the provided closure asynchronously on the coordinator’s queue.
PerformBlock(block VoidHandler)
// Executes the provided closure on the coordinator’s queue and waits for it to finish.
PerformBlockAndWait(block VoidHandler)
// Executes the specified request on each of the coordinator’s persistent stores.
ExecuteRequestWithContextError(request INSPersistentStoreRequest, context INSManagedObjectContext) (objectivec.IObject, error)
// Returns a single persistent history token representing all of the specified stores.
CurrentPersistentHistoryTokenFromStores(stores foundation.INSArray) INSPersistentHistoryToken
// Returns the object identifier for the specified URI representation.
ManagedObjectIDForURIRepresentation(url foundation.NSURL) INSManagedObjectID
}
An interface definition for the NSPersistentStoreCoordinator class.
Creating a persistent store coordinator ¶
- INSPersistentStoreCoordinator.InitWithManagedObjectModel: Creates a persistent store coordinator with the specified managed object model.
Managing configuration ¶
- INSPersistentStoreCoordinator.Name: The coordinator’s name.
- INSPersistentStoreCoordinator.SetName
- INSPersistentStoreCoordinator.ManagedObjectModel: The coordinator’s managed object model.
- INSPersistentStoreCoordinator.PersistentStores: The coordinator’s persistent stores.
Adding or removing a store ¶
- INSPersistentStoreCoordinator.AddPersistentStoreWithTypeConfigurationURLOptionsError: Adds a specific type of persistent store at the provided location.
- INSPersistentStoreCoordinator.AddPersistentStoreWithDescriptionCompletionHandler: Adds a persistent store using the provided description.
- INSPersistentStoreCoordinator.RemovePersistentStoreError: Removes the specified persistent store from the coordinator.
Modifying a store ¶
- INSPersistentStoreCoordinator.DestroyPersistentStoreAtURLWithTypeOptionsError: Deletes a specific type of persistent store at the provided location.
- INSPersistentStoreCoordinator.MigratePersistentStoreToURLOptionsWithTypeError: Changes the location and, if necessary, the store type of the specified persistent store.
- INSPersistentStoreCoordinator.ReplacePersistentStoreAtURLDestinationOptionsWithPersistentStoreFromURLSourceOptionsStoreTypeError: Replaces one persistent store with another.
Managing a store’s location ¶
- INSPersistentStoreCoordinator.SetURLForPersistentStore: Changes the location of the specified persistent store.
- INSPersistentStoreCoordinator.PersistentStoreForURL: Returns the persistent store for the specified file URL.
- INSPersistentStoreCoordinator.URLForPersistentStore: Returns the location of the provided persistent store.
Managing a store’s metadata ¶
- INSPersistentStoreCoordinator.MetadataForPersistentStore: Returns the metadata of the specified persistent store.
- INSPersistentStoreCoordinator.SetMetadataForPersistentStore: Updates the metadata for the specified persistent store.
Deferring a store’s migrations ¶
- INSPersistentStoreCoordinator.FinishDeferredLightweightMigrationTask: Executes a single pending task of a deferred lightweight migration.
- INSPersistentStoreCoordinator.FinishDeferredLightweightMigration: Executes all remaining tasks of a deferred lightweight migration.
Performing tasks ¶
- INSPersistentStoreCoordinator.PerformBlock: Executes the provided closure asynchronously on the coordinator’s queue.
- INSPersistentStoreCoordinator.PerformBlockAndWait: Executes the provided closure on the coordinator’s queue and waits for it to finish.
- INSPersistentStoreCoordinator.ExecuteRequestWithContextError: Executes the specified request on each of the coordinator’s persistent stores.
Maintaining a record of changes ¶
- INSPersistentStoreCoordinator.CurrentPersistentHistoryTokenFromStores: Returns a single persistent history token representing all of the specified stores.
Getting individual object identifiers ¶
- INSPersistentStoreCoordinator.ManagedObjectIDForURIRepresentation: Returns the object identifier for the specified URI representation.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreCoordinator
type INSPersistentStoreDescription ¶
type INSPersistentStoreDescription interface {
objectivec.IObject
// Initializes the receiver with a URL for the store.
InitWithURL(url foundation.NSURL) NSPersistentStoreDescription
// The URL that the store will use for its location.
URL() foundation.NSURL
SetURL(value foundation.NSURL)
// The name of the configuration used by this store.
Configuration() string
SetConfiguration(value string)
// The connection timeout for the associated store.
Timeout() foundation.NSTimeInterval
SetTimeout(value foundation.NSTimeInterval)
// The type of store this description represents.
Type() string
SetType(value string)
// A flag that indicates whether this store will be read-only.
IsReadOnly() bool
SetReadOnly(value bool)
// A flag that determines whether the store is added asynchronously.
ShouldAddStoreAsynchronously() bool
SetShouldAddStoreAsynchronously(value bool)
// A flag indicating whether a mapping model should be created automatically.
ShouldInferMappingModelAutomatically() bool
SetShouldInferMappingModelAutomatically(value bool)
// A flag indicating whether the associated persistent store should be migrated automatically.
ShouldMigrateStoreAutomatically() bool
SetShouldMigrateStoreAutomatically(value bool)
// Sets an option on the store.
SetOptionForKey(option objectivec.NSObject, key string)
// Allows you to set pragmas for the SQLite store.
SetValueForPragmaNamed(value objectivec.NSObject, name string)
// A dictionary representation of the options set on the associated persistent store.
Options() foundation.INSDictionary
// The SQLite pragmas set for the associated persistent store. (read-only)
SqlitePragmas() foundation.INSDictionary
// Options that customize how this store description aligns with a CloudKit database.
CloudKitContainerOptions() INSPersistentCloudKitContainerOptions
SetCloudKitContainerOptions(value INSPersistentCloudKitContainerOptions)
}
An interface definition for the NSPersistentStoreDescription class.
Creating a Persistent Store Description ¶
- INSPersistentStoreDescription.InitWithURL: Initializes the receiver with a URL for the store.
Configuring a Persistent Store Description ¶
- INSPersistentStoreDescription.URL: The URL that the store will use for its location.
- INSPersistentStoreDescription.SetURL
- INSPersistentStoreDescription.Configuration: The name of the configuration used by this store.
- INSPersistentStoreDescription.SetConfiguration
- INSPersistentStoreDescription.Timeout: The connection timeout for the associated store.
- INSPersistentStoreDescription.SetTimeout
- INSPersistentStoreDescription.Type: The type of store this description represents.
- INSPersistentStoreDescription.SetType
- INSPersistentStoreDescription.IsReadOnly: A flag that indicates whether this store will be read-only.
- INSPersistentStoreDescription.SetReadOnly
- INSPersistentStoreDescription.ShouldAddStoreAsynchronously: A flag that determines whether the store is added asynchronously.
- INSPersistentStoreDescription.SetShouldAddStoreAsynchronously
- INSPersistentStoreDescription.ShouldInferMappingModelAutomatically: A flag indicating whether a mapping model should be created automatically.
- INSPersistentStoreDescription.SetShouldInferMappingModelAutomatically
- INSPersistentStoreDescription.ShouldMigrateStoreAutomatically: A flag indicating whether the associated persistent store should be migrated automatically.
- INSPersistentStoreDescription.SetShouldMigrateStoreAutomatically
- INSPersistentStoreDescription.SetOptionForKey: Sets an option on the store.
- INSPersistentStoreDescription.SetValueForPragmaNamed: Allows you to set pragmas for the SQLite store.
Accessing the Configuration Options ¶
- INSPersistentStoreDescription.Options: A dictionary representation of the options set on the associated persistent store.
- INSPersistentStoreDescription.SqlitePragmas: The SQLite pragmas set for the associated persistent store. (read-only)
Syncing to CloudKit ¶
- INSPersistentStoreDescription.CloudKitContainerOptions: Options that customize how this store description aligns with a CloudKit database.
- INSPersistentStoreDescription.SetCloudKitContainerOptions
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreDescription
type INSPersistentStoreRequest ¶
type INSPersistentStoreRequest interface {
objectivec.IObject
// The stores the request should be sent to.
AffectedStores() []NSPersistentStore
SetAffectedStores(value []NSPersistentStore)
// The type of the fetch request.
RequestType() NSPersistentStoreRequestType
}
An interface definition for the NSPersistentStoreRequest class.
Configuring a Request ¶
- INSPersistentStoreRequest.AffectedStores: The stores the request should be sent to.
- INSPersistentStoreRequest.SetAffectedStores
- INSPersistentStoreRequest.RequestType: The type of the fetch request.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreRequest
type INSPersistentStoreResult ¶
type INSPersistentStoreResult interface {
objectivec.IObject
}
An interface definition for the NSPersistentStoreResult class.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreResult
type INSPropertyDescription ¶
type INSPropertyDescription interface {
objectivec.IObject
// The entity description of the receiver.
Entity() INSEntityDescription
// A Boolean value that indicates whether the receiver is optional.
IsOptional() bool
SetOptional(value bool)
// A Boolean value that indicates whether the receiver is transient.
IsTransient() bool
SetTransient(value bool)
// The name of the receiver.
Name() string
SetName(value string)
// The user info dictionary of the receiver.
UserInfo() foundation.INSDictionary
SetUserInfo(value foundation.INSDictionary)
// The validation predicates of the receiver.
ValidationPredicates() []foundation.NSPredicate
// The error strings associated with the receiver’s validation predicates.
ValidationWarnings() foundation.INSArray
// Sets the validation predicates and warnings of the receiver.
SetValidationPredicatesWithValidationWarnings(validationPredicates []foundation.NSPredicate, validationWarnings []string)
// The version hash for the receiver.
VersionHash() foundation.NSData
// The version hash modifier for the receiver.
VersionHashModifier() string
SetVersionHashModifier(value string)
// The renaming identifier for the receiver.
RenamingIdentifier() string
SetRenamingIdentifier(value string)
// A Boolean value that indicates whether Core Data adds the property’s value to the Core Spotlight index.
IsIndexedBySpotlight() bool
SetIndexedBySpotlight(value bool)
EncodeWithCoder(coder foundation.INSCoder)
}
An interface definition for the NSPropertyDescription class.
Accessing Features of a Property ¶
- INSPropertyDescription.Entity: The entity description of the receiver.
- INSPropertyDescription.IsOptional: A Boolean value that indicates whether the receiver is optional.
- INSPropertyDescription.SetOptional
- INSPropertyDescription.IsTransient: A Boolean value that indicates whether the receiver is transient.
- INSPropertyDescription.SetTransient
- INSPropertyDescription.Name: The name of the receiver.
- INSPropertyDescription.SetName
- INSPropertyDescription.UserInfo: The user info dictionary of the receiver.
- INSPropertyDescription.SetUserInfo
Supporting Validation ¶
- INSPropertyDescription.ValidationPredicates: The validation predicates of the receiver.
- INSPropertyDescription.ValidationWarnings: The error strings associated with the receiver’s validation predicates.
- INSPropertyDescription.SetValidationPredicatesWithValidationWarnings: Sets the validation predicates and warnings of the receiver.
Supporting Versioning ¶
- INSPropertyDescription.VersionHash: The version hash for the receiver.
- INSPropertyDescription.VersionHashModifier: The version hash modifier for the receiver.
- INSPropertyDescription.SetVersionHashModifier
- INSPropertyDescription.RenamingIdentifier: The renaming identifier for the receiver.
- INSPropertyDescription.SetRenamingIdentifier
Specifying Spotlight Support ¶
- INSPropertyDescription.IsIndexedBySpotlight: A Boolean value that indicates whether Core Data adds the property’s value to the Core Spotlight index.
- INSPropertyDescription.SetIndexedBySpotlight
See: https://developer.apple.com/documentation/CoreData/NSPropertyDescription
type INSPropertyMapping ¶
type INSPropertyMapping interface {
objectivec.IObject
// The name of the property in the destination entity for the property mapping.
Name() string
SetName(value string)
// The value expression for the property mapping.
ValueExpression() foundation.NSExpression
SetValueExpression(value foundation.NSExpression)
// The user info for the property mapping.
UserInfo() foundation.INSDictionary
SetUserInfo(value foundation.INSDictionary)
}
An interface definition for the NSPropertyMapping class.
Managing Mapping Attributes ¶
- INSPropertyMapping.Name: The name of the property in the destination entity for the property mapping.
- INSPropertyMapping.SetName
- INSPropertyMapping.ValueExpression: The value expression for the property mapping.
- INSPropertyMapping.SetValueExpression
- INSPropertyMapping.UserInfo: The user info for the property mapping.
- INSPropertyMapping.SetUserInfo
See: https://developer.apple.com/documentation/CoreData/NSPropertyMapping
type INSQueryGenerationToken ¶
type INSQueryGenerationToken interface {
objectivec.IObject
EncodeWithCoder(coder foundation.INSCoder)
}
An interface definition for the NSQueryGenerationToken class.
See: https://developer.apple.com/documentation/CoreData/NSQueryGenerationToken
type INSRelationshipDescription ¶
type INSRelationshipDescription interface {
INSPropertyDescription
// The relationship that represents the inverse of the current relationship.
InverseRelationship() INSRelationshipDescription
SetInverseRelationship(value INSRelationshipDescription)
// The type of object the relationship contains.
DestinationEntity() INSEntityDescription
SetDestinationEntity(value INSEntityDescription)
// A Boolean value that determines whether the relationship preserves the order of the referenced managed objects.
IsOrdered() bool
SetOrdered(value bool)
// Returns a Boolean value that indicates whether the relationship can contain many managed objects.
IsToMany() bool
// The minimum number of managed objects the relationship can reference.
MinCount() uint
SetMinCount(value uint)
// The maximum number of managed objects the relationship can reference.
MaxCount() uint
SetMaxCount(value uint)
// The rule to apply when you delete the relationship’s owning managed object.
DeleteRule() NSDeleteRule
SetDeleteRule(value NSDeleteRule)
}
An interface definition for the NSRelationshipDescription class.
Configuring the Destination ¶
- INSRelationshipDescription.InverseRelationship: The relationship that represents the inverse of the current relationship.
- INSRelationshipDescription.SetInverseRelationship
- INSRelationshipDescription.DestinationEntity: The type of object the relationship contains.
- INSRelationshipDescription.SetDestinationEntity
- INSRelationshipDescription.IsOrdered: A Boolean value that determines whether the relationship preserves the order of the referenced managed objects.
- INSRelationshipDescription.SetOrdered
Configuring Cardinality ¶
- INSRelationshipDescription.IsToMany: Returns a Boolean value that indicates whether the relationship can contain many managed objects.
- INSRelationshipDescription.MinCount: The minimum number of managed objects the relationship can reference.
- INSRelationshipDescription.SetMinCount
- INSRelationshipDescription.MaxCount: The maximum number of managed objects the relationship can reference.
- INSRelationshipDescription.SetMaxCount
Configuring Delete Behavior ¶
- INSRelationshipDescription.DeleteRule: The rule to apply when you delete the relationship’s owning managed object.
- INSRelationshipDescription.SetDeleteRule
See: https://developer.apple.com/documentation/CoreData/NSRelationshipDescription
type INSSaveChangesRequest ¶
type INSSaveChangesRequest interface {
INSPersistentStoreRequest
// Initializes a save changes request with collections of given changes.
InitWithInsertedObjectsUpdatedObjectsDeletedObjectsLockedObjects(insertedObjects foundation.INSSet, updatedObjects foundation.INSSet, deletedObjects foundation.INSSet, lockedObjects foundation.INSSet) NSSaveChangesRequest
// The objects that were inserted into the calling context.
InsertedObjects() foundation.INSSet
// The objects that were modified in the calling context.
UpdatedObjects() foundation.INSSet
// The objects that were deleted in the calling context.
DeletedObjects() foundation.INSSet
// The objects that were flagged for optimistic locking on the calling context.
LockedObjects() foundation.INSSet
}
An interface definition for the NSSaveChangesRequest class.
Initializing a Request ¶
- INSSaveChangesRequest.InitWithInsertedObjectsUpdatedObjectsDeletedObjectsLockedObjects: Initializes a save changes request with collections of given changes.
Getting Information about a Request ¶
- INSSaveChangesRequest.InsertedObjects: The objects that were inserted into the calling context.
- INSSaveChangesRequest.UpdatedObjects: The objects that were modified in the calling context.
- INSSaveChangesRequest.DeletedObjects: The objects that were deleted in the calling context.
- INSSaveChangesRequest.LockedObjects: The objects that were flagged for optimistic locking on the calling context.
See: https://developer.apple.com/documentation/CoreData/NSSaveChangesRequest
type INSStagedMigrationManager ¶
type INSStagedMigrationManager interface {
objectivec.IObject
// The container that provides access to the migrating persistent store.
Container() INSPersistentContainer
// The migration stages.
Stages() []NSMigrationStage
}
An interface definition for the NSStagedMigrationManager class.
Accessing the persistent container ¶
- INSStagedMigrationManager.Container: The container that provides access to the migrating persistent store.
Accessing the stages ¶
- INSStagedMigrationManager.Stages: The migration stages.
See: https://developer.apple.com/documentation/CoreData/NSStagedMigrationManager
type ManagedObjectContextHandler ¶
type ManagedObjectContextHandler = func(*NSManagedObjectContext)
ManagedObjectContextHandler handles A closure that is executed by the persistent container against a newly created private context.
Used by:
type NSAsynchronousFetchRequest ¶
type NSAsynchronousFetchRequest struct {
NSPersistentStoreRequest
}
A fetch request that retrieves results asynchronously and supports progress notification.
Initializing a Request ¶
- NSAsynchronousFetchRequest.InitWithFetchRequestCompletionBlock: Initializes a new asynchronous fetch request configured with the provided fetch request and completion block.
Preparing a Request ¶
- NSAsynchronousFetchRequest.EstimatedResultCount: A configuration parameter that assists Core Data with scheduling the asynchronous fetch request.
- NSAsynchronousFetchRequest.SetEstimatedResultCount
- NSAsynchronousFetchRequest.FetchRequest: The underlying fetch request that is executed asynchronously.
See: https://developer.apple.com/documentation/CoreData/NSAsynchronousFetchRequest
func NSAsynchronousFetchRequestFromID ¶
func NSAsynchronousFetchRequestFromID(id objc.ID) NSAsynchronousFetchRequest
NSAsynchronousFetchRequestFromID constructs a NSAsynchronousFetchRequest from an objc.ID.
A fetch request that retrieves results asynchronously and supports progress notification.
func NewNSAsynchronousFetchRequest ¶
func NewNSAsynchronousFetchRequest() NSAsynchronousFetchRequest
NewNSAsynchronousFetchRequest creates a new NSAsynchronousFetchRequest instance.
func (NSAsynchronousFetchRequest) Autorelease ¶
func (a NSAsynchronousFetchRequest) Autorelease() NSAsynchronousFetchRequest
Autorelease adds the receiver to the current autorelease pool.
func (NSAsynchronousFetchRequest) EstimatedResultCount ¶
func (a NSAsynchronousFetchRequest) EstimatedResultCount() int
A configuration parameter that assists Core Data with scheduling the asynchronous fetch request.
See: https://developer.apple.com/documentation/CoreData/NSAsynchronousFetchRequest/estimatedResultCount
func (NSAsynchronousFetchRequest) FetchRequest ¶
func (a NSAsynchronousFetchRequest) FetchRequest() INSFetchRequest
The underlying fetch request that is executed asynchronously.
See: https://developer.apple.com/documentation/CoreData/NSAsynchronousFetchRequest/fetchRequest
func (NSAsynchronousFetchRequest) Init ¶
func (a NSAsynchronousFetchRequest) Init() NSAsynchronousFetchRequest
Init initializes the instance.
func (NSAsynchronousFetchRequest) InitWithFetchRequestCompletionBlock ¶
func (a NSAsynchronousFetchRequest) InitWithFetchRequestCompletionBlock(request INSFetchRequest, blk idNSFetchRequestResultAsynchronousFetchResultHandler) NSAsynchronousFetchRequest
Initializes a new asynchronous fetch request configured with the provided fetch request and completion block.
func (NSAsynchronousFetchRequest) InitWithFetchRequestCompletionBlockSync ¶
func (a NSAsynchronousFetchRequest) InitWithFetchRequestCompletionBlockSync(ctx context.Context, request INSFetchRequest) (*NSAsynchronousFetchResult, error)
InitWithFetchRequestCompletionBlockSync is a synchronous wrapper around NSAsynchronousFetchRequest.InitWithFetchRequestCompletionBlock. It blocks until the completion handler fires or the context is cancelled.
func (NSAsynchronousFetchRequest) SetEstimatedResultCount ¶
func (a NSAsynchronousFetchRequest) SetEstimatedResultCount(value int)
type NSAsynchronousFetchRequestClass ¶
type NSAsynchronousFetchRequestClass struct {
// contains filtered or unexported fields
}
func GetNSAsynchronousFetchRequestClass ¶
func GetNSAsynchronousFetchRequestClass() NSAsynchronousFetchRequestClass
GetNSAsynchronousFetchRequestClass returns the class object for NSAsynchronousFetchRequest.
func (NSAsynchronousFetchRequestClass) Alloc ¶
func (nc NSAsynchronousFetchRequestClass) Alloc() NSAsynchronousFetchRequest
Alloc allocates memory for a new instance of the class.
func (NSAsynchronousFetchRequestClass) Class ¶
func (nc NSAsynchronousFetchRequestClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSAsynchronousFetchResult ¶
type NSAsynchronousFetchResult struct {
NSPersistentStoreAsynchronousResult
}
A fetch result object that encompasses the response from an executed asynchronous fetch request.
Getting Information About a Result ¶
- NSAsynchronousFetchResult.FetchRequest: The underlying fetch request that was executed.
- NSAsynchronousFetchResult.FinalResult: The results that were received from the fetch request.
See: https://developer.apple.com/documentation/CoreData/NSAsynchronousFetchResult
func NSAsynchronousFetchResultFromID ¶
func NSAsynchronousFetchResultFromID(id objc.ID) NSAsynchronousFetchResult
NSAsynchronousFetchResultFromID constructs a NSAsynchronousFetchResult from an objc.ID.
A fetch result object that encompasses the response from an executed asynchronous fetch request.
func NewNSAsynchronousFetchResult ¶
func NewNSAsynchronousFetchResult() NSAsynchronousFetchResult
NewNSAsynchronousFetchResult creates a new NSAsynchronousFetchResult instance.
func (NSAsynchronousFetchResult) Autorelease ¶
func (a NSAsynchronousFetchResult) Autorelease() NSAsynchronousFetchResult
Autorelease adds the receiver to the current autorelease pool.
func (NSAsynchronousFetchResult) FetchRequest ¶
func (a NSAsynchronousFetchResult) FetchRequest() INSAsynchronousFetchRequest
The underlying fetch request that was executed.
See: https://developer.apple.com/documentation/CoreData/NSAsynchronousFetchResult/fetchRequest
func (NSAsynchronousFetchResult) FinalResult ¶
func (a NSAsynchronousFetchResult) FinalResult() []objectivec.IObject
The results that were received from the fetch request.
See: https://developer.apple.com/documentation/CoreData/NSAsynchronousFetchResult/finalResult
func (NSAsynchronousFetchResult) Init ¶
func (a NSAsynchronousFetchResult) Init() NSAsynchronousFetchResult
Init initializes the instance.
type NSAsynchronousFetchResultClass ¶
type NSAsynchronousFetchResultClass struct {
// contains filtered or unexported fields
}
func GetNSAsynchronousFetchResultClass ¶
func GetNSAsynchronousFetchResultClass() NSAsynchronousFetchResultClass
GetNSAsynchronousFetchResultClass returns the class object for NSAsynchronousFetchResult.
func (NSAsynchronousFetchResultClass) Alloc ¶
func (nc NSAsynchronousFetchResultClass) Alloc() NSAsynchronousFetchResult
Alloc allocates memory for a new instance of the class.
func (NSAsynchronousFetchResultClass) Class ¶
func (nc NSAsynchronousFetchResultClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSAtomicStore ¶
type NSAtomicStore struct {
NSPersistentStore
}
An abstract superclass that you subclass to create a Core Data atomic store.
Overview ¶
Use an atomic store to handle data sets that can be expressed in memory. The atomic store API favors simplicity over performance.
This class provides default implementations of some utility methods. Create a custom atomic store subclass when you have a custom file format that you want to integrate with a Core Data app. When you create a subclass, override the following NSAtomicStore methods:
- NSAtomicStore.Load - NSAtomicStore.NewCacheNodeForManagedObject - NSAtomicStore.NewReferenceObjectForManagedObject - NSAtomicStore.Save - NSAtomicStore.UpdateCacheNodeFromManagedObject
Also override the following properties and methods of NSPersistentStore, from which the atomic store class inherits:
- NSPersistentStore.Type - NSPersistentStore.Identifier - NSPersistentStore.Metadata - NSPersistentStoreClass.MetadataForPersistentStoreWithURLError - NSPersistentStoreClass.SetMetadataForPersistentStoreWithURLError
NSAtomicStore provides a default dictionary of metadata. This dictionary contains the store type and identifier (NSStoreTypeKey and NSStoreUUIDKey) as well as store versioning information. Subclasses must ensure that the metadata is saved along with the store data.
Loading a Store ¶
- NSAtomicStore.Load: Loads the cache nodes for the receiver.
- NSAtomicStore.ObjectIDForEntityReferenceObject: Returns a managed object ID from the reference data for a specified entity.
- NSAtomicStore.AddCacheNodes: Registers a set of cache nodes with the receiver.
Updating Cache Nodes ¶
- NSAtomicStore.NewCacheNodeForManagedObject: Returns a new cache node for a given managed object.
- NSAtomicStore.NewReferenceObjectForManagedObject: Returns a new reference object for a given managed object.
- NSAtomicStore.UpdateCacheNodeFromManagedObject: Updates the given cache node using the values in a given managed object.
- NSAtomicStore.WillRemoveCacheNodes: Method invoked before the store removes the given collection of cache nodes.
Saving a Store ¶
- NSAtomicStore.Save: Saves the cache nodes.
Utility Methods ¶
- NSAtomicStore.CacheNodes: Returns the set of cache nodes registered with the receiver.
- NSAtomicStore.CacheNodeForObjectID: Returns the cache node for a given managed object ID.
- NSAtomicStore.ReferenceObjectForObjectID: Returns the reference object for a given managed object ID.
See: https://developer.apple.com/documentation/CoreData/NSAtomicStore
func NSAtomicStoreFromID ¶
func NSAtomicStoreFromID(id objc.ID) NSAtomicStore
NSAtomicStoreFromID constructs a NSAtomicStore from an objc.ID.
An abstract superclass that you subclass to create a Core Data atomic store.
func NewAtomicStoreWithPersistentStoreCoordinatorConfigurationNameURLOptions ¶
func NewAtomicStoreWithPersistentStoreCoordinatorConfigurationNameURLOptions(coordinator INSPersistentStoreCoordinator, configurationName string, url foundation.NSURL, options foundation.INSDictionary) NSAtomicStore
Creates an atomic store at the specified location.
coordinator: The persistent store coordinator.
configurationName: The name of the store’s configuration in the managed object model.
url: The URL of the store to load. This value can’t be `nil`.
options: A dictionary that contains the store’s options. For possible values, see Store options.
Discussion ¶
Typically, you don’t invoke this method yourself; instead, the persistent store coordinator invokes the method when it creates a new store or adds an existing one.
In your implementation, check whether a file exists at `url`. If it doesn’t exist, create a zero-length file at `url` so that the file exists before the coordinator calls the store’s NSAtomicStore.Load method. A zero-length file indicates to the system that it should create a new store at that location. If the coordinator removes the store without first calling NSAtomicStore.Save, delete the zero-length file.
It’s your responsibility to load the store’s metadata during initialization and set it using the NSPersistentStoreClass.SetMetadataForPersistentStoreWithURLError method.
func NewNSAtomicStore ¶
func NewNSAtomicStore() NSAtomicStore
NewNSAtomicStore creates a new NSAtomicStore instance.
func (NSAtomicStore) AddCacheNodes ¶
func (a NSAtomicStore) AddCacheNodes(cacheNodes foundation.INSSet)
Registers a set of cache nodes with the receiver.
cacheNodes: A set of cache nodes.
Discussion ¶
You should invoke this method in a subclass during the call to NSAtomicStore.Load to register the loaded information with the store.
See: https://developer.apple.com/documentation/CoreData/NSAtomicStore/addCacheNodes(_:)
func (NSAtomicStore) Autorelease ¶
func (a NSAtomicStore) Autorelease() NSAtomicStore
Autorelease adds the receiver to the current autorelease pool.
func (NSAtomicStore) CacheNodeForObjectID ¶
func (a NSAtomicStore) CacheNodeForObjectID(objectID INSManagedObjectID) INSAtomicStoreCacheNode
Returns the cache node for a given managed object ID.
objectID: A managed object ID.
Return Value ¶
The cache node for `objectID`.
Discussion ¶
This method is normally used by cache nodes to locate related cache nodes (by relationships).
See: https://developer.apple.com/documentation/CoreData/NSAtomicStore/cacheNode(for:)
func (NSAtomicStore) CacheNodes ¶
func (a NSAtomicStore) CacheNodes() foundation.INSSet
Returns the set of cache nodes registered with the receiver.
Return Value ¶
The set of cache nodes registered with the receiver.
Discussion ¶
You should modify this collection using NSAtomicStore.AddCacheNodes: and NSAtomicStore.WillRemoveCacheNodes.
See: https://developer.apple.com/documentation/CoreData/NSAtomicStore/cacheNodes()
func (NSAtomicStore) Init ¶
func (a NSAtomicStore) Init() NSAtomicStore
Init initializes the instance.
func (NSAtomicStore) Load ¶
func (a NSAtomicStore) Load() (bool, error)
Loads the cache nodes for the receiver.
Discussion ¶
You override this method to load the data from the URL specified in [NSAtomicStore.InitWithPersistentStoreCoordinatorConfigurationNameURLOptions] and create cache nodes for the represented objects. You must respect the configuration specified for the store, as well as the options.
Any subclass of NSAtomicStore must be able to handle being initialized with a URL pointing to a zero-length file. This serves as an indicator that a new store is to be constructed at the specified location and allows you to securely create reservation files in known locations which can then be passed to Core Data to construct stores. You may choose to create zero-length reservation files during [NSAtomicStore.InitWithPersistentStoreCoordinatorConfigurationNameURLOptions] or NSAtomicStore.Load. If you do so, you must remove the reservation file if the store is removed from the coordinator before it is saved.
You must override this method in a subclass of NSAtomicStore.
See: https://developer.apple.com/documentation/CoreData/NSAtomicStore/load()
func (NSAtomicStore) NewCacheNodeForManagedObject ¶
func (a NSAtomicStore) NewCacheNodeForManagedObject(managedObject INSManagedObject) INSAtomicStoreCacheNode
Returns a new cache node for a given managed object.
managedObject: A managed object.
Return Value ¶
A new cache node for `managedObject`.
Discussion ¶
This method is invoked by the framework during a save operation, once for each newly-inserted managed object. It should pull information from the managed object and return a cache node containing the information (the node will be registered by the framework).
Special Considerations ¶
You must override this method.
See: https://developer.apple.com/documentation/CoreData/NSAtomicStore/newCacheNode(for:)
func (NSAtomicStore) NewReferenceObjectForManagedObject ¶
func (a NSAtomicStore) NewReferenceObjectForManagedObject(managedObject INSManagedObject) objectivec.IObject
Returns a new reference object for a given managed object.
managedObject: A managed object. At the time this method is called, it has a temporary ID.
Return Value ¶
A new reference object for `managedObject`.
Discussion ¶
This method is invoked by the framework after a save operation on a managed object context, once for each newly-inserted managed object. The value returned is used to create a permanent ID for the object and must be unique for an instance within its entity’s inheritance hierarchy (in this store).
Special Considerations ¶
You must override this method.
This method must return a stable (unchanging) value for a given object, otherwise Save As and migration will not work correctly. This means that you can use arbitrary numbers, UUIDs, or other random values only if they are persisted with the raw data. If you cannot save the originally-assigned reference object with the data, then the method must derive the reference object from the managed object’s values. For more details, see Atomic Store Programming Topics.
See: https://developer.apple.com/documentation/CoreData/NSAtomicStore/newReferenceObject(for:)
func (NSAtomicStore) ObjectIDForEntityReferenceObject ¶
func (a NSAtomicStore) ObjectIDForEntityReferenceObject(entity INSEntityDescription, data objectivec.IObject) INSManagedObjectID
Returns a managed object ID from the reference data for a specified entity.
entity: An entity description object.
data: Reference data for which the managed object ID is required.
Return Value ¶
The managed object ID from the reference data for a specified entity ¶
Discussion ¶
You use this method to create managed object IDs which are then used to create cache nodes for information being loaded into the store.
Special Considerations ¶
You should not override this method.
See: https://developer.apple.com/documentation/CoreData/NSAtomicStore/objectID(for:withReferenceObject:)
func (NSAtomicStore) ReferenceObjectForObjectID ¶
func (a NSAtomicStore) ReferenceObjectForObjectID(objectID INSManagedObjectID) objectivec.IObject
Returns the reference object for a given managed object ID.
objectID: A managed object ID.
Return Value ¶
The reference object for `objectID`.
Discussion ¶
Subclasses should invoke this method to extract the reference data from the object ID for each cache node if the data is to be made persistent.
See: https://developer.apple.com/documentation/CoreData/NSAtomicStore/referenceObject(for:)
func (NSAtomicStore) Save ¶
func (a NSAtomicStore) Save() (bool, error)
Saves the cache nodes.
Discussion ¶
You override this method to make persistent the necessary information from the cache nodes to the URL specified for the receiver.
Special Considerations ¶
You must override this method.
See: https://developer.apple.com/documentation/CoreData/NSAtomicStore/save()
func (NSAtomicStore) UpdateCacheNodeFromManagedObject ¶
func (a NSAtomicStore) UpdateCacheNodeFromManagedObject(node INSAtomicStoreCacheNode, managedObject INSManagedObject)
Updates the given cache node using the values in a given managed object.
node: The cache node to update.
managedObject: The managed object with which to update `node`.
Discussion ¶
This method is invoked by the framework after a save operation on a managed object context, once for each updated NSManagedObject instance.
You override this method in a subclass to take the information from `managedObject` and update `node`.
Special Considerations ¶
You must override this method.
See: https://developer.apple.com/documentation/CoreData/NSAtomicStore/updateCacheNode(_:from:)
func (NSAtomicStore) WillRemoveCacheNodes ¶
func (a NSAtomicStore) WillRemoveCacheNodes(cacheNodes foundation.INSSet)
Method invoked before the store removes the given collection of cache nodes.
cacheNodes: The set of cache nodes to remove.
Discussion ¶
This method is invoked by the store before the call to NSAtomicStore.Save with the collection of cache nodes marked as deleted by a managed object context. You can override this method to track the nodes which will not be made persistent in the NSAtomicStore.Save method.
You should not invoke this method directly in a subclass.
See: https://developer.apple.com/documentation/CoreData/NSAtomicStore/willRemoveCacheNodes(_:)
type NSAtomicStoreCacheNode ¶
type NSAtomicStoreCacheNode struct {
objectivec.Object
}
A concrete class that you use to represent basic nodes in a Core Data atomic store.
Overview ¶
A node represents a single record in a persistent store.
You can subclass NSAtomicStoreCacheNode to provide custom behavior.
Initializing a Cache Node ¶
- NSAtomicStoreCacheNode.InitWithObjectID: Returns a cache node for the given managed object ID.
Managing Node Data ¶
- NSAtomicStoreCacheNode.ObjectID: The managed object ID of the node.
- NSAtomicStoreCacheNode.PropertyCache: The property cache dictionary of the node.
- NSAtomicStoreCacheNode.SetPropertyCache
See: https://developer.apple.com/documentation/CoreData/NSAtomicStoreCacheNode
func NSAtomicStoreCacheNodeFromID ¶
func NSAtomicStoreCacheNodeFromID(id objc.ID) NSAtomicStoreCacheNode
NSAtomicStoreCacheNodeFromID constructs a NSAtomicStoreCacheNode from an objc.ID.
A concrete class that you use to represent basic nodes in a Core Data atomic store.
func NewAtomicStoreCacheNodeWithObjectID ¶
func NewAtomicStoreCacheNodeWithObjectID(moid INSManagedObjectID) NSAtomicStoreCacheNode
Returns a cache node for the given managed object ID.
moid: A managed object ID.
Return Value ¶
A cache node for the given managed object ID, or `nil` if the node could not be initialized.
See: https://developer.apple.com/documentation/CoreData/NSAtomicStoreCacheNode/init(objectID:)
func NewNSAtomicStoreCacheNode ¶
func NewNSAtomicStoreCacheNode() NSAtomicStoreCacheNode
NewNSAtomicStoreCacheNode creates a new NSAtomicStoreCacheNode instance.
func (NSAtomicStoreCacheNode) Autorelease ¶
func (a NSAtomicStoreCacheNode) Autorelease() NSAtomicStoreCacheNode
Autorelease adds the receiver to the current autorelease pool.
func (NSAtomicStoreCacheNode) Init ¶
func (a NSAtomicStoreCacheNode) Init() NSAtomicStoreCacheNode
Init initializes the instance.
func (NSAtomicStoreCacheNode) InitWithObjectID ¶
func (a NSAtomicStoreCacheNode) InitWithObjectID(moid INSManagedObjectID) NSAtomicStoreCacheNode
Returns a cache node for the given managed object ID.
moid: A managed object ID.
Return Value ¶
A cache node for the given managed object ID, or `nil` if the node could not be initialized.
See: https://developer.apple.com/documentation/CoreData/NSAtomicStoreCacheNode/init(objectID:)
func (NSAtomicStoreCacheNode) ObjectID ¶
func (a NSAtomicStoreCacheNode) ObjectID() INSManagedObjectID
The managed object ID of the node.
See: https://developer.apple.com/documentation/CoreData/NSAtomicStoreCacheNode/objectID
func (NSAtomicStoreCacheNode) PropertyCache ¶
func (a NSAtomicStoreCacheNode) PropertyCache() foundation.INSDictionary
The property cache dictionary of the node.
Discussion ¶
This dictionary is used by [NSAtomicStoreCacheNode.ValueForKey] and [NSAtomicStoreCacheNode.SetValueForKey] for property values. This property is `nil` unless it has been explicitly set or non-`nil` values have been set for keys using [NSAtomicStoreCacheNode.SetValueForKey].
See: https://developer.apple.com/documentation/CoreData/NSAtomicStoreCacheNode/propertyCache
func (NSAtomicStoreCacheNode) SetPropertyCache ¶
func (a NSAtomicStoreCacheNode) SetPropertyCache(value foundation.INSDictionary)
type NSAtomicStoreCacheNodeClass ¶
type NSAtomicStoreCacheNodeClass struct {
// contains filtered or unexported fields
}
func GetNSAtomicStoreCacheNodeClass ¶
func GetNSAtomicStoreCacheNodeClass() NSAtomicStoreCacheNodeClass
GetNSAtomicStoreCacheNodeClass returns the class object for NSAtomicStoreCacheNode.
func (NSAtomicStoreCacheNodeClass) Alloc ¶
func (nc NSAtomicStoreCacheNodeClass) Alloc() NSAtomicStoreCacheNode
Alloc allocates memory for a new instance of the class.
func (NSAtomicStoreCacheNodeClass) Class ¶
func (nc NSAtomicStoreCacheNodeClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSAtomicStoreClass ¶
type NSAtomicStoreClass struct {
// contains filtered or unexported fields
}
func GetNSAtomicStoreClass ¶
func GetNSAtomicStoreClass() NSAtomicStoreClass
GetNSAtomicStoreClass returns the class object for NSAtomicStore.
func (NSAtomicStoreClass) Alloc ¶
func (nc NSAtomicStoreClass) Alloc() NSAtomicStore
Alloc allocates memory for a new instance of the class.
func (NSAtomicStoreClass) Class ¶
func (nc NSAtomicStoreClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSAttributeDescription ¶
type NSAttributeDescription struct {
NSPropertyDescription
}
A description of a single attribute belonging to an entity.
Overview ¶
NSAttributeDescription inherits from NSPropertyDescription, which provides most of the basic behavior. Instances of NSAttributeDescription are used to describe attributes, as distinct from relationships. The class adds the ability to specify the attribute type, and to specify a default value. In a managed object model, you must specify the type of all attributes—you can only use the undefined attribute type (NSUndefinedAttributeType) for transient attributes.
Editing Attribute Descriptions ¶
Attribute descriptions are editable until they are used by an object graph manager. This allows you to create or modify them dynamically. However, once a description is used (when the managed object model to which it belongs is associated with a persistent store coordinator), it must not (indeed cannot) be changed. This is enforced at runtime: any attempt to mutate a model or any of its sub-objects after the model is associated with a persistent store coordinator causes an exception to be thrown. If you need to modify a model that is in use, create a copy, modify the copy, and then discard the objects with the old model.
Managing the type ¶
- NSAttributeDescription.AttributeValueClassName: The class name that represents the attribute’s value.
- NSAttributeDescription.SetAttributeValueClassName
- NSAttributeDescription.AttributeType: The attribute’s type.
- NSAttributeDescription.SetAttributeType
Configuring the behavior ¶
- NSAttributeDescription.AllowsCloudEncryption: A Boolean value that determines whether to encrypt the attribute’s value.
- NSAttributeDescription.SetAllowsCloudEncryption
- NSAttributeDescription.AllowsExternalBinaryDataStorage: A Boolean value that indicates whether the attribute allows external binary storage.
- NSAttributeDescription.SetAllowsExternalBinaryDataStorage
- NSAttributeDescription.DefaultValue: The default value of the attribute.
- NSAttributeDescription.SetDefaultValue
- NSAttributeDescription.PreservesValueInHistoryOnDeletion: A Boolean value that indicates whether the attribute records its value in the persistent history transaction for a managed object’s deletion.
- NSAttributeDescription.SetPreservesValueInHistoryOnDeletion
- NSAttributeDescription.ValueTransformerName: The name of the transformer to use for the attribute value.
- NSAttributeDescription.SetValueTransformerName
See: https://developer.apple.com/documentation/CoreData/NSAttributeDescription
func NSAttributeDescriptionFromID ¶
func NSAttributeDescriptionFromID(id objc.ID) NSAttributeDescription
NSAttributeDescriptionFromID constructs a NSAttributeDescription from an objc.ID.
A description of a single attribute belonging to an entity.
func NewNSAttributeDescription ¶
func NewNSAttributeDescription() NSAttributeDescription
NewNSAttributeDescription creates a new NSAttributeDescription instance.
func (NSAttributeDescription) AllowsCloudEncryption ¶
func (a NSAttributeDescription) AllowsCloudEncryption() bool
A Boolean value that determines whether to encrypt the attribute’s value.
Discussion ¶
Set this property to true to store the attribute’s value in an encrypted form in iCloud. Only use this property with new attributes. Core Data doesn’t support encrypting attributes that already exist in your CloudKit schema, or attributes that represent relationships between entities.
You can also set this property using the Allow Cloud Encryption attribute in the Attributes inspector of the Core Data model editor.
See: https://developer.apple.com/documentation/CoreData/NSAttributeDescription/allowsCloudEncryption
func (NSAttributeDescription) AllowsExternalBinaryDataStorage ¶
func (a NSAttributeDescription) AllowsExternalBinaryDataStorage() bool
A Boolean value that indicates whether the attribute allows external binary storage.
Discussion ¶
true if the attribute allows external binary storage, otherwise false. If this value is true, the corresponding attribute may be stored in a file external to the persistent store itself.
func (NSAttributeDescription) AttributeType ¶
func (a NSAttributeDescription) AttributeType() NSAttributeType
The attribute’s type.
Discussion ¶
Don’t change an attribute’s type after you add its containing managed object model to a persistent store coordinator; otherwise, Core Data throws an exception.
func (NSAttributeDescription) AttributeValueClassName ¶
func (a NSAttributeDescription) AttributeValueClassName() string
The class name that represents the attribute’s value.
See: https://developer.apple.com/documentation/CoreData/NSAttributeDescription/attributeValueClassName
func (NSAttributeDescription) Autorelease ¶
func (a NSAttributeDescription) Autorelease() NSAttributeDescription
Autorelease adds the receiver to the current autorelease pool.
func (NSAttributeDescription) DefaultValue ¶
func (a NSAttributeDescription) DefaultValue() objectivec.IObject
The default value of the attribute.
Discussion ¶
Default values are retained by a managed object model, not copied. This means that attribute values do not have to implement the [NSCopying] protocol, however it also means that you should not modify any objects after they have been set as default values.
Special Considerations ¶
Setting the default value raises an exception if the receiver’s model has been used by an object graph manager.
See: https://developer.apple.com/documentation/CoreData/NSAttributeDescription/defaultValue
func (NSAttributeDescription) Init ¶
func (a NSAttributeDescription) Init() NSAttributeDescription
Init initializes the instance.
func (NSAttributeDescription) PreservesValueInHistoryOnDeletion ¶
func (a NSAttributeDescription) PreservesValueInHistoryOnDeletion() bool
A Boolean value that indicates whether the attribute records its value in the persistent history transaction for a managed object’s deletion.
func (NSAttributeDescription) SetAllowsCloudEncryption ¶
func (a NSAttributeDescription) SetAllowsCloudEncryption(value bool)
func (NSAttributeDescription) SetAllowsExternalBinaryDataStorage ¶
func (a NSAttributeDescription) SetAllowsExternalBinaryDataStorage(value bool)
func (NSAttributeDescription) SetAttributeType ¶
func (a NSAttributeDescription) SetAttributeType(value NSAttributeType)
func (NSAttributeDescription) SetAttributeValueClassName ¶
func (a NSAttributeDescription) SetAttributeValueClassName(value string)
func (NSAttributeDescription) SetDefaultValue ¶
func (a NSAttributeDescription) SetDefaultValue(value objectivec.IObject)
func (NSAttributeDescription) SetPreservesValueInHistoryOnDeletion ¶
func (a NSAttributeDescription) SetPreservesValueInHistoryOnDeletion(value bool)
func (NSAttributeDescription) SetValueTransformerName ¶
func (a NSAttributeDescription) SetValueTransformerName(value string)
func (NSAttributeDescription) ValueTransformerName ¶
func (a NSAttributeDescription) ValueTransformerName() string
The name of the transformer to use for the attribute value.
Discussion ¶
The attribute must be of type [NSTransformedAttributeType].
The transformer must output an [NSData] object from transformedValue(_:) and must allow reverse transformations.
If this value is `nil`, Core Data uses a default a transformer that uses NSCoding to archive and unarchive the attribute value.
See: https://developer.apple.com/documentation/CoreData/NSAttributeDescription/valueTransformerName
type NSAttributeDescriptionClass ¶
type NSAttributeDescriptionClass struct {
// contains filtered or unexported fields
}
func GetNSAttributeDescriptionClass ¶
func GetNSAttributeDescriptionClass() NSAttributeDescriptionClass
GetNSAttributeDescriptionClass returns the class object for NSAttributeDescription.
func (NSAttributeDescriptionClass) Alloc ¶
func (nc NSAttributeDescriptionClass) Alloc() NSAttributeDescription
Alloc allocates memory for a new instance of the class.
func (NSAttributeDescriptionClass) Class ¶
func (nc NSAttributeDescriptionClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSAttributeType ¶
type NSAttributeType uint
See: https://developer.apple.com/documentation/CoreData/NSAttributeType
const ( // NSBinaryDataAttributeType: An attribute that stores binary data. NSBinaryDataAttributeType NSAttributeType = 1000 // NSBooleanAttributeType: An attribute that stores a Boolean value. NSBooleanAttributeType NSAttributeType = 800 // NSCompositeAttributeType: An attribute that derives its value by composing other attributes. NSCompositeAttributeType NSAttributeType = 2100 // NSDateAttributeType: An attribute that stores a date. NSDateAttributeType NSAttributeType = 900 // NSDecimalAttributeType: An attribute that stores a decimal value. NSDecimalAttributeType NSAttributeType = 400 // NSDoubleAttributeType: An attribute that stores a double value. NSDoubleAttributeType NSAttributeType = 500 // NSFloatAttributeType: An attribute that stores a float value. NSFloatAttributeType NSAttributeType = 600 // NSInteger16AttributeType: An attribute that stores a 16-bit signed integer value. NSInteger16AttributeType NSAttributeType = 100 // NSInteger32AttributeType: An attribute that stores a 32-bit signed integer value. NSInteger32AttributeType NSAttributeType = 200 // NSInteger64AttributeType: An attribute that stores a 64-bit signed integer value. NSInteger64AttributeType NSAttributeType = 300 // NSObjectIDAttributeType: An attribute that stores a managed object’s ID. NSObjectIDAttributeType NSAttributeType = 2000 // NSStringAttributeType: An attribute that stores a string. NSStringAttributeType NSAttributeType = 700 // NSTransformableAttributeType: An attribute that uses a value transformer to derive its value. NSTransformableAttributeType NSAttributeType = 1800 // NSURIAttributeType: An attribute that stores a uniform resource identifier. NSURIAttributeType NSAttributeType = 1200 // NSUUIDAttributeType: An attribute that stores a universally unique identifier. NSUUIDAttributeType NSAttributeType = 1100 // NSUndefinedAttributeType: An attribute that doesn’t have an explicit type. NSUndefinedAttributeType NSAttributeType = 0 )
func (NSAttributeType) String ¶
func (e NSAttributeType) String() string
type NSBatchDeleteRequest ¶
type NSBatchDeleteRequest struct {
NSPersistentStoreRequest
}
A request that deletes objects in the SQLite persistent store without loading them into memory.
Overview ¶
NSBatchDeleteRequest — available only when using a SQLite persistent store — deletes managed objects at the SQL level of the persistent store. This request is quicker and more efficient than using a context to fetch a large number of objects into memory, delete them, and then save those deletions back to the store. You create a request using an instance of NSFetchRequest that identifies the objects to delete. Alternatively, you can provide an array of identifiers from specific objects of the same entity type; mixing entity types results in an error when you execute the request.
NSManagedObjectContext doesn’t automatically merge a request’s deletions because they happen at the SQL level. Subsequently, you must remove any deleted objects from memory after the request finishes. To determine the objects a request deletes, configure it to return the NSManagedObjectID of each deleted object and use those identifiers to update your contexts, as the following example shows:
Alternatively, you can use persistent history tracking to make your contexts aware of changes that happen at the persistent store level. For more information, see Consuming relevant store changes.
Creating a Request ¶
- NSBatchDeleteRequest.InitWithFetchRequest: Creates a request that deletes the results of the specified fetch request.
- NSBatchDeleteRequest.InitWithObjectIDs: Creates a request that deletes the managed objects with the specified identifiers.
Accessing the Fetch Request ¶
- NSBatchDeleteRequest.FetchRequest: The fetch request that identifies the managed objects to delete.
Configuring the Result Type ¶
- NSBatchDeleteRequest.ResultType: The type of result the request provides when it executes.
- NSBatchDeleteRequest.SetResultType
See: https://developer.apple.com/documentation/CoreData/NSBatchDeleteRequest
func NSBatchDeleteRequestFromID ¶
func NSBatchDeleteRequestFromID(id objc.ID) NSBatchDeleteRequest
NSBatchDeleteRequestFromID constructs a NSBatchDeleteRequest from an objc.ID.
A request that deletes objects in the SQLite persistent store without loading them into memory.
func NewBatchDeleteRequestWithFetchRequest ¶
func NewBatchDeleteRequestWithFetchRequest(fetch INSFetchRequest) NSBatchDeleteRequest
Creates a request that deletes the results of the specified fetch request.
fetch: The fetch request that identifies the managed objects to delete.
See: https://developer.apple.com/documentation/CoreData/NSBatchDeleteRequest/init(fetchRequest:)
func NewBatchDeleteRequestWithObjectIDs ¶
func NewBatchDeleteRequestWithObjectIDs(objects []NSManagedObjectID) NSBatchDeleteRequest
Creates a request that deletes the managed objects with the specified identifiers.
objects: The array that contains the identifiers of the managed objects to delete.
Discussion ¶
See: https://developer.apple.com/documentation/CoreData/NSBatchDeleteRequest/init(objectIDs:)
func NewNSBatchDeleteRequest ¶
func NewNSBatchDeleteRequest() NSBatchDeleteRequest
NewNSBatchDeleteRequest creates a new NSBatchDeleteRequest instance.
func (NSBatchDeleteRequest) Autorelease ¶
func (b NSBatchDeleteRequest) Autorelease() NSBatchDeleteRequest
Autorelease adds the receiver to the current autorelease pool.
func (NSBatchDeleteRequest) FetchRequest ¶
func (b NSBatchDeleteRequest) FetchRequest() INSFetchRequest
The fetch request that identifies the managed objects to delete.
Discussion ¶
This property contains the fetch request that identifies the managed objects to delete. If you initialize NSBatchDeleteRequest with an array of NSManagedObjectID, Core Data automatically generates a fetch request with a predicate that matches the identifiers in that array.
See: https://developer.apple.com/documentation/CoreData/NSBatchDeleteRequest/fetchRequest
func (NSBatchDeleteRequest) Init ¶
func (b NSBatchDeleteRequest) Init() NSBatchDeleteRequest
Init initializes the instance.
func (NSBatchDeleteRequest) InitWithFetchRequest ¶
func (b NSBatchDeleteRequest) InitWithFetchRequest(fetch INSFetchRequest) NSBatchDeleteRequest
Creates a request that deletes the results of the specified fetch request.
fetch: The fetch request that identifies the managed objects to delete.
See: https://developer.apple.com/documentation/CoreData/NSBatchDeleteRequest/init(fetchRequest:)
func (NSBatchDeleteRequest) InitWithObjectIDs ¶
func (b NSBatchDeleteRequest) InitWithObjectIDs(objects []NSManagedObjectID) NSBatchDeleteRequest
Creates a request that deletes the managed objects with the specified identifiers.
objects: The array that contains the identifiers of the managed objects to delete.
Discussion ¶
See: https://developer.apple.com/documentation/CoreData/NSBatchDeleteRequest/init(objectIDs:)
func (NSBatchDeleteRequest) ResultType ¶
func (b NSBatchDeleteRequest) ResultType() NSBatchDeleteRequestResultType
The type of result the request provides when it executes.
Discussion ¶
Set this property before you execute the request if you require a result type other than the default of NSBatchDeleteRequestResultType.resultTypeStatusOnly.
See: https://developer.apple.com/documentation/CoreData/NSBatchDeleteRequest/resultType
func (NSBatchDeleteRequest) SetResultType ¶
func (b NSBatchDeleteRequest) SetResultType(value NSBatchDeleteRequestResultType)
type NSBatchDeleteRequestClass ¶
type NSBatchDeleteRequestClass struct {
// contains filtered or unexported fields
}
func GetNSBatchDeleteRequestClass ¶
func GetNSBatchDeleteRequestClass() NSBatchDeleteRequestClass
GetNSBatchDeleteRequestClass returns the class object for NSBatchDeleteRequest.
func (NSBatchDeleteRequestClass) Alloc ¶
func (nc NSBatchDeleteRequestClass) Alloc() NSBatchDeleteRequest
Alloc allocates memory for a new instance of the class.
func (NSBatchDeleteRequestClass) Class ¶
func (nc NSBatchDeleteRequestClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSBatchDeleteRequestResultType ¶
type NSBatchDeleteRequestResultType uint
See: https://developer.apple.com/documentation/CoreData/NSBatchDeleteRequestResultType
const ( // NSBatchDeleteResultTypeCount: Returns the number of managed objects the request deletes. NSBatchDeleteResultTypeCount NSBatchDeleteRequestResultType = 0x2 // NSBatchDeleteResultTypeObjectIDs: Returns an array of the deleted managed objects’ identifiers. NSBatchDeleteResultTypeObjectIDs NSBatchDeleteRequestResultType = 0x1 // NSBatchDeleteResultTypeStatusOnly: Returns a Boolean value that indicates if the request succeeds. NSBatchDeleteResultTypeStatusOnly NSBatchDeleteRequestResultType = 0 )
func (NSBatchDeleteRequestResultType) String ¶
func (e NSBatchDeleteRequestResultType) String() string
type NSBatchDeleteResult ¶
type NSBatchDeleteResult struct {
NSPersistentStoreResult
}
An object that describes the result of a batch delete request.
Accessing the Result ¶
- NSBatchDeleteResult.Result: The value the request returns after it executes.
- NSBatchDeleteResult.ResultType: The data type of the request’s result value.
See: https://developer.apple.com/documentation/CoreData/NSBatchDeleteResult
func NSBatchDeleteResultFromID ¶
func NSBatchDeleteResultFromID(id objc.ID) NSBatchDeleteResult
NSBatchDeleteResultFromID constructs a NSBatchDeleteResult from an objc.ID.
An object that describes the result of a batch delete request.
func NewNSBatchDeleteResult ¶
func NewNSBatchDeleteResult() NSBatchDeleteResult
NewNSBatchDeleteResult creates a new NSBatchDeleteResult instance.
func (NSBatchDeleteResult) Autorelease ¶
func (b NSBatchDeleteResult) Autorelease() NSBatchDeleteResult
Autorelease adds the receiver to the current autorelease pool.
func (NSBatchDeleteResult) Init ¶
func (b NSBatchDeleteResult) Init() NSBatchDeleteResult
Init initializes the instance.
func (NSBatchDeleteResult) Result ¶
func (b NSBatchDeleteResult) Result() objectivec.IObject
The value the request returns after it executes.
Discussion ¶
Use NSBatchDeleteResult.ResultType to determine the kind of value this property contains, and then cast to the appropriate type as the following example shows:
See: https://developer.apple.com/documentation/CoreData/NSBatchDeleteResult/result
func (NSBatchDeleteResult) ResultType ¶
func (b NSBatchDeleteResult) ResultType() NSBatchDeleteRequestResultType
The data type of the request’s result value.
Discussion ¶
This property’s value is set to the request’s NSBatchDeleteRequest.ResultType property.
See: https://developer.apple.com/documentation/CoreData/NSBatchDeleteResult/resultType
type NSBatchDeleteResultClass ¶
type NSBatchDeleteResultClass struct {
// contains filtered or unexported fields
}
func GetNSBatchDeleteResultClass ¶
func GetNSBatchDeleteResultClass() NSBatchDeleteResultClass
GetNSBatchDeleteResultClass returns the class object for NSBatchDeleteResult.
func (NSBatchDeleteResultClass) Alloc ¶
func (nc NSBatchDeleteResultClass) Alloc() NSBatchDeleteResult
Alloc allocates memory for a new instance of the class.
func (NSBatchDeleteResultClass) Class ¶
func (nc NSBatchDeleteResultClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSBatchInsertRequest ¶
type NSBatchInsertRequest struct {
NSPersistentStoreRequest
}
A request to insert a batch of data in a persistent store.
Creating a Request ¶
- NSBatchInsertRequest.InitWithEntityManagedObjectHandler: Creates a batch-insertion request for a managed entity, and specifies a closure that inserts data into the entity.
- NSBatchInsertRequest.InitWithEntityNameManagedObjectHandler: Creates a batch-insertion request for a named managed entity, and specifies a closure that inserts data into the entity.
- NSBatchInsertRequest.InitWithEntityObjects: Creates a batch-insertion request for a managed entity, and provides an array of data dictionaries for insertion.
- NSBatchInsertRequest.InitWithEntityNameObjects: Creates a batch-insertion request for a named managed entity, and provides an array of data dictionaries for insertion.
Configuring a Request ¶
- NSBatchInsertRequest.DictionaryHandler: A closure that provides a dictionary for your app to insert data into.
- NSBatchInsertRequest.SetDictionaryHandler
- NSBatchInsertRequest.Entity: The managed entity to insert data into.
- NSBatchInsertRequest.EntityName: The name of the managed entity to insert data into.
- NSBatchInsertRequest.ManagedObjectHandler: A closure that provides a managed object for your app to insert data into.
- NSBatchInsertRequest.SetManagedObjectHandler
- NSBatchInsertRequest.ObjectsToInsert: An array of dictionaries that represents the objects to insert with the keys as attribute names and their assigned values.
- NSBatchInsertRequest.SetObjectsToInsert
- NSBatchInsertRequest.ResultType: The type of result that Core Data returns from this request.
- NSBatchInsertRequest.SetResultType
See: https://developer.apple.com/documentation/CoreData/NSBatchInsertRequest
func NSBatchInsertRequestFromID ¶
func NSBatchInsertRequestFromID(id objc.ID) NSBatchInsertRequest
NSBatchInsertRequestFromID constructs a NSBatchInsertRequest from an objc.ID.
A request to insert a batch of data in a persistent store.
func NewBatchInsertRequestWithEntityNameObjects ¶
func NewBatchInsertRequestWithEntityNameObjects(entityName string, dictionaries foundation.INSDictionary) NSBatchInsertRequest
Creates a batch-insertion request for a named managed entity, and provides an array of data dictionaries for insertion.
entityName: The name of the managed entity to insert data into.
dictionaries: An array of dictionaries that represents objects to insert. Each dictionary contains an attribute name key and a value.
Return Value ¶
A batch-insertion request.
See: https://developer.apple.com/documentation/CoreData/NSBatchInsertRequest/init(entityName:objects:)
func NewBatchInsertRequestWithEntityObjects ¶
func NewBatchInsertRequestWithEntityObjects(entity INSEntityDescription, dictionaries foundation.INSDictionary) NSBatchInsertRequest
Creates a batch-insertion request for a managed entity, and provides an array of data dictionaries for insertion.
entity: The managed entity to insert data into.
dictionaries: An array of dictionaries that represents objects to insert. Each dictionary contains an attribute name key and a value.
Return Value ¶
A batch-insertion request.
See: https://developer.apple.com/documentation/CoreData/NSBatchInsertRequest/init(entity:objects:)
func NewNSBatchInsertRequest ¶
func NewNSBatchInsertRequest() NSBatchInsertRequest
NewNSBatchInsertRequest creates a new NSBatchInsertRequest instance.
func (NSBatchInsertRequest) Autorelease ¶
func (b NSBatchInsertRequest) Autorelease() NSBatchInsertRequest
Autorelease adds the receiver to the current autorelease pool.
func (NSBatchInsertRequest) DictionaryHandler ¶
func (b NSBatchInsertRequest) DictionaryHandler() objectivec.IObject
A closure that provides a dictionary for your app to insert data into.
See: https://developer.apple.com/documentation/CoreData/NSBatchInsertRequest/dictionaryHandler
func (NSBatchInsertRequest) Entity ¶
func (b NSBatchInsertRequest) Entity() INSEntityDescription
The managed entity to insert data into.
See: https://developer.apple.com/documentation/CoreData/NSBatchInsertRequest/entity
func (NSBatchInsertRequest) EntityName ¶
func (b NSBatchInsertRequest) EntityName() string
The name of the managed entity to insert data into.
See: https://developer.apple.com/documentation/CoreData/NSBatchInsertRequest/entityName
func (NSBatchInsertRequest) Init ¶
func (b NSBatchInsertRequest) Init() NSBatchInsertRequest
Init initializes the instance.
func (NSBatchInsertRequest) InitWithEntityManagedObjectHandler ¶
func (b NSBatchInsertRequest) InitWithEntityManagedObjectHandler(entity INSEntityDescription, handler BoolManagedObjectHandler) NSBatchInsertRequest
Creates a batch-insertion request for a managed entity, and specifies a closure that inserts data into the entity.
entity: A managed entity to insert data into.
handler: A closure that inserts data into the managed entity.
Return Value ¶
A batch-insertion request.
Discussion ¶
Core Data repeatedly calls the provided closure until it returns `true`, then finishes the request and saves the data.
func (NSBatchInsertRequest) InitWithEntityNameManagedObjectHandler ¶
func (b NSBatchInsertRequest) InitWithEntityNameManagedObjectHandler(entityName string, handler BoolManagedObjectHandler) NSBatchInsertRequest
Creates a batch-insertion request for a named managed entity, and specifies a closure that inserts data into the entity.
entityName: The name of the managed entity that defines the object to create.
handler: A closure that inserts data into the managed entity.
Return Value ¶
A batch-insertion request.
Discussion ¶
Core Data repeatedly calls the provided closure until it returns `true`, then finishes the request and saves the data.
func (NSBatchInsertRequest) InitWithEntityNameObjects ¶
func (b NSBatchInsertRequest) InitWithEntityNameObjects(entityName string, dictionaries foundation.INSDictionary) NSBatchInsertRequest
Creates a batch-insertion request for a named managed entity, and provides an array of data dictionaries for insertion.
entityName: The name of the managed entity to insert data into.
dictionaries: An array of dictionaries that represents objects to insert. Each dictionary contains an attribute name key and a value.
Return Value ¶
A batch-insertion request.
See: https://developer.apple.com/documentation/CoreData/NSBatchInsertRequest/init(entityName:objects:)
func (NSBatchInsertRequest) InitWithEntityObjects ¶
func (b NSBatchInsertRequest) InitWithEntityObjects(entity INSEntityDescription, dictionaries foundation.INSDictionary) NSBatchInsertRequest
Creates a batch-insertion request for a managed entity, and provides an array of data dictionaries for insertion.
entity: The managed entity to insert data into.
dictionaries: An array of dictionaries that represents objects to insert. Each dictionary contains an attribute name key and a value.
Return Value ¶
A batch-insertion request.
See: https://developer.apple.com/documentation/CoreData/NSBatchInsertRequest/init(entity:objects:)
func (NSBatchInsertRequest) ManagedObjectHandler ¶
func (b NSBatchInsertRequest) ManagedObjectHandler() BoolManagedObjectHandler
A closure that provides a managed object for your app to insert data into.
See: https://developer.apple.com/documentation/CoreData/NSBatchInsertRequest/managedObjectHandler
func (NSBatchInsertRequest) ObjectsToInsert ¶
func (b NSBatchInsertRequest) ObjectsToInsert() foundation.INSDictionary
An array of dictionaries that represents the objects to insert with the keys as attribute names and their assigned values.
See: https://developer.apple.com/documentation/CoreData/NSBatchInsertRequest/objectsToInsert
func (NSBatchInsertRequest) ResultType ¶
func (b NSBatchInsertRequest) ResultType() NSBatchInsertRequestResultType
The type of result that Core Data returns from this request.
Discussion ¶
The default is NSBatchInsertRequestResultType.statusOnly.
See: https://developer.apple.com/documentation/CoreData/NSBatchInsertRequest/resultType
func (NSBatchInsertRequest) SetDictionaryHandler ¶
func (b NSBatchInsertRequest) SetDictionaryHandler(value objc.ID)
func (NSBatchInsertRequest) SetManagedObjectHandler ¶
func (b NSBatchInsertRequest) SetManagedObjectHandler(value BoolManagedObjectHandler)
func (NSBatchInsertRequest) SetObjectsToInsert ¶
func (b NSBatchInsertRequest) SetObjectsToInsert(value foundation.INSDictionary)
func (NSBatchInsertRequest) SetResultType ¶
func (b NSBatchInsertRequest) SetResultType(value NSBatchInsertRequestResultType)
type NSBatchInsertRequestClass ¶
type NSBatchInsertRequestClass struct {
// contains filtered or unexported fields
}
func GetNSBatchInsertRequestClass ¶
func GetNSBatchInsertRequestClass() NSBatchInsertRequestClass
GetNSBatchInsertRequestClass returns the class object for NSBatchInsertRequest.
func (NSBatchInsertRequestClass) Alloc ¶
func (nc NSBatchInsertRequestClass) Alloc() NSBatchInsertRequest
Alloc allocates memory for a new instance of the class.
func (NSBatchInsertRequestClass) Class ¶
func (nc NSBatchInsertRequestClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSBatchInsertRequestResultType ¶
type NSBatchInsertRequestResultType uint
See: https://developer.apple.com/documentation/CoreData/NSBatchInsertRequestResultType
const ( // NSBatchInsertRequestResultTypeCount: A value that indicates that the return type is the number of inserted rows. NSBatchInsertRequestResultTypeCount NSBatchInsertRequestResultType = 0x2 // NSBatchInsertRequestResultTypeObjectIDs: A value that indicates the return type is an array of object IDs that corresponds to the inserted rows. NSBatchInsertRequestResultTypeObjectIDs NSBatchInsertRequestResultType = 0x1 // NSBatchInsertRequestResultTypeStatusOnly: A value that indicates that the return type is a Boolean value representing whether the batch-insertion request succeeded. NSBatchInsertRequestResultTypeStatusOnly NSBatchInsertRequestResultType = 0 )
func (NSBatchInsertRequestResultType) String ¶
func (e NSBatchInsertRequestResultType) String() string
type NSBatchInsertResult ¶
type NSBatchInsertResult struct {
NSPersistentStoreResult
}
The result that Core Data returns when executing a batch-insertion request.
Accessing Results ¶
- NSBatchInsertResult.Result: The result of a batch-insertion request.
- NSBatchInsertResult.ResultType: The type of result that Core Data returns from this request.
See: https://developer.apple.com/documentation/CoreData/NSBatchInsertResult
func NSBatchInsertResultFromID ¶
func NSBatchInsertResultFromID(id objc.ID) NSBatchInsertResult
NSBatchInsertResultFromID constructs a NSBatchInsertResult from an objc.ID.
The result that Core Data returns when executing a batch-insertion request.
func NewNSBatchInsertResult ¶
func NewNSBatchInsertResult() NSBatchInsertResult
NewNSBatchInsertResult creates a new NSBatchInsertResult instance.
func (NSBatchInsertResult) Autorelease ¶
func (b NSBatchInsertResult) Autorelease() NSBatchInsertResult
Autorelease adds the receiver to the current autorelease pool.
func (NSBatchInsertResult) Init ¶
func (b NSBatchInsertResult) Init() NSBatchInsertResult
Init initializes the instance.
func (NSBatchInsertResult) Result ¶
func (b NSBatchInsertResult) Result() objectivec.IObject
The result of a batch-insertion request.
Discussion ¶
Cast the result to the type corresponding to NSBatchInsertResult.ResultType to inspect it. The following example shows how to inspect a result type of NSBatchInsertRequestResultType.statusOnly.
See: https://developer.apple.com/documentation/CoreData/NSBatchInsertResult/result
func (NSBatchInsertResult) ResultType ¶
func (b NSBatchInsertResult) ResultType() NSBatchInsertRequestResultType
The type of result that Core Data returns from this request.
See: https://developer.apple.com/documentation/CoreData/NSBatchInsertResult/resultType
type NSBatchInsertResultClass ¶
type NSBatchInsertResultClass struct {
// contains filtered or unexported fields
}
func GetNSBatchInsertResultClass ¶
func GetNSBatchInsertResultClass() NSBatchInsertResultClass
GetNSBatchInsertResultClass returns the class object for NSBatchInsertResult.
func (NSBatchInsertResultClass) Alloc ¶
func (nc NSBatchInsertResultClass) Alloc() NSBatchInsertResult
Alloc allocates memory for a new instance of the class.
func (NSBatchInsertResultClass) Class ¶
func (nc NSBatchInsertResultClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSBatchUpdateRequest ¶
type NSBatchUpdateRequest struct {
NSPersistentStoreRequest
}
A request to Core Data to do a batch update of data in a persistent store without loading any data into memory.
Creating a Request ¶
- NSBatchUpdateRequest.InitWithEntity: Creates a batch-update request for a managed entity.
- NSBatchUpdateRequest.InitWithEntityName: Creates a batch-update request for a named managed entity.
Configuring a Request ¶
- NSBatchUpdateRequest.Entity: The managed entity to update data for.
- NSBatchUpdateRequest.EntityName: The name of the managed entity to update data for.
- NSBatchUpdateRequest.IncludesSubentities: A Boolean value that indicates whether to update subentities.
- NSBatchUpdateRequest.SetIncludesSubentities
- NSBatchUpdateRequest.Predicate: A predicate that identifies the objects to update.
- NSBatchUpdateRequest.SetPredicate
- NSBatchUpdateRequest.PropertiesToUpdate: A dictionary of property description pairs that describe the updates.
- NSBatchUpdateRequest.SetPropertiesToUpdate
- NSBatchUpdateRequest.ResultType: The type of result that Core Data returns from the request.
- NSBatchUpdateRequest.SetResultType
See: https://developer.apple.com/documentation/CoreData/NSBatchUpdateRequest
func NSBatchUpdateRequestFromID ¶
func NSBatchUpdateRequestFromID(id objc.ID) NSBatchUpdateRequest
NSBatchUpdateRequestFromID constructs a NSBatchUpdateRequest from an objc.ID.
A request to Core Data to do a batch update of data in a persistent store without loading any data into memory.
func NewBatchUpdateRequestWithEntity ¶
func NewBatchUpdateRequestWithEntity(entity INSEntityDescription) NSBatchUpdateRequest
Creates a batch-update request for a managed entity.
entity: The managed entity to update data for.
See: https://developer.apple.com/documentation/CoreData/NSBatchUpdateRequest/init(entity:)
func NewBatchUpdateRequestWithEntityName ¶
func NewBatchUpdateRequestWithEntityName(entityName string) NSBatchUpdateRequest
Creates a batch-update request for a named managed entity.
entityName: The name of the managed entity to update data for.
See: https://developer.apple.com/documentation/CoreData/NSBatchUpdateRequest/init(entityName:)
func NewNSBatchUpdateRequest ¶
func NewNSBatchUpdateRequest() NSBatchUpdateRequest
NewNSBatchUpdateRequest creates a new NSBatchUpdateRequest instance.
func (NSBatchUpdateRequest) Autorelease ¶
func (b NSBatchUpdateRequest) Autorelease() NSBatchUpdateRequest
Autorelease adds the receiver to the current autorelease pool.
func (NSBatchUpdateRequest) Entity ¶
func (b NSBatchUpdateRequest) Entity() INSEntityDescription
The managed entity to update data for.
See: https://developer.apple.com/documentation/CoreData/NSBatchUpdateRequest/entity
func (NSBatchUpdateRequest) EntityName ¶
func (b NSBatchUpdateRequest) EntityName() string
The name of the managed entity to update data for.
See: https://developer.apple.com/documentation/CoreData/NSBatchUpdateRequest/entityName
func (NSBatchUpdateRequest) IncludesSubentities ¶
func (b NSBatchUpdateRequest) IncludesSubentities() bool
A Boolean value that indicates whether to update subentities.
Discussion ¶
The default value is true.
See: https://developer.apple.com/documentation/CoreData/NSBatchUpdateRequest/includesSubentities
func (NSBatchUpdateRequest) Init ¶
func (b NSBatchUpdateRequest) Init() NSBatchUpdateRequest
Init initializes the instance.
func (NSBatchUpdateRequest) InitWithEntity ¶
func (b NSBatchUpdateRequest) InitWithEntity(entity INSEntityDescription) NSBatchUpdateRequest
Creates a batch-update request for a managed entity.
entity: The managed entity to update data for.
See: https://developer.apple.com/documentation/CoreData/NSBatchUpdateRequest/init(entity:)
func (NSBatchUpdateRequest) InitWithEntityName ¶
func (b NSBatchUpdateRequest) InitWithEntityName(entityName string) NSBatchUpdateRequest
Creates a batch-update request for a named managed entity.
entityName: The name of the managed entity to update data for.
See: https://developer.apple.com/documentation/CoreData/NSBatchUpdateRequest/init(entityName:)
func (NSBatchUpdateRequest) Predicate ¶
func (b NSBatchUpdateRequest) Predicate() foundation.NSPredicate
A predicate that identifies the objects to update.
See: https://developer.apple.com/documentation/CoreData/NSBatchUpdateRequest/predicate
func (NSBatchUpdateRequest) PropertiesToUpdate ¶
func (b NSBatchUpdateRequest) PropertiesToUpdate() foundation.INSDictionary
A dictionary of property description pairs that describe the updates.
Discussion ¶
The dictionary keys are either NSPropertyDescription objects or strings that identify the property name.
The dictionary values are either a constant value or an NSExpression that evaluates to a scalar value.
See: https://developer.apple.com/documentation/CoreData/NSBatchUpdateRequest/propertiesToUpdate
func (NSBatchUpdateRequest) ResultType ¶
func (b NSBatchUpdateRequest) ResultType() NSBatchUpdateRequestResultType
The type of result that Core Data returns from the request.
See: https://developer.apple.com/documentation/CoreData/NSBatchUpdateRequest/resultType
func (NSBatchUpdateRequest) SetIncludesSubentities ¶
func (b NSBatchUpdateRequest) SetIncludesSubentities(value bool)
func (NSBatchUpdateRequest) SetPredicate ¶
func (b NSBatchUpdateRequest) SetPredicate(value foundation.NSPredicate)
func (NSBatchUpdateRequest) SetPropertiesToUpdate ¶
func (b NSBatchUpdateRequest) SetPropertiesToUpdate(value foundation.INSDictionary)
func (NSBatchUpdateRequest) SetResultType ¶
func (b NSBatchUpdateRequest) SetResultType(value NSBatchUpdateRequestResultType)
type NSBatchUpdateRequestClass ¶
type NSBatchUpdateRequestClass struct {
// contains filtered or unexported fields
}
func GetNSBatchUpdateRequestClass ¶
func GetNSBatchUpdateRequestClass() NSBatchUpdateRequestClass
GetNSBatchUpdateRequestClass returns the class object for NSBatchUpdateRequest.
func (NSBatchUpdateRequestClass) Alloc ¶
func (nc NSBatchUpdateRequestClass) Alloc() NSBatchUpdateRequest
Alloc allocates memory for a new instance of the class.
func (NSBatchUpdateRequestClass) Class ¶
func (nc NSBatchUpdateRequestClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSBatchUpdateRequestResultType ¶
type NSBatchUpdateRequestResultType uint
See: https://developer.apple.com/documentation/CoreData/NSBatchUpdateRequestResultType
const ( // NSStatusOnlyResultType: A value that indicates the return type is a Boolean value representing whether the batch-update request succeeds. NSStatusOnlyResultType NSBatchUpdateRequestResultType = 0 // NSUpdatedObjectIDsResultType: A value that indicates the return type is an array of object IDs that corresponds to the updated rows. NSUpdatedObjectIDsResultType NSBatchUpdateRequestResultType = 0x1 // NSUpdatedObjectsCountResultType: A value that indicates the return type is the number of updated rows. NSUpdatedObjectsCountResultType NSBatchUpdateRequestResultType = 0x2 )
func (NSBatchUpdateRequestResultType) String ¶
func (e NSBatchUpdateRequestResultType) String() string
type NSBatchUpdateResult ¶
type NSBatchUpdateResult struct {
NSPersistentStoreResult
}
The result returned when executing a batch update request.
Accessing Results ¶
- NSBatchUpdateResult.Result: The result of a batch-update request, either the number of updated objects, the identifiers of the updated objects, or a status value.
- NSBatchUpdateResult.ResultType: The type of result that Core Data returns from the request.
See: https://developer.apple.com/documentation/CoreData/NSBatchUpdateResult
func NSBatchUpdateResultFromID ¶
func NSBatchUpdateResultFromID(id objc.ID) NSBatchUpdateResult
NSBatchUpdateResultFromID constructs a NSBatchUpdateResult from an objc.ID.
The result returned when executing a batch update request.
func NewNSBatchUpdateResult ¶
func NewNSBatchUpdateResult() NSBatchUpdateResult
NewNSBatchUpdateResult creates a new NSBatchUpdateResult instance.
func (NSBatchUpdateResult) Autorelease ¶
func (b NSBatchUpdateResult) Autorelease() NSBatchUpdateResult
Autorelease adds the receiver to the current autorelease pool.
func (NSBatchUpdateResult) Init ¶
func (b NSBatchUpdateResult) Init() NSBatchUpdateResult
Init initializes the instance.
func (NSBatchUpdateResult) Result ¶
func (b NSBatchUpdateResult) Result() objectivec.IObject
The result of a batch-update request, either the number of updated objects, the identifiers of the updated objects, or a status value.
See: https://developer.apple.com/documentation/CoreData/NSBatchUpdateResult/result
func (NSBatchUpdateResult) ResultType ¶
func (b NSBatchUpdateResult) ResultType() NSBatchUpdateRequestResultType
The type of result that Core Data returns from the request.
See: https://developer.apple.com/documentation/CoreData/NSBatchUpdateResult/resultType
type NSBatchUpdateResultClass ¶
type NSBatchUpdateResultClass struct {
// contains filtered or unexported fields
}
func GetNSBatchUpdateResultClass ¶
func GetNSBatchUpdateResultClass() NSBatchUpdateResultClass
GetNSBatchUpdateResultClass returns the class object for NSBatchUpdateResult.
func (NSBatchUpdateResultClass) Alloc ¶
func (nc NSBatchUpdateResultClass) Alloc() NSBatchUpdateResult
Alloc allocates memory for a new instance of the class.
func (NSBatchUpdateResultClass) Class ¶
func (nc NSBatchUpdateResultClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSCompositeAttributeDescription ¶
type NSCompositeAttributeDescription struct {
NSAttributeDescription
}
A description of an attribute that derives its value by composing other attributes.
Overview ¶
Composite attributes enable you to define and store complex data types, and then query, index, and apply constraints to those types. Model classes use dictionaries to represent those composites in-memory, where each dictionary contains keys corresponding to the names of the underlying attributes. You may use composite attributes anywhere you use standard attributes, including lightweight migrations and CloudKit, through NSPersistentCloudKitContainer. You can even nest composites inside other composites to create complex object hierarchies without additional model classes.
In most scenarios, prefer to use Xcode’s model editor to add composite attributes to your entities and then regenerate your model classes. However, if you need to create composites dynamically at runtime, create an instance of this class and populate its NSCompositeAttributeDescription.Elements property with the necessary attribute descriptions.
You can access a composite’s underlying attributes using namespaced key paths and property-like setters and getters, as the following example demonstrates:
Composing attributes ¶
- NSCompositeAttributeDescription.Elements: The composed attribute descriptions.
- NSCompositeAttributeDescription.SetElements
See: https://developer.apple.com/documentation/CoreData/NSCompositeAttributeDescription
func NSCompositeAttributeDescriptionFromID ¶
func NSCompositeAttributeDescriptionFromID(id objc.ID) NSCompositeAttributeDescription
NSCompositeAttributeDescriptionFromID constructs a NSCompositeAttributeDescription from an objc.ID.
A description of an attribute that derives its value by composing other attributes.
func NewNSCompositeAttributeDescription ¶
func NewNSCompositeAttributeDescription() NSCompositeAttributeDescription
NewNSCompositeAttributeDescription creates a new NSCompositeAttributeDescription instance.
func (NSCompositeAttributeDescription) Autorelease ¶
func (c NSCompositeAttributeDescription) Autorelease() NSCompositeAttributeDescription
Autorelease adds the receiver to the current autorelease pool.
func (NSCompositeAttributeDescription) Elements ¶
func (c NSCompositeAttributeDescription) Elements() []NSAttributeDescription
The composed attribute descriptions.
See: https://developer.apple.com/documentation/CoreData/NSCompositeAttributeDescription/elements
func (NSCompositeAttributeDescription) Init ¶
func (c NSCompositeAttributeDescription) Init() NSCompositeAttributeDescription
Init initializes the instance.
func (NSCompositeAttributeDescription) SetElements ¶
func (c NSCompositeAttributeDescription) SetElements(value []NSAttributeDescription)
type NSCompositeAttributeDescriptionClass ¶
type NSCompositeAttributeDescriptionClass struct {
// contains filtered or unexported fields
}
func GetNSCompositeAttributeDescriptionClass ¶
func GetNSCompositeAttributeDescriptionClass() NSCompositeAttributeDescriptionClass
GetNSCompositeAttributeDescriptionClass returns the class object for NSCompositeAttributeDescription.
func (NSCompositeAttributeDescriptionClass) Alloc ¶
func (nc NSCompositeAttributeDescriptionClass) Alloc() NSCompositeAttributeDescription
Alloc allocates memory for a new instance of the class.
func (NSCompositeAttributeDescriptionClass) Class ¶
func (nc NSCompositeAttributeDescriptionClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSConstraintConflict ¶
type NSConstraintConflict struct {
objectivec.Object
}
An encapsulation of conflicts that occur during an attempt to save a managed object.
Overview ¶
A constraint conflict occurs when your data model is using unique constraints and one or more managed objects are violating that constraint.
When this error occurs, the error instance can be interrogated to determine which instance of NSManagedObject is violating the constraint and which property on the NSManagedObject instance is in violation.
Initializing a Conflict ¶
- NSConstraintConflict.InitWithConstraintDatabaseObjectDatabaseSnapshotConflictingObjectsConflictingSnapshots: Initializes a constraint conflict.
Inspecting a Conflict ¶
- NSConstraintConflict.ConflictingObjects: The managed objects that are in conflict.
- NSConstraintConflict.ConflictingSnapshots: The original property values of objects in violation of the constraint.
- NSConstraintConflict.Constraint: The constraint that has been violated.
- NSConstraintConflict.ConstraintValues: The values that the conflicting objects had when the conflict was created.
- NSConstraintConflict.DatabaseObject: The object whose database row is using constraint values.
- NSConstraintConflict.DatabaseSnapshot: The values currently stored in the database.
See: https://developer.apple.com/documentation/CoreData/NSConstraintConflict
func NSConstraintConflictFromID ¶
func NSConstraintConflictFromID(id objc.ID) NSConstraintConflict
NSConstraintConflictFromID constructs a NSConstraintConflict from an objc.ID.
An encapsulation of conflicts that occur during an attempt to save a managed object.
func NewConstraintConflictWithConstraintDatabaseObjectDatabaseSnapshotConflictingObjectsConflictingSnapshots ¶
func NewConstraintConflictWithConstraintDatabaseObjectDatabaseSnapshotConflictingObjectsConflictingSnapshots(contraint []string, databaseObject INSManagedObject, databaseSnapshot foundation.INSDictionary, conflictingObjects []NSManagedObject, conflictingSnapshots foundation.INSArray) NSConstraintConflict
Initializes a constraint conflict.
func NewNSConstraintConflict ¶
func NewNSConstraintConflict() NSConstraintConflict
NewNSConstraintConflict creates a new NSConstraintConflict instance.
func (NSConstraintConflict) Autorelease ¶
func (c NSConstraintConflict) Autorelease() NSConstraintConflict
Autorelease adds the receiver to the current autorelease pool.
func (NSConstraintConflict) ConflictingObjects ¶
func (c NSConstraintConflict) ConflictingObjects() []NSManagedObject
The managed objects that are in conflict.
See: https://developer.apple.com/documentation/CoreData/NSConstraintConflict/conflictingObjects
func (NSConstraintConflict) ConflictingSnapshots ¶
func (c NSConstraintConflict) ConflictingSnapshots() foundation.INSDictionary
The original property values of objects in violation of the constraint.
See: https://developer.apple.com/documentation/CoreData/NSConstraintConflict/conflictingSnapshots
func (NSConstraintConflict) Constraint ¶
func (c NSConstraintConflict) Constraint() []string
The constraint that has been violated.
See: https://developer.apple.com/documentation/CoreData/NSConstraintConflict/constraint
func (NSConstraintConflict) ConstraintValues ¶
func (c NSConstraintConflict) ConstraintValues() foundation.INSDictionary
The values that the conflicting objects had when the conflict was created.
See: https://developer.apple.com/documentation/CoreData/NSConstraintConflict/constraintValues
func (NSConstraintConflict) DatabaseObject ¶
func (c NSConstraintConflict) DatabaseObject() INSManagedObject
The object whose database row is using constraint values.
See: https://developer.apple.com/documentation/CoreData/NSConstraintConflict/databaseObject
func (NSConstraintConflict) DatabaseSnapshot ¶
func (c NSConstraintConflict) DatabaseSnapshot() foundation.INSDictionary
The values currently stored in the database.
See: https://developer.apple.com/documentation/CoreData/NSConstraintConflict/databaseSnapshot
func (NSConstraintConflict) Init ¶
func (c NSConstraintConflict) Init() NSConstraintConflict
Init initializes the instance.
func (NSConstraintConflict) InitWithConstraintDatabaseObjectDatabaseSnapshotConflictingObjectsConflictingSnapshots ¶
func (c NSConstraintConflict) InitWithConstraintDatabaseObjectDatabaseSnapshotConflictingObjectsConflictingSnapshots(contraint []string, databaseObject INSManagedObject, databaseSnapshot foundation.INSDictionary, conflictingObjects []NSManagedObject, conflictingSnapshots foundation.INSArray) NSConstraintConflict
Initializes a constraint conflict.
type NSConstraintConflictClass ¶
type NSConstraintConflictClass struct {
// contains filtered or unexported fields
}
func GetNSConstraintConflictClass ¶
func GetNSConstraintConflictClass() NSConstraintConflictClass
GetNSConstraintConflictClass returns the class object for NSConstraintConflict.
func (NSConstraintConflictClass) Alloc ¶
func (nc NSConstraintConflictClass) Alloc() NSConstraintConflict
Alloc allocates memory for a new instance of the class.
func (NSConstraintConflictClass) Class ¶
func (nc NSConstraintConflictClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSCoreDataCoreSpotlightDelegate ¶
type NSCoreDataCoreSpotlightDelegate struct {
objectivec.Object
}
A set of methods that enable integration with Core Spotlight.
Overview ¶
Creating a Core Spotlight Delegate ¶
- NSCoreDataCoreSpotlightDelegate.InitForStoreWithDescriptionCoordinator: Creates a Core Spotlight delegate with the specified store description and coordinator.
Configuring the Index ¶
- NSCoreDataCoreSpotlightDelegate.IsIndexingEnabled: A Boolean value that indicates whether Core Data is currently updating the Core Spotlight index with the persistent store’s entities.
- NSCoreDataCoreSpotlightDelegate.DomainIdentifier: Returns the domain identifier.
- NSCoreDataCoreSpotlightDelegate.IndexName: Returns the index’s name.
Managing the Index ¶
- NSCoreDataCoreSpotlightDelegate.AttributeSetForObject: Returns the searchable attributes for the specified managed object.
- NSCoreDataCoreSpotlightDelegate.DeleteSpotlightIndexWithCompletionHandler: Deletes all searchable items from the configured index.
- NSCoreDataCoreSpotlightDelegate.StartSpotlightIndexing: Starts the indexing of the store’s entities.
- NSCoreDataCoreSpotlightDelegate.StopSpotlightIndexing: Stops the indexing of the store’s entities.
Updating the Index ¶
- NSCoreDataCoreSpotlightDelegate.SearchableIndexReindexAllSearchableItemsWithAcknowledgementHandler: Reindexes all searchable items and clears any local state.
- NSCoreDataCoreSpotlightDelegate.SearchableIndexReindexSearchableItemsWithIdentifiersAcknowledgementHandler: Reindexes the searchable items for the specified identifiers.
See: https://developer.apple.com/documentation/CoreData/NSCoreDataCoreSpotlightDelegate
func NSCoreDataCoreSpotlightDelegateFromID ¶
func NSCoreDataCoreSpotlightDelegateFromID(id objc.ID) NSCoreDataCoreSpotlightDelegate
NSCoreDataCoreSpotlightDelegateFromID constructs a NSCoreDataCoreSpotlightDelegate from an objc.ID.
A set of methods that enable integration with Core Spotlight.
func NewCoreDataCoreSpotlightDelegateForStoreWithDescriptionCoordinator ¶
func NewCoreDataCoreSpotlightDelegateForStoreWithDescriptionCoordinator(description INSPersistentStoreDescription, psc INSPersistentStoreCoordinator) NSCoreDataCoreSpotlightDelegate
Creates a Core Spotlight delegate with the specified store description and coordinator.
description: An object that describes the persistent store that contains the entities to index.
psc: The persistent store coordinator, which you initialize with the managed object model that contains the definitions of the entities to index.
Discussion ¶
After you initialize a Core Spotlight delegate, call the NSCoreDataCoreSpotlightDelegate.StartSpotlightIndexing to begin indexing your store’s contents.
func NewNSCoreDataCoreSpotlightDelegate ¶
func NewNSCoreDataCoreSpotlightDelegate() NSCoreDataCoreSpotlightDelegate
NewNSCoreDataCoreSpotlightDelegate creates a new NSCoreDataCoreSpotlightDelegate instance.
func (NSCoreDataCoreSpotlightDelegate) AttributeSetForObject ¶
func (c NSCoreDataCoreSpotlightDelegate) AttributeSetForObject(object INSManagedObject) corespotlight.CSSearchableItemAttributeSet
Returns the searchable attributes for the specified managed object.
object: The managed object to index.
Return Value ¶
An instance of CSSearchableItemAttributeSet that provides the searchable item’s attributes.
Discussion ¶
To prevent Core Spotlight from indexing a specific managed object, override this method and return `nil` for that object.
func (NSCoreDataCoreSpotlightDelegate) Autorelease ¶
func (c NSCoreDataCoreSpotlightDelegate) Autorelease() NSCoreDataCoreSpotlightDelegate
Autorelease adds the receiver to the current autorelease pool.
func (NSCoreDataCoreSpotlightDelegate) DeleteSpotlightIndex ¶
func (c NSCoreDataCoreSpotlightDelegate) DeleteSpotlightIndex(ctx context.Context) error
DeleteSpotlightIndex is a synchronous wrapper around NSCoreDataCoreSpotlightDelegate.DeleteSpotlightIndexWithCompletionHandler. It blocks until the completion handler fires or the context is cancelled.
func (NSCoreDataCoreSpotlightDelegate) DeleteSpotlightIndexWithCompletionHandler ¶
func (c NSCoreDataCoreSpotlightDelegate) DeleteSpotlightIndexWithCompletionHandler(completionHandler ErrorHandler)
Deletes all searchable items from the configured index.
Discussion ¶
The closure returns no value and takes only a single parameter, which is an error object that contains information about issues preventing the deletion of searchable items, or `nil` if Core Spotlight successfully deletes all searchable items.
Depending on the cause of the issue, an error can originate from Core Data or from Core Spotlight. Make sure your app can handle both scenarios.
func (NSCoreDataCoreSpotlightDelegate) DomainIdentifier ¶
func (c NSCoreDataCoreSpotlightDelegate) DomainIdentifier() string
Returns the domain identifier.
Discussion ¶
The default value is the persistent store’s identifier.
func (NSCoreDataCoreSpotlightDelegate) IndexName ¶
func (c NSCoreDataCoreSpotlightDelegate) IndexName() string
Returns the index’s name.
Discussion ¶
The default value is `nil`.
See: https://developer.apple.com/documentation/CoreData/NSCoreDataCoreSpotlightDelegate/indexName()
func (NSCoreDataCoreSpotlightDelegate) Init ¶
func (c NSCoreDataCoreSpotlightDelegate) Init() NSCoreDataCoreSpotlightDelegate
Init initializes the instance.
func (NSCoreDataCoreSpotlightDelegate) InitForStoreWithDescriptionCoordinator ¶
func (c NSCoreDataCoreSpotlightDelegate) InitForStoreWithDescriptionCoordinator(description INSPersistentStoreDescription, psc INSPersistentStoreCoordinator) NSCoreDataCoreSpotlightDelegate
Creates a Core Spotlight delegate with the specified store description and coordinator.
description: An object that describes the persistent store that contains the entities to index.
psc: The persistent store coordinator, which you initialize with the managed object model that contains the definitions of the entities to index.
Discussion ¶
After you initialize a Core Spotlight delegate, call the NSCoreDataCoreSpotlightDelegate.StartSpotlightIndexing to begin indexing your store’s contents.
func (NSCoreDataCoreSpotlightDelegate) IsIndexingEnabled ¶
func (c NSCoreDataCoreSpotlightDelegate) IsIndexingEnabled() bool
A Boolean value that indicates whether Core Data is currently updating the Core Spotlight index with the persistent store’s entities.
See: https://developer.apple.com/documentation/CoreData/NSCoreDataCoreSpotlightDelegate/isIndexingEnabled
func (NSCoreDataCoreSpotlightDelegate) SearchableIndexReindexAllSearchableItemsWithAcknowledgementHandler ¶
func (c NSCoreDataCoreSpotlightDelegate) SearchableIndexReindexAllSearchableItemsWithAcknowledgementHandler(searchableIndex *corespotlight.CSSearchableIndex, acknowledgementHandler VoidHandler)
Reindexes all searchable items and clears any local state.
searchableIndex: The index that requires reindexing.
acknowledgementHandler: The handler to call when you finish saving client state information.
Discussion ¶
For more information, see searchableIndex(_:reindexAllSearchableItemsWithAcknowledgementHandler:).
func (NSCoreDataCoreSpotlightDelegate) SearchableIndexReindexAllSearchableItemsWithAcknowledgementHandlerSync ¶
func (c NSCoreDataCoreSpotlightDelegate) SearchableIndexReindexAllSearchableItemsWithAcknowledgementHandlerSync(ctx context.Context, searchableIndex *corespotlight.CSSearchableIndex) error
SearchableIndexReindexAllSearchableItemsWithAcknowledgementHandlerSync is a synchronous wrapper around NSCoreDataCoreSpotlightDelegate.SearchableIndexReindexAllSearchableItemsWithAcknowledgementHandler. It blocks until the completion handler fires or the context is cancelled.
func (NSCoreDataCoreSpotlightDelegate) SearchableIndexReindexSearchableItemsWithIdentifiersAcknowledgementHandler ¶
func (c NSCoreDataCoreSpotlightDelegate) SearchableIndexReindexSearchableItemsWithIdentifiersAcknowledgementHandler(searchableIndex *corespotlight.CSSearchableIndex, identifiers []string, acknowledgementHandler VoidHandler)
Reindexes the searchable items for the specified identifiers.
searchableIndex: The index that contains the items that require reindexing.
identifiers: An array of strings that identify the searchable items.
acknowledgementHandler: The handler to call when you finish saving client state information.
Discussion ¶
For more information, see NSCoreDataCoreSpotlightDelegate.SearchableIndexReindexSearchableItemsWithIdentifiersAcknowledgementHandler.
func (NSCoreDataCoreSpotlightDelegate) StartSpotlightIndexing ¶
func (c NSCoreDataCoreSpotlightDelegate) StartSpotlightIndexing()
Starts the indexing of the store’s entities.
Discussion ¶
After you call this method, the delegate posts a notification whenever the index changes. The type of notification is indexDidUpdateNotification, and its `userInfo` dictionary contains the keys NSStoreUUIDKey and NSPersistentHistoryTokenKey.
func (NSCoreDataCoreSpotlightDelegate) StopSpotlightIndexing ¶
func (c NSCoreDataCoreSpotlightDelegate) StopSpotlightIndexing()
Stops the indexing of the store’s entities.
Discussion ¶
After you call this method, the delegate no longer posts notifications about index changes.
type NSCoreDataCoreSpotlightDelegateClass ¶
type NSCoreDataCoreSpotlightDelegateClass struct {
// contains filtered or unexported fields
}
func GetNSCoreDataCoreSpotlightDelegateClass ¶
func GetNSCoreDataCoreSpotlightDelegateClass() NSCoreDataCoreSpotlightDelegateClass
GetNSCoreDataCoreSpotlightDelegateClass returns the class object for NSCoreDataCoreSpotlightDelegate.
func (NSCoreDataCoreSpotlightDelegateClass) Alloc ¶
func (nc NSCoreDataCoreSpotlightDelegateClass) Alloc() NSCoreDataCoreSpotlightDelegate
Alloc allocates memory for a new instance of the class.
func (NSCoreDataCoreSpotlightDelegateClass) Class ¶
func (nc NSCoreDataCoreSpotlightDelegateClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSCustomMigrationStage ¶
type NSCustomMigrationStage struct {
NSMigrationStage
}
An object that enables you to participate in the migration between two versions of the same model.
Overview ¶
Use NSCustomMigrationStage when you have two versions of a model that Core Data can’t automatically migrate. Custom migration stages enable you to participate in the migration process by assigning handlers that the stage invokes before and after it runs. The handlers provide an opportunity to prepare the persistent store’s data for the upcoming changes before the stage runs, and perform any cleanup tasks afterward.
For example, to support a migration that changes an optional attribute to be nonoptional, you might assign a handler to the stage’s NSCustomMigrationStage.WillMigrateHandler property that sets any `nil` instances of that attribute to a default value, thereby ensuring the migration succeeds. To access the store you’re migrating, use the NSStagedMigrationManager.Container property of the migration manager that Core Data provides to every handler.
Accessing model references ¶
- NSCustomMigrationStage.CurrentModel: The reference that represents the migration’s source model.
- NSCustomMigrationStage.NextModel: The reference that represents the migration’s destination model.
Assigning event handlers ¶
- NSCustomMigrationStage.WillMigrateHandler: The handler to execute before the stage runs.
- NSCustomMigrationStage.SetWillMigrateHandler
- NSCustomMigrationStage.DidMigrateHandler: The handler to execute after the stage runs.
- NSCustomMigrationStage.SetDidMigrateHandler
See: https://developer.apple.com/documentation/CoreData/NSCustomMigrationStage
func NSCustomMigrationStageFromID ¶
func NSCustomMigrationStageFromID(id objc.ID) NSCustomMigrationStage
NSCustomMigrationStageFromID constructs a NSCustomMigrationStage from an objc.ID.
An object that enables you to participate in the migration between two versions of the same model.
func NewNSCustomMigrationStage ¶
func NewNSCustomMigrationStage() NSCustomMigrationStage
NewNSCustomMigrationStage creates a new NSCustomMigrationStage instance.
func (NSCustomMigrationStage) Autorelease ¶
func (c NSCustomMigrationStage) Autorelease() NSCustomMigrationStage
Autorelease adds the receiver to the current autorelease pool.
func (NSCustomMigrationStage) CurrentModel ¶
func (c NSCustomMigrationStage) CurrentModel() INSManagedObjectModelReference
The reference that represents the migration’s source model.
Discussion ¶
Core Data sets this property to the `currentModel` parameter you specify when creating the migration stage.
See: https://developer.apple.com/documentation/CoreData/NSCustomMigrationStage/currentModel
func (NSCustomMigrationStage) DidMigrateHandler ¶
func (c NSCustomMigrationStage) DidMigrateHandler() objectivec.IObject
The handler to execute after the stage runs.
See: https://developer.apple.com/documentation/coredata/nscustommigrationstage/didmigratehandler-2zbss
func (NSCustomMigrationStage) Init ¶
func (c NSCustomMigrationStage) Init() NSCustomMigrationStage
Init initializes the instance.
func (NSCustomMigrationStage) NextModel ¶
func (c NSCustomMigrationStage) NextModel() INSManagedObjectModelReference
The reference that represents the migration’s destination model.
Discussion ¶
Core Data sets this property to the `nextModel` parameter you specify when creating the migration stage.
See: https://developer.apple.com/documentation/CoreData/NSCustomMigrationStage/nextModel
func (NSCustomMigrationStage) SetDidMigrateHandler ¶
func (c NSCustomMigrationStage) SetDidMigrateHandler(value objectivec.IObject)
func (NSCustomMigrationStage) SetWillMigrateHandler ¶
func (c NSCustomMigrationStage) SetWillMigrateHandler(value objectivec.IObject)
func (NSCustomMigrationStage) WillMigrateHandler ¶
func (c NSCustomMigrationStage) WillMigrateHandler() objectivec.IObject
The handler to execute before the stage runs.
See: https://developer.apple.com/documentation/coredata/nscustommigrationstage/willmigratehandler-5wead
type NSCustomMigrationStageClass ¶
type NSCustomMigrationStageClass struct {
// contains filtered or unexported fields
}
func GetNSCustomMigrationStageClass ¶
func GetNSCustomMigrationStageClass() NSCustomMigrationStageClass
GetNSCustomMigrationStageClass returns the class object for NSCustomMigrationStage.
func (NSCustomMigrationStageClass) Alloc ¶
func (nc NSCustomMigrationStageClass) Alloc() NSCustomMigrationStage
Alloc allocates memory for a new instance of the class.
func (NSCustomMigrationStageClass) Class ¶
func (nc NSCustomMigrationStageClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSDeleteRule ¶
type NSDeleteRule uint
See: https://developer.apple.com/documentation/CoreData/NSDeleteRule
const ( // NSCascadeDeleteRule: A rule that deletes the referenced managed objects. NSCascadeDeleteRule NSDeleteRule = 2 // NSDenyDeleteRule: A rule that prevents the deletion of the owning managed object if the relationship has references to other objects. NSDenyDeleteRule NSDeleteRule = 3 // NSNoActionDeleteRule: A rule that prevents modification of the referenced managed objects. NSNoActionDeleteRule NSDeleteRule = 0 // NSNullifyDeleteRule: A rule that nullifies the inverse relationship of the referenced managed objects. NSNullifyDeleteRule NSDeleteRule = 1 )
func (NSDeleteRule) String ¶
func (e NSDeleteRule) String() string
type NSDerivedAttributeDescription ¶
type NSDerivedAttributeDescription struct {
NSAttributeDescription
}
A description of an attribute that derives its value by performing a calculation on a related attribute.
Overview ¶
Use derived attributes to optimize fetch performance; for example:
- Create a derived `searchName` attribute to reflect a `name` attribute with case and diacritics removed for more efficient comparison. - Create a derived `relationshipCount` attribute to reflect the number of objects in a relationship and avoid having to do a join.
Derived attributes support the following expressions:
[Table data omitted]
Specifying the Derivation Expression ¶
- NSDerivedAttributeDescription.DerivationExpression: An expression for generating derived data.
- NSDerivedAttributeDescription.SetDerivationExpression
See: https://developer.apple.com/documentation/CoreData/NSDerivedAttributeDescription
func NSDerivedAttributeDescriptionFromID ¶
func NSDerivedAttributeDescriptionFromID(id objc.ID) NSDerivedAttributeDescription
NSDerivedAttributeDescriptionFromID constructs a NSDerivedAttributeDescription from an objc.ID.
A description of an attribute that derives its value by performing a calculation on a related attribute.
func NewNSDerivedAttributeDescription ¶
func NewNSDerivedAttributeDescription() NSDerivedAttributeDescription
NewNSDerivedAttributeDescription creates a new NSDerivedAttributeDescription instance.
func (NSDerivedAttributeDescription) Autorelease ¶
func (d NSDerivedAttributeDescription) Autorelease() NSDerivedAttributeDescription
Autorelease adds the receiver to the current autorelease pool.
func (NSDerivedAttributeDescription) DerivationExpression ¶
func (d NSDerivedAttributeDescription) DerivationExpression() foundation.NSExpression
An expression for generating derived data.
Discussion ¶
When using derived attributes in an SQL store, this expression should be ¶
- a keypath expression (including @operation components)
a function expression using one of the predefined functions defined in NSExpression
Any keypaths used in the expression must be accessible from the entity on which the derived attribute is specified.
If you try to add a store to a coordinator whose model contains derived attributes of a type not supported by the store, the add fails and throws an error.
func (NSDerivedAttributeDescription) Init ¶
func (d NSDerivedAttributeDescription) Init() NSDerivedAttributeDescription
Init initializes the instance.
func (NSDerivedAttributeDescription) SetDerivationExpression ¶
func (d NSDerivedAttributeDescription) SetDerivationExpression(value foundation.NSExpression)
type NSDerivedAttributeDescriptionClass ¶
type NSDerivedAttributeDescriptionClass struct {
// contains filtered or unexported fields
}
func GetNSDerivedAttributeDescriptionClass ¶
func GetNSDerivedAttributeDescriptionClass() NSDerivedAttributeDescriptionClass
GetNSDerivedAttributeDescriptionClass returns the class object for NSDerivedAttributeDescription.
func (NSDerivedAttributeDescriptionClass) Alloc ¶
func (nc NSDerivedAttributeDescriptionClass) Alloc() NSDerivedAttributeDescription
Alloc allocates memory for a new instance of the class.
func (NSDerivedAttributeDescriptionClass) Class ¶
func (nc NSDerivedAttributeDescriptionClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSEntityDescription ¶
type NSEntityDescription struct {
objectivec.Object
}
A description of a Core Data entity.
Overview ¶
Entities are to managed objects what Class is to `id`, or — to use a database analogy — what tables are to rows. An instance specifies the entity’s name, its attributes and relationships (as instances of NSAttributeDescription and NSRelationshipDescription) and the class that represents it. Instances of that class correspond to entries in the associated persistent store. As a minimum, an entity description requires:
- A name. - The class name of the corresponding managed object.
If you don’t specify a class name, the framework uses NSManagedObject.
You define entities in a managed object model (an instance of NSManagedObjectModel) using Xcode’s data modeling tool. Core Data uses NSEntityDescription to map entries in the persistent store to managed objects in your app. It’s unlikely you’ll interact with entity descriptions directly unless you’re specifically working with models. NSEntityDescription provides a user dictionary for you to store any related, app-specific information.
Editing entity descriptions ¶
Entity descriptions are editable until an object graph manager uses them, which allows you to create or modify descriptions dynamically. However, once you associate the description’s managed object model with a persistent store coordinator, you can no longer modify it. The framework enforces this rule at runtime; any attempt to mutate the model, or any of its child objects, after you associate it with a persistent store coordinator results in an exception. If you need to modify a model that’s in use, create a copy of that model, modify it, and then discard the stale model.
If you want to create an entity hierarchy, consider the relevant API. You can only set an entity’s NSEntityDescription.Subentities, not an entity’s super-entity. To set an entity’s super-entity, set an array of subentities on the super entity that includes the desired entity; the entity hierarchy is built top-down.
Using entity descriptions in dictionaries ¶
The `copy` method of NSEntityDescription returns an entity such that:
Since NSDictionary copies its keys and requires that keys both conform to the NSCopying protocol and have a property that `copy` returns an object for where the source and the copy are equal, don’t use entities as keys in a dictionary. Instead, use either the entity’s name as the key or use an NSMapTable with retain callbacks.
Fast enumeration ¶
NSEntityDescription implements the NSFastEnumeration protocol. Use this to enumerate over an entity’s properties, as the following example illustrates.
Getting descriptive information ¶
- NSEntityDescription.Name: The entity name of the receiver.
- NSEntityDescription.SetName
- NSEntityDescription.ManagedObjectModel: The managed object model with which the receiver is associated.
- NSEntityDescription.ManagedObjectClassName: The name of the class that represents the receiver’s entity.
- NSEntityDescription.SetManagedObjectClassName
- NSEntityDescription.RenamingIdentifier: The renaming identifier for the receiver.
- NSEntityDescription.SetRenamingIdentifier
- NSEntityDescription.IsAbstract: A Boolean value that indicates whether the receiver represents an abstract entity.
- NSEntityDescription.SetAbstract
- NSEntityDescription.UserInfo: The user info dictionary of the receiver.
- NSEntityDescription.SetUserInfo
- NSEntityDescription.CoreSpotlightDisplayNameExpression: The expression that computes the CoreSpotlight display name for instances of the entity.
- NSEntityDescription.SetCoreSpotlightDisplayNameExpression
Managing inheritance ¶
- NSEntityDescription.SubentitiesByName: A dictionary containing the receiver’s sub-entities.
- NSEntityDescription.Subentities: An array containing the sub-entities of the receiver.
- NSEntityDescription.SetSubentities
- NSEntityDescription.Superentity: The super-entity of the receiver.
- NSEntityDescription.IsKindOfEntity: Returns a Boolean value that indicates whether the receiver is a sub-entity of another given entity.
Working with properties ¶
- NSEntityDescription.PropertiesByName: A dictionary containing the properties of the receiver.
- NSEntityDescription.Properties: An array containing the properties of the receiver.
- NSEntityDescription.SetProperties
- NSEntityDescription.AttributesByName: The attributes of the receiver in a dictionary.
- NSEntityDescription.RelationshipsByName: The relationships of the receiver in a dictionary.
- NSEntityDescription.RelationshipsWithDestinationEntity: Returns an array containing the relationships of the receiver where the entity description of the relationship is a given entity.
Configuring indexes and constraints ¶
- NSEntityDescription.Indexes: An array of fetch index descriptions for the entity.
- NSEntityDescription.SetIndexes
- NSEntityDescription.UniquenessConstraints: An array of arrays that contains one or more attributes with a value that must be unique over the instances of that entity.
- NSEntityDescription.SetUniquenessConstraints
Managing versioning ¶
- NSEntityDescription.VersionHash: The version hash for the receiver.
- NSEntityDescription.VersionHashModifier: The version hash modifier for the receiver.
- NSEntityDescription.SetVersionHashModifier
See: https://developer.apple.com/documentation/CoreData/NSEntityDescription
func NSEntityDescriptionFromID ¶
func NSEntityDescriptionFromID(id objc.ID) NSEntityDescription
NSEntityDescriptionFromID constructs a NSEntityDescription from an objc.ID.
A description of a Core Data entity.
func NewNSEntityDescription ¶
func NewNSEntityDescription() NSEntityDescription
NewNSEntityDescription creates a new NSEntityDescription instance.
func (NSEntityDescription) AttributesByName ¶
func (e NSEntityDescription) AttributesByName() foundation.INSDictionary
The attributes of the receiver in a dictionary.
Discussion ¶
The keys in the dictionary are the attribute names and the values are instances of NSAttributeDescription. .
See: https://developer.apple.com/documentation/CoreData/NSEntityDescription/attributesByName
func (NSEntityDescription) Autorelease ¶
func (e NSEntityDescription) Autorelease() NSEntityDescription
Autorelease adds the receiver to the current autorelease pool.
func (NSEntityDescription) CoreSpotlightDisplayNameExpression ¶
func (e NSEntityDescription) CoreSpotlightDisplayNameExpression() foundation.NSExpression
The expression that computes the CoreSpotlight display name for instances of the entity.
func (NSEntityDescription) EncodeWithCoder ¶
func (e NSEntityDescription) EncodeWithCoder(coder foundation.INSCoder)
func (NSEntityDescription) Indexes ¶
func (e NSEntityDescription) Indexes() []NSFetchIndexDescription
An array of fetch index descriptions for the entity.
Discussion ¶
This value doesn’t form part of the entity’s version hash, and stores that don’t natively support indexing may ignore it.
See: https://developer.apple.com/documentation/CoreData/NSEntityDescription/indexes
func (NSEntityDescription) Init ¶
func (e NSEntityDescription) Init() NSEntityDescription
Init initializes the instance.
func (NSEntityDescription) IsAbstract ¶
func (e NSEntityDescription) IsAbstract() bool
A Boolean value that indicates whether the receiver represents an abstract entity.
Return Value ¶
true if the receiver represents an abstract entity, otherwise false.
Discussion ¶
true if the receiver represents an abstract entity, otherwise false. An abstract entity might be Shape, with concrete sub-entities such as Rectangle, Triangle, and Circle.
Special Considerations ¶
Setting whether an entity is abstract raises an exception if the receiver’s model has been used by an object graph manager.
See: https://developer.apple.com/documentation/CoreData/NSEntityDescription/isAbstract
func (NSEntityDescription) IsKindOfEntity ¶
func (e NSEntityDescription) IsKindOfEntity(entity INSEntityDescription) bool
Returns a Boolean value that indicates whether the receiver is a sub-entity of another given entity.
entity: An entity.
Return Value ¶
true if the receiver is a sub-entity of `entity`, otherwise false.
See: https://developer.apple.com/documentation/CoreData/NSEntityDescription/isKindOf(entity:)
func (NSEntityDescription) ManagedObjectClassName ¶
func (e NSEntityDescription) ManagedObjectClassName() string
The name of the class that represents the receiver’s entity.
Discussion ¶
The class specified by `name` must NSManagedObject or a subclass of NSManagedObject.
Special Considerations ¶
Setting the class name raises an exception if the receiver’s model has been used by an object graph manager.
See: https://developer.apple.com/documentation/CoreData/NSEntityDescription/managedObjectClassName
func (NSEntityDescription) ManagedObjectModel ¶
func (e NSEntityDescription) ManagedObjectModel() INSManagedObjectModel
The managed object model with which the receiver is associated.
See: https://developer.apple.com/documentation/CoreData/NSEntityDescription/managedObjectModel
func (NSEntityDescription) Name ¶
func (e NSEntityDescription) Name() string
The entity name of the receiver.
Discussion ¶
Setting the name raises an exception if the receiver’s model has been used by an object graph manager.
See: https://developer.apple.com/documentation/CoreData/NSEntityDescription/name
func (NSEntityDescription) Properties ¶
func (e NSEntityDescription) Properties() []NSPropertyDescription
An array containing the properties of the receiver.
Discussion ¶
The elements in the array are instances of NSAttributeDescription, NSRelationshipDescription, and/or NSFetchedPropertyDescription.
Special Considerations ¶
Setting the properties raises an exception if the receiver’s model has been used by an object graph manager.
See: https://developer.apple.com/documentation/CoreData/NSEntityDescription/properties
func (NSEntityDescription) PropertiesByName ¶
func (e NSEntityDescription) PropertiesByName() foundation.INSDictionary
A dictionary containing the properties of the receiver.
Discussion ¶
The keys in the dictionary are the property names and the values are instances of NSAttributeDescription and/or NSRelationshipDescription.
See: https://developer.apple.com/documentation/CoreData/NSEntityDescription/propertiesByName
func (NSEntityDescription) RelationshipsByName ¶
func (e NSEntityDescription) RelationshipsByName() foundation.INSDictionary
The relationships of the receiver in a dictionary.
Discussion ¶
The keys in the dictionary are the relationship names and the values are instances of NSRelationshipDescription.
See: https://developer.apple.com/documentation/CoreData/NSEntityDescription/relationshipsByName
func (NSEntityDescription) RelationshipsWithDestinationEntity ¶
func (e NSEntityDescription) RelationshipsWithDestinationEntity(entity INSEntityDescription) []NSRelationshipDescription
Returns an array containing the relationships of the receiver where the entity description of the relationship is a given entity.
entity: An entity description.
Return Value ¶
An array containing the relationships of the receiver where the entity description of the relationship is `entity`. Elements in the array are instances of NSRelationshipDescription.
func (NSEntityDescription) RenamingIdentifier ¶
func (e NSEntityDescription) RenamingIdentifier() string
The renaming identifier for the receiver.
Discussion ¶
The renaming identifier is used to resolve naming conflicts between models. When creating a mapping model between two managed object models, a source entity and a destination entity that share the same identifier indicate that an entity mapping should be configured to migrate from the source to the destination.
If you do not set this value, the identifier will return the entity’s name.
See: https://developer.apple.com/documentation/CoreData/NSEntityDescription/renamingIdentifier
func (NSEntityDescription) SetAbstract ¶
func (e NSEntityDescription) SetAbstract(value bool)
func (NSEntityDescription) SetCoreSpotlightDisplayNameExpression ¶
func (e NSEntityDescription) SetCoreSpotlightDisplayNameExpression(value foundation.NSExpression)
func (NSEntityDescription) SetIndexes ¶
func (e NSEntityDescription) SetIndexes(value []NSFetchIndexDescription)
func (NSEntityDescription) SetManagedObjectClassName ¶
func (e NSEntityDescription) SetManagedObjectClassName(value string)
func (NSEntityDescription) SetName ¶
func (e NSEntityDescription) SetName(value string)
func (NSEntityDescription) SetProperties ¶
func (e NSEntityDescription) SetProperties(value []NSPropertyDescription)
func (NSEntityDescription) SetRenamingIdentifier ¶
func (e NSEntityDescription) SetRenamingIdentifier(value string)
func (NSEntityDescription) SetSubentities ¶
func (e NSEntityDescription) SetSubentities(value []NSEntityDescription)
func (NSEntityDescription) SetUniquenessConstraints ¶
func (e NSEntityDescription) SetUniquenessConstraints(value []foundation.NSArray)
func (NSEntityDescription) SetUserInfo ¶
func (e NSEntityDescription) SetUserInfo(value foundation.INSDictionary)
func (NSEntityDescription) SetVersionHashModifier ¶
func (e NSEntityDescription) SetVersionHashModifier(value string)
func (NSEntityDescription) Subentities ¶
func (e NSEntityDescription) Subentities() []NSEntityDescription
An array containing the sub-entities of the receiver.
Discussion ¶
The sub-entities are instances of NSEntityDescription.
Special Considerations ¶
Setting the sub-entities raises an exception if the receiver’s model has been used by an object graph manager.
See: https://developer.apple.com/documentation/CoreData/NSEntityDescription/subentities
func (NSEntityDescription) SubentitiesByName ¶
func (e NSEntityDescription) SubentitiesByName() foundation.INSDictionary
A dictionary containing the receiver’s sub-entities.
Return Value ¶
The keys in the dictionary are the sub-entity names, the corresponding values are instances of NSEntityDescription.
See: https://developer.apple.com/documentation/CoreData/NSEntityDescription/subentitiesByName
func (NSEntityDescription) Superentity ¶
func (e NSEntityDescription) Superentity() INSEntityDescription
The super-entity of the receiver.
Discussion ¶
If the receiver has no super-entity, returns `nil`.
See: https://developer.apple.com/documentation/CoreData/NSEntityDescription/superentity
func (NSEntityDescription) UniquenessConstraints ¶
func (e NSEntityDescription) UniquenessConstraints() []foundation.NSArray
An array of arrays that contains one or more attributes with a value that must be unique over the instances of that entity.
Discussion ¶
Each inner array contains one or more NSAttributeDescription objects or strings that contain the names of attributes on the entity.
This value forms part of the entity’s version hash. Stores that don’t support uniqueness constraints must refuse to initialize when receiving a model that contains such constraints.
See: https://developer.apple.com/documentation/CoreData/NSEntityDescription/uniquenessConstraints
func (NSEntityDescription) UserInfo ¶
func (e NSEntityDescription) UserInfo() foundation.INSDictionary
The user info dictionary of the receiver.
Discussion ¶
Setting the user info dictionary raises an exception if the receiver’s model has been used by an object graph manager.
See: https://developer.apple.com/documentation/CoreData/NSEntityDescription/userInfo
func (NSEntityDescription) VersionHash ¶
func (e NSEntityDescription) VersionHash() foundation.NSData
The version hash for the receiver.
Discussion ¶
The version hash is used to uniquely identify an entity based on the collection and configuration of properties for the entity. The version hash uses only values which affect the persistence of data and the user-defined NSEntityDescription.VersionHashModifier value. (The values which affect persistence are: the name of the entity, the version hash of the superentity (if present), if the entity is abstract, and all of the version hashes for the properties.) This value is stored as part of the version information in the metadata for stores which use this entity, as well as a definition of an entity involved in an NSEntityMapping object.
See: https://developer.apple.com/documentation/CoreData/NSEntityDescription/versionHash
func (NSEntityDescription) VersionHashModifier ¶
func (e NSEntityDescription) VersionHashModifier() string
The version hash modifier for the receiver.
Discussion ¶
This value is included in the version hash for the entity. You use it to mark or denote an entity as being a different “version” than another even if all of the values which affect persistence are equal. (Such a difference is important in cases where, for example, the structure of an entity is unchanged but the format or content of data has changed.)
See: https://developer.apple.com/documentation/CoreData/NSEntityDescription/versionHashModifier
type NSEntityDescriptionClass ¶
type NSEntityDescriptionClass struct {
// contains filtered or unexported fields
}
func GetNSEntityDescriptionClass ¶
func GetNSEntityDescriptionClass() NSEntityDescriptionClass
GetNSEntityDescriptionClass returns the class object for NSEntityDescription.
func (NSEntityDescriptionClass) Alloc ¶
func (nc NSEntityDescriptionClass) Alloc() NSEntityDescription
Alloc allocates memory for a new instance of the class.
func (NSEntityDescriptionClass) Class ¶
func (nc NSEntityDescriptionClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (NSEntityDescriptionClass) EntityForNameInManagedObjectContext ¶
func (_NSEntityDescriptionClass NSEntityDescriptionClass) EntityForNameInManagedObjectContext(entityName string, context INSManagedObjectContext) NSEntityDescription
Returns the entity with the specified name from the managed object model associated with the specified managed object context’s persistent store coordinator.
entityName: The name of an entity.
context: The managed object context to use. Must not be `nil`.
Return Value ¶
The entity with the specified name from the managed object model associated with `context`’s persistent store coordinator.
Discussion ¶
Raises internalInconsistencyException if `context` is `nil`.
This method is functionally equivalent to the following code example.
See: https://developer.apple.com/documentation/CoreData/NSEntityDescription/entity(forEntityName:in:)
func (NSEntityDescriptionClass) InsertNewObjectForEntityForNameInManagedObjectContext ¶
func (_NSEntityDescriptionClass NSEntityDescriptionClass) InsertNewObjectForEntityForNameInManagedObjectContext(entityName string, context INSManagedObjectContext) NSManagedObject
Creates, configures, and returns an instance of the class for the entity with a given name.
entityName: The name of an entity.
context: The managed object context to use.
Return Value ¶
A new, autoreleased, fully configured instance of the class for the entity named `entityName`. The instance has its entity description set and is inserted it into `context`.
Discussion ¶
This method makes it easy for you to create instances of a given entity without worrying about the details of managed object creation. The method is conceptually similar to the following code example.
type NSEntityMapping ¶
type NSEntityMapping struct {
objectivec.Object
}
A mapping instance that specifies how to map an entity from a source to a destination managed object model.
Managing Source Information ¶
- NSEntityMapping.SourceEntityName: The source entity name for the entity mapping.
- NSEntityMapping.SetSourceEntityName
- NSEntityMapping.SourceEntityVersionHash: The version hash of the source entity for the entity mapping.
- NSEntityMapping.SetSourceEntityVersionHash
- NSEntityMapping.SourceExpression: The source expression for the entity mapping.
- NSEntityMapping.SetSourceExpression
Managing Destination Information ¶
- NSEntityMapping.DestinationEntityName: The destination entity name for the entity mapping.
- NSEntityMapping.SetDestinationEntityName
- NSEntityMapping.DestinationEntityVersionHash: The version hash for the destination entity for the entity mapping.
- NSEntityMapping.SetDestinationEntityVersionHash
Managing Mapping Information ¶
- NSEntityMapping.Name: The name of the entity mapping.
- NSEntityMapping.SetName
- NSEntityMapping.MappingType: The mapping type for the entity mapping.
- NSEntityMapping.SetMappingType
- NSEntityMapping.EntityMigrationPolicyClassName: The class name of the migration policy for the entity mapping.
- NSEntityMapping.SetEntityMigrationPolicyClassName
- NSEntityMapping.AttributeMappings: The array of attribute mappings for the entity mapping.
- NSEntityMapping.SetAttributeMappings
- NSEntityMapping.RelationshipMappings: The array of relationship mappings for the entity mapping.
- NSEntityMapping.SetRelationshipMappings
- NSEntityMapping.UserInfo: The user info dictionary for the entity mapping.
- NSEntityMapping.SetUserInfo
See: https://developer.apple.com/documentation/CoreData/NSEntityMapping
func NSEntityMappingFromID ¶
func NSEntityMappingFromID(id objc.ID) NSEntityMapping
NSEntityMappingFromID constructs a NSEntityMapping from an objc.ID.
A mapping instance that specifies how to map an entity from a source to a destination managed object model.
func NewNSEntityMapping ¶
func NewNSEntityMapping() NSEntityMapping
NewNSEntityMapping creates a new NSEntityMapping instance.
func (NSEntityMapping) AttributeMappings ¶
func (e NSEntityMapping) AttributeMappings() []NSPropertyMapping
The array of attribute mappings for the entity mapping.
Discussion ¶
The order of mappings in the array specifies the order in which the mappings will be processed during a migration.
See: https://developer.apple.com/documentation/CoreData/NSEntityMapping/attributeMappings
func (NSEntityMapping) Autorelease ¶
func (e NSEntityMapping) Autorelease() NSEntityMapping
Autorelease adds the receiver to the current autorelease pool.
func (NSEntityMapping) DestinationEntityName ¶
func (e NSEntityMapping) DestinationEntityName() string
The destination entity name for the entity mapping.
Discussion ¶
Mappings are not directly bound to entity descriptions. You can use the migration manager’s NSMigrationManager.DestinationEntityForEntityMapping method to retrieve the entity description for this entity name.
See: https://developer.apple.com/documentation/CoreData/NSEntityMapping/destinationEntityName
func (NSEntityMapping) DestinationEntityVersionHash ¶
func (e NSEntityMapping) DestinationEntityVersionHash() foundation.NSData
The version hash for the destination entity for the entity mapping.
Discussion ¶
The version hash is calculated by Core Data based on the property values of the entity (see NSEntityDescription’s NSEntityDescription.VersionHash method). The `destinationEntityVersionHash` must equal the version hash of the destination entity represented by the mapping.
See: https://developer.apple.com/documentation/CoreData/NSEntityMapping/destinationEntityVersionHash
func (NSEntityMapping) EntityMigrationPolicyClassName ¶
func (e NSEntityMapping) EntityMigrationPolicyClassName() string
The class name of the migration policy for the entity mapping.
Discussion ¶
If not specified, the default migration class name is NSEntityMigrationPolicy. You can specify a subclass to provide custom behavior.
See: https://developer.apple.com/documentation/CoreData/NSEntityMapping/entityMigrationPolicyClassName
func (NSEntityMapping) Init ¶
func (e NSEntityMapping) Init() NSEntityMapping
Init initializes the instance.
func (NSEntityMapping) MappingType ¶
func (e NSEntityMapping) MappingType() NSEntityMappingType
The mapping type for the entity mapping.
Discussion ¶
If you specify a custom entity mapping type, you must specify a value for the migration policy class name as well (see NSEntityMapping.EntityMigrationPolicyClassName).
See: https://developer.apple.com/documentation/CoreData/NSEntityMapping/mappingType
func (NSEntityMapping) Name ¶
func (e NSEntityMapping) Name() string
The name of the entity mapping.
Discussion ¶
The name is used only as a means of distinguishing mappings in a model. If not specified, the value defaults to SOURCE->DESTINATION.
See: https://developer.apple.com/documentation/CoreData/NSEntityMapping/name
func (NSEntityMapping) RelationshipMappings ¶
func (e NSEntityMapping) RelationshipMappings() []NSPropertyMapping
The array of relationship mappings for the entity mapping.
Discussion ¶
The order of mappings in the array specifies the order in which the mappings will be processed during a migration.
See: https://developer.apple.com/documentation/CoreData/NSEntityMapping/relationshipMappings
func (NSEntityMapping) SetAttributeMappings ¶
func (e NSEntityMapping) SetAttributeMappings(value []NSPropertyMapping)
func (NSEntityMapping) SetDestinationEntityName ¶
func (e NSEntityMapping) SetDestinationEntityName(value string)
func (NSEntityMapping) SetDestinationEntityVersionHash ¶
func (e NSEntityMapping) SetDestinationEntityVersionHash(value foundation.NSData)
func (NSEntityMapping) SetEntityMigrationPolicyClassName ¶
func (e NSEntityMapping) SetEntityMigrationPolicyClassName(value string)
func (NSEntityMapping) SetMappingType ¶
func (e NSEntityMapping) SetMappingType(value NSEntityMappingType)
func (NSEntityMapping) SetName ¶
func (e NSEntityMapping) SetName(value string)
func (NSEntityMapping) SetRelationshipMappings ¶
func (e NSEntityMapping) SetRelationshipMappings(value []NSPropertyMapping)
func (NSEntityMapping) SetSourceEntityName ¶
func (e NSEntityMapping) SetSourceEntityName(value string)
func (NSEntityMapping) SetSourceEntityVersionHash ¶
func (e NSEntityMapping) SetSourceEntityVersionHash(value foundation.NSData)
func (NSEntityMapping) SetSourceExpression ¶
func (e NSEntityMapping) SetSourceExpression(value foundation.NSExpression)
func (NSEntityMapping) SetUserInfo ¶
func (e NSEntityMapping) SetUserInfo(value foundation.INSDictionary)
func (NSEntityMapping) SourceEntityName ¶
func (e NSEntityMapping) SourceEntityName() string
The source entity name for the entity mapping.
Discussion ¶
Mappings are not directly bound to entity descriptions; you can use the NSMigrationManager.SourceEntityForEntityMapping method on the migration manager to retrieve the entity description for this entity name.
See: https://developer.apple.com/documentation/CoreData/NSEntityMapping/sourceEntityName
func (NSEntityMapping) SourceEntityVersionHash ¶
func (e NSEntityMapping) SourceEntityVersionHash() foundation.NSData
The version hash of the source entity for the entity mapping.
Discussion ¶
The version hash is calculated by Core Data based on the property values of the entity (see NSEntityDescription’s NSEntityDescription.VersionHash method). The `sourceEntityVersionHash` must equal the version hash of the source entity represented by the mapping.
See: https://developer.apple.com/documentation/CoreData/NSEntityMapping/sourceEntityVersionHash
func (NSEntityMapping) SourceExpression ¶
func (e NSEntityMapping) SourceExpression() foundation.NSExpression
The source expression for the entity mapping.
Discussion ¶
The source expression is used to obtain the collection of managed objects to process through the mapping. The expression can be a fetch request expression, or any other expression that evaluates to a collection.
See: https://developer.apple.com/documentation/CoreData/NSEntityMapping/sourceExpression
func (NSEntityMapping) UserInfo ¶
func (e NSEntityMapping) UserInfo() foundation.INSDictionary
The user info dictionary for the entity mapping.
Discussion ¶
You can use the info dictionary in any way that might be useful in your migration. You can set the contents of the dictionary directory or using the appropriate inspector in the Xcode mapping model editor.
See: https://developer.apple.com/documentation/CoreData/NSEntityMapping/userInfo
type NSEntityMappingClass ¶
type NSEntityMappingClass struct {
// contains filtered or unexported fields
}
func GetNSEntityMappingClass ¶
func GetNSEntityMappingClass() NSEntityMappingClass
GetNSEntityMappingClass returns the class object for NSEntityMapping.
func (NSEntityMappingClass) Alloc ¶
func (nc NSEntityMappingClass) Alloc() NSEntityMapping
Alloc allocates memory for a new instance of the class.
func (NSEntityMappingClass) Class ¶
func (nc NSEntityMappingClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSEntityMappingType ¶
type NSEntityMappingType uint
See: https://developer.apple.com/documentation/CoreData/NSEntityMappingType
const ( // NSAddEntityMappingType: Specifies that this is a new entity in the destination model. NSAddEntityMappingType NSEntityMappingType = 0x2 // NSCopyEntityMappingType: Specifies that source instances are migrated as-is. NSCopyEntityMappingType NSEntityMappingType = 0x4 // NSCustomEntityMappingType: Specifies a custom mapping. NSCustomEntityMappingType NSEntityMappingType = 0x1 // NSRemoveEntityMappingType: Specifies that this entity is not present in the destination model. NSRemoveEntityMappingType NSEntityMappingType = 0x3 // NSTransformEntityMappingType: Specifies that entity exists in source and destination and is mapped. NSTransformEntityMappingType NSEntityMappingType = 0x5 // NSUndefinedEntityMappingType: Specifies that the developer handles destination instance creation. NSUndefinedEntityMappingType NSEntityMappingType = 0 )
func (NSEntityMappingType) String ¶
func (e NSEntityMappingType) String() string
type NSEntityMigrationPolicy ¶
type NSEntityMigrationPolicy struct {
objectivec.Object
}
A policy instance that customizes the migration process for an entity mapping.
Overview ¶
You set the policy for an entity mapping by passing the name of the migration policy class as the argument to NSEntityMapping.EntityMigrationPolicyClassName. Typically, you specify the name in the Xcode mapping model editor.
Customizing Stages of the Mapping Life Cycle ¶
- NSEntityMigrationPolicy.BeginEntityMappingManagerError: Sets up state information before the start of a given entity mapping.
- NSEntityMigrationPolicy.CreateDestinationInstancesForSourceInstanceEntityMappingManagerError: Creates the destination instance(s) for a given source instance.
- NSEntityMigrationPolicy.EndInstanceCreationForEntityMappingManagerError: Indicates the end of the instance creation stage for the specified entity mapping, and the precursor to the next migration stage.
- NSEntityMigrationPolicy.CreateRelationshipsForDestinationInstanceEntityMappingManagerError: Constructs the relationships between the newly-created destination instances.
- NSEntityMigrationPolicy.EndRelationshipCreationForEntityMappingManagerError: Indicates the end of the relationship creation stage for the specified entity mapping.
- NSEntityMigrationPolicy.PerformCustomValidationForEntityMappingManagerError: Provides the option to perform custom validation on migrated objects during the validation stage of the entity migration policy.
- NSEntityMigrationPolicy.EndEntityMappingManagerError: Performs cleanup at the end of the migration, from any phase of the mapping.
See: https://developer.apple.com/documentation/CoreData/NSEntityMigrationPolicy
func NSEntityMigrationPolicyFromID ¶
func NSEntityMigrationPolicyFromID(id objc.ID) NSEntityMigrationPolicy
NSEntityMigrationPolicyFromID constructs a NSEntityMigrationPolicy from an objc.ID.
A policy instance that customizes the migration process for an entity mapping.
func NewNSEntityMigrationPolicy ¶
func NewNSEntityMigrationPolicy() NSEntityMigrationPolicy
NewNSEntityMigrationPolicy creates a new NSEntityMigrationPolicy instance.
func (NSEntityMigrationPolicy) Autorelease ¶
func (e NSEntityMigrationPolicy) Autorelease() NSEntityMigrationPolicy
Autorelease adds the receiver to the current autorelease pool.
func (NSEntityMigrationPolicy) BeginEntityMappingManagerError ¶
func (e NSEntityMigrationPolicy) BeginEntityMappingManagerError(mapping INSEntityMapping, manager INSMigrationManager) (bool, error)
Sets up state information before the start of a given entity mapping.
mapping: The mapping object in use.
manager: The migration manager performing the migration.
Discussion ¶
This method is the precursor to the creation stage. In a custom class, you can implement this method to set up any state information that will be useful for the duration of the migration.
See: https://developer.apple.com/documentation/CoreData/NSEntityMigrationPolicy/begin(_:with:)
func (NSEntityMigrationPolicy) CreateDestinationInstancesForSourceInstanceEntityMappingManagerError ¶
func (e NSEntityMigrationPolicy) CreateDestinationInstancesForSourceInstanceEntityMappingManagerError(sInstance INSManagedObject, mapping INSEntityMapping, manager INSMigrationManager) (bool, error)
Creates the destination instance(s) for a given source instance.
sInstance: The source instance for which to create destination instances.
mapping: The mapping object in use.
manager: The migration manager performing the migration.
Discussion ¶
This method is invoked by the migration manager on each source instance (as specified by the NSEntityMapping.SourceExpression in the mapping) to create the corresponding destination instance(s). It also associates the source and destination instances by calling NSMigrationManager’s NSMigrationManager.AssociateSourceInstanceWithDestinationInstanceForEntityMapping method.
Special Considerations ¶
If you override this method and do not invoke `super`, you must invoke NSMigrationManager’s NSMigrationManager.AssociateSourceInstanceWithDestinationInstanceForEntityMapping to associate the source and destination instances as required. .
func (NSEntityMigrationPolicy) CreateRelationshipsForDestinationInstanceEntityMappingManagerError ¶
func (e NSEntityMigrationPolicy) CreateRelationshipsForDestinationInstanceEntityMappingManagerError(dInstance INSManagedObject, mapping INSEntityMapping, manager INSMigrationManager) (bool, error)
Constructs the relationships between the newly-created destination instances.
dInstance: The destination instance for which to create relationships.
mapping: The mapping object in use.
manager: The migration manager performing the migration.
Discussion ¶
You can use this stage to (re)create relationships between migrated objects—you use the association lookup methods on the NSMigrationManager instance to determine the appropriate relationship targets.
func (NSEntityMigrationPolicy) EndEntityMappingManagerError ¶
func (e NSEntityMigrationPolicy) EndEntityMappingManagerError(mapping INSEntityMapping, manager INSMigrationManager) (bool, error)
Performs cleanup at the end of the migration, from any phase of the mapping.
mapping: The mapping object in use.
manager: The migration manager performing the migration.
Discussion ¶
This is the end to the given entity mapping. You can implement this method to perform any clean-up at the end of the migration (from any of the three phases of the mapping).
See: https://developer.apple.com/documentation/CoreData/NSEntityMigrationPolicy/end(_:manager:)
func (NSEntityMigrationPolicy) EndInstanceCreationForEntityMappingManagerError ¶
func (e NSEntityMigrationPolicy) EndInstanceCreationForEntityMappingManagerError(mapping INSEntityMapping, manager INSMigrationManager) (bool, error)
Indicates the end of the instance creation stage for the specified entity mapping, and the precursor to the next migration stage.
mapping: The mapping object in use.
manager: The migration manager performing the migration.
Discussion ¶
You can override this method to clean up state from the creation of destination or to prepare state for the creation of relationships.
func (NSEntityMigrationPolicy) EndRelationshipCreationForEntityMappingManagerError ¶
func (e NSEntityMigrationPolicy) EndRelationshipCreationForEntityMappingManagerError(mapping INSEntityMapping, manager INSMigrationManager) (bool, error)
Indicates the end of the relationship creation stage for the specified entity mapping.
mapping: The mapping object in use.
manager: The migration manager performing the migration.
Discussion ¶
This method is invoked after NSEntityMigrationPolicy.CreateRelationshipsForDestinationInstanceEntityMappingManagerError; you can override it to clean up state from the creation of relationships, or prepare state for custom validation in NSEntityMigrationPolicy.PerformCustomValidationForEntityMappingManagerError.
func (NSEntityMigrationPolicy) Init ¶
func (e NSEntityMigrationPolicy) Init() NSEntityMigrationPolicy
Init initializes the instance.
func (NSEntityMigrationPolicy) PerformCustomValidationForEntityMappingManagerError ¶
func (e NSEntityMigrationPolicy) PerformCustomValidationForEntityMappingManagerError(mapping INSEntityMapping, manager INSMigrationManager) (bool, error)
Provides the option to perform custom validation on migrated objects during the validation stage of the entity migration policy.
mapping: The mapping object in use.
manager: The migration manager performing the migration.
Discussion ¶
This method is called before the default save validation is performed by the framework.
If you implement this method, you must manually obtain the collection of objects you are interested in validating.
type NSEntityMigrationPolicyClass ¶
type NSEntityMigrationPolicyClass struct {
// contains filtered or unexported fields
}
func GetNSEntityMigrationPolicyClass ¶
func GetNSEntityMigrationPolicyClass() NSEntityMigrationPolicyClass
GetNSEntityMigrationPolicyClass returns the class object for NSEntityMigrationPolicy.
func (NSEntityMigrationPolicyClass) Alloc ¶
func (nc NSEntityMigrationPolicyClass) Alloc() NSEntityMigrationPolicy
Alloc allocates memory for a new instance of the class.
func (NSEntityMigrationPolicyClass) Class ¶
func (nc NSEntityMigrationPolicyClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSExpression ¶
type NSExpression = _undefined
type NSExpressionDescription ¶
type NSExpressionDescription struct {
NSPropertyDescription
}
An object that describes an expression to include with a fetch request.
Overview ¶
An expression description describes a value that a fetch request returns, which doesn’t appear as an attribute or relationship on an entity. For example, expressions can aggregate data, or transform an attribute’s value. You add expression descriptions to a fetch request using the NSFetchRequest.PropertiesToFetch method.
Configuring the Expression Description ¶
- NSExpressionDescription.Expression: The expression to evaluate.
- NSExpressionDescription.SetExpression
- NSExpressionDescription.ExpressionResultType: The attribute type of the expression’s result.
- NSExpressionDescription.SetExpressionResultType
See: https://developer.apple.com/documentation/CoreData/NSExpressionDescription
func NSExpressionDescriptionFromID ¶
func NSExpressionDescriptionFromID(id objc.ID) NSExpressionDescription
NSExpressionDescriptionFromID constructs a NSExpressionDescription from an objc.ID.
An object that describes an expression to include with a fetch request.
func NewNSExpressionDescription ¶
func NewNSExpressionDescription() NSExpressionDescription
NewNSExpressionDescription creates a new NSExpressionDescription instance.
func (NSExpressionDescription) Autorelease ¶
func (e NSExpressionDescription) Autorelease() NSExpressionDescription
Autorelease adds the receiver to the current autorelease pool.
func (NSExpressionDescription) Expression ¶
func (e NSExpressionDescription) Expression() foundation.NSExpression
The expression to evaluate.
See: https://developer.apple.com/documentation/CoreData/NSExpressionDescription/expression
func (NSExpressionDescription) ExpressionResultType ¶
func (e NSExpressionDescription) ExpressionResultType() NSAttributeType
The attribute type of the expression’s result.
See: https://developer.apple.com/documentation/CoreData/NSExpressionDescription/expressionResultType
func (NSExpressionDescription) Init ¶
func (e NSExpressionDescription) Init() NSExpressionDescription
Init initializes the instance.
func (NSExpressionDescription) SetExpression ¶
func (e NSExpressionDescription) SetExpression(value foundation.NSExpression)
func (NSExpressionDescription) SetExpressionResultType ¶
func (e NSExpressionDescription) SetExpressionResultType(value NSAttributeType)
type NSExpressionDescriptionClass ¶
type NSExpressionDescriptionClass struct {
// contains filtered or unexported fields
}
func GetNSExpressionDescriptionClass ¶
func GetNSExpressionDescriptionClass() NSExpressionDescriptionClass
GetNSExpressionDescriptionClass returns the class object for NSExpressionDescription.
func (NSExpressionDescriptionClass) Alloc ¶
func (nc NSExpressionDescriptionClass) Alloc() NSExpressionDescription
Alloc allocates memory for a new instance of the class.
func (NSExpressionDescriptionClass) Class ¶
func (nc NSExpressionDescriptionClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSFetchIndexDescription ¶
type NSFetchIndexDescription struct {
objectivec.Object
}
The description of the index.
Creating an Index Description ¶
- NSFetchIndexDescription.InitWithNameElements: Creates a fetch index description using the specified name and element descriptions.
Inspecting an Index Description ¶
- NSFetchIndexDescription.Elements: An array of fetch index element descriptions.
- NSFetchIndexDescription.SetElements
- NSFetchIndexDescription.Entity: The entity description for the fetch index description.
- NSFetchIndexDescription.Name: The name of the fetch index description.
- NSFetchIndexDescription.SetName
- NSFetchIndexDescription.PartialIndexPredicate: A predicate that selects rows for indexing, if the index is a partial index.
- NSFetchIndexDescription.SetPartialIndexPredicate
See: https://developer.apple.com/documentation/CoreData/NSFetchIndexDescription
func NSFetchIndexDescriptionFromID ¶
func NSFetchIndexDescriptionFromID(id objc.ID) NSFetchIndexDescription
NSFetchIndexDescriptionFromID constructs a NSFetchIndexDescription from an objc.ID.
The description of the index.
func NewFetchIndexDescriptionWithNameElements ¶
func NewFetchIndexDescriptionWithNameElements(name string, elements []NSFetchIndexElementDescription) NSFetchIndexDescription
Creates a fetch index description using the specified name and element descriptions.
name: The name of the fetch index description.
elements: An array of fetch index element descriptions.
See: https://developer.apple.com/documentation/CoreData/NSFetchIndexDescription/init(name:elements:)
func NewNSFetchIndexDescription ¶
func NewNSFetchIndexDescription() NSFetchIndexDescription
NewNSFetchIndexDescription creates a new NSFetchIndexDescription instance.
func (NSFetchIndexDescription) Autorelease ¶
func (f NSFetchIndexDescription) Autorelease() NSFetchIndexDescription
Autorelease adds the receiver to the current autorelease pool.
func (NSFetchIndexDescription) Elements ¶
func (f NSFetchIndexDescription) Elements() []NSFetchIndexElementDescription
An array of fetch index element descriptions.
Discussion ¶
Setting this property to an invalid value throws an exception, such as when the new value includes both R-tree and non-R-tree elements.
See: https://developer.apple.com/documentation/CoreData/NSFetchIndexDescription/elements
func (NSFetchIndexDescription) EncodeWithCoder ¶
func (f NSFetchIndexDescription) EncodeWithCoder(coder foundation.INSCoder)
func (NSFetchIndexDescription) Entity ¶
func (f NSFetchIndexDescription) Entity() INSEntityDescription
The entity description for the fetch index description.
See: https://developer.apple.com/documentation/CoreData/NSFetchIndexDescription/entity
func (NSFetchIndexDescription) Init ¶
func (f NSFetchIndexDescription) Init() NSFetchIndexDescription
Init initializes the instance.
func (NSFetchIndexDescription) InitWithNameElements ¶
func (f NSFetchIndexDescription) InitWithNameElements(name string, elements []NSFetchIndexElementDescription) NSFetchIndexDescription
Creates a fetch index description using the specified name and element descriptions.
name: The name of the fetch index description.
elements: An array of fetch index element descriptions.
See: https://developer.apple.com/documentation/CoreData/NSFetchIndexDescription/init(name:elements:)
func (NSFetchIndexDescription) Name ¶
func (f NSFetchIndexDescription) Name() string
The name of the fetch index description.
See: https://developer.apple.com/documentation/CoreData/NSFetchIndexDescription/name
func (NSFetchIndexDescription) PartialIndexPredicate ¶
func (f NSFetchIndexDescription) PartialIndexPredicate() foundation.NSPredicate
A predicate that selects rows for indexing, if the index is a partial index.
See: https://developer.apple.com/documentation/CoreData/NSFetchIndexDescription/partialIndexPredicate
func (NSFetchIndexDescription) SetElements ¶
func (f NSFetchIndexDescription) SetElements(value []NSFetchIndexElementDescription)
func (NSFetchIndexDescription) SetName ¶
func (f NSFetchIndexDescription) SetName(value string)
func (NSFetchIndexDescription) SetPartialIndexPredicate ¶
func (f NSFetchIndexDescription) SetPartialIndexPredicate(value foundation.NSPredicate)
type NSFetchIndexDescriptionClass ¶
type NSFetchIndexDescriptionClass struct {
// contains filtered or unexported fields
}
func GetNSFetchIndexDescriptionClass ¶
func GetNSFetchIndexDescriptionClass() NSFetchIndexDescriptionClass
GetNSFetchIndexDescriptionClass returns the class object for NSFetchIndexDescription.
func (NSFetchIndexDescriptionClass) Alloc ¶
func (nc NSFetchIndexDescriptionClass) Alloc() NSFetchIndexDescription
Alloc allocates memory for a new instance of the class.
func (NSFetchIndexDescriptionClass) Class ¶
func (nc NSFetchIndexDescriptionClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSFetchIndexElementDescription ¶
type NSFetchIndexElementDescription struct {
objectivec.Object
}
Description of an Index Element
Creating an Index Element Description ¶
- NSFetchIndexElementDescription.InitWithPropertyCollationType: Creates an index element description using the specified property description and collation type.
Inspecting an Index Element Description ¶
- NSFetchIndexElementDescription.CollationType: The type of collation that the index element uses, either binary or R-tree.
- NSFetchIndexElementDescription.SetCollationType
- NSFetchIndexElementDescription.IndexDescription
- NSFetchIndexElementDescription.IsAscending: A Boolean value that controls whether an index that supports direction is an ascending or descending index.
- NSFetchIndexElementDescription.SetAscending
- NSFetchIndexElementDescription.Property: A property description.
- NSFetchIndexElementDescription.PropertyName: The specified name in the property description.
See: https://developer.apple.com/documentation/CoreData/NSFetchIndexElementDescription
func NSFetchIndexElementDescriptionFromID ¶
func NSFetchIndexElementDescriptionFromID(id objc.ID) NSFetchIndexElementDescription
NSFetchIndexElementDescriptionFromID constructs a NSFetchIndexElementDescription from an objc.ID.
Description of an Index Element
func NewFetchIndexElementDescriptionWithPropertyCollationType ¶
func NewFetchIndexElementDescriptionWithPropertyCollationType(property INSPropertyDescription, collationType NSFetchIndexElementType) NSFetchIndexElementDescription
Creates an index element description using the specified property description and collation type.
func NewNSFetchIndexElementDescription ¶
func NewNSFetchIndexElementDescription() NSFetchIndexElementDescription
NewNSFetchIndexElementDescription creates a new NSFetchIndexElementDescription instance.
func (NSFetchIndexElementDescription) Autorelease ¶
func (f NSFetchIndexElementDescription) Autorelease() NSFetchIndexElementDescription
Autorelease adds the receiver to the current autorelease pool.
func (NSFetchIndexElementDescription) CollationType ¶
func (f NSFetchIndexElementDescription) CollationType() NSFetchIndexElementType
The type of collation that the index element uses, either binary or R-tree.
See: https://developer.apple.com/documentation/CoreData/NSFetchIndexElementDescription/collationType
func (NSFetchIndexElementDescription) EncodeWithCoder ¶
func (f NSFetchIndexElementDescription) EncodeWithCoder(coder foundation.INSCoder)
func (NSFetchIndexElementDescription) IndexDescription ¶
func (f NSFetchIndexElementDescription) IndexDescription() INSFetchIndexDescription
See: https://developer.apple.com/documentation/CoreData/NSFetchIndexElementDescription/indexDescription
func (NSFetchIndexElementDescription) Init ¶
func (f NSFetchIndexElementDescription) Init() NSFetchIndexElementDescription
Init initializes the instance.
func (NSFetchIndexElementDescription) InitWithPropertyCollationType ¶
func (f NSFetchIndexElementDescription) InitWithPropertyCollationType(property INSPropertyDescription, collationType NSFetchIndexElementType) NSFetchIndexElementDescription
Creates an index element description using the specified property description and collation type.
func (NSFetchIndexElementDescription) IsAscending ¶
func (f NSFetchIndexElementDescription) IsAscending() bool
A Boolean value that controls whether an index that supports direction is an ascending or descending index.
See: https://developer.apple.com/documentation/CoreData/NSFetchIndexElementDescription/isAscending
func (NSFetchIndexElementDescription) Property ¶
func (f NSFetchIndexElementDescription) Property() INSPropertyDescription
A property description.
Discussion ¶
This property may also be an NSExpressionDescription that expresses a function.
See: https://developer.apple.com/documentation/CoreData/NSFetchIndexElementDescription/property
func (NSFetchIndexElementDescription) PropertyName ¶
func (f NSFetchIndexElementDescription) PropertyName() string
The specified name in the property description.
See: https://developer.apple.com/documentation/CoreData/NSFetchIndexElementDescription/propertyName
func (NSFetchIndexElementDescription) SetAscending ¶
func (f NSFetchIndexElementDescription) SetAscending(value bool)
func (NSFetchIndexElementDescription) SetCollationType ¶
func (f NSFetchIndexElementDescription) SetCollationType(value NSFetchIndexElementType)
type NSFetchIndexElementDescriptionClass ¶
type NSFetchIndexElementDescriptionClass struct {
// contains filtered or unexported fields
}
func GetNSFetchIndexElementDescriptionClass ¶
func GetNSFetchIndexElementDescriptionClass() NSFetchIndexElementDescriptionClass
GetNSFetchIndexElementDescriptionClass returns the class object for NSFetchIndexElementDescription.
func (NSFetchIndexElementDescriptionClass) Alloc ¶
func (nc NSFetchIndexElementDescriptionClass) Alloc() NSFetchIndexElementDescription
Alloc allocates memory for a new instance of the class.
func (NSFetchIndexElementDescriptionClass) Class ¶
func (nc NSFetchIndexElementDescriptionClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSFetchIndexElementType ¶
type NSFetchIndexElementType uint
See: https://developer.apple.com/documentation/CoreData/NSFetchIndexElementType
const ( // NSFetchIndexElementTypeBinary: A binary index type. NSFetchIndexElementTypeBinary NSFetchIndexElementType = 0 // NSFetchIndexElementTypeRTree: An R-tree index type. NSFetchIndexElementTypeRTree NSFetchIndexElementType = 1 )
func (NSFetchIndexElementType) String ¶
func (e NSFetchIndexElementType) String() string
type NSFetchRequest ¶
type NSFetchRequest struct {
NSPersistentStoreRequest
}
A description of search criteria used to retrieve data from a persistent store.
Overview ¶
An instance of NSFetchRequest collects the criteria needed to select and optionally to sort a group of NSManagedObject managed objects held in an NSPersistentStore persistent store. A fetch request contains an NSEntityDescription or an entity name that specifies which entity to search. It frequently also contains:
- An NSPredicate predicate that specifies which properties to filter by and the constraints on selection, such as, `“last name begins with a ‘J’”`. If you don’t specify a predicate, then the system fetches all instances of the entity that you specified, subject to other constraints. For more information, see fetch(_:). - An array of NSSortDescriptor sort descriptors that specify how to order the returned objects, such as ascending by last name and then by first name.
You can also specify other aspects of a fetch request:
NSFetchRequest.FetchLimit: The maximum number of objects that a request returns NSFetchRequest.FetchOffset: The number of objects to skip [NSFetchRequest.AffectedStores]: Which data stores the request accesses NSFetchRequest.ResultType: Whether the fetch returns managed objects, object IDs, dictionaries, or a count NSFetchRequest.IncludesPropertyValues and: Whether objects are fully populated with their properties NSFetchRequest.ReturnsObjectsAsFaults: Whether the objects are faults NSFetchRequest.IncludesSubentities: Whether the fetch includes subentities of the fetched entity NSFetchRequest.PropertiesToFetch: Which properties to fetch NSFetchRequest.IncludesPendingChanges: Whether to include unsaved changes
Use NSFetchRequest.Execute to perform the fetch directly on the managed object context that’s associated with the current queue. Or use one of the NSManagedObjectContext methods such as NSManagedObjectContext.PerformBlock to execute the fetch.
In SwiftUI, you can use a FetchRequest property wrapper to execute the fetch and assign the results to a property. First, create the request:
Then use a FetchRequest property wrapper with the request to declare a property that receives the objects that the fetch returns:
You often predefine fetch requests in an NSManagedObjectModel managed object model to provide an API to retrieve a stored fetch request by name. Stored fetch requests can include placeholders for variable substitution, and serve as templates for later completion. Fetch request templates allow you to predefine queries with variables to substitute at runtime.
Managing the Fetch Request’s Entity ¶
- NSFetchRequest.InitWithEntityName: Initializes a fetch request configured with a given entity name.
- NSFetchRequest.EntityName: The name of the entity the request is configured to fetch.
- NSFetchRequest.Entity: The entity specified for the fetch request.
- NSFetchRequest.SetEntity
- NSFetchRequest.IncludesSubentities: A Boolean value that indicates whether the fetch request includes subentities in the results.
- NSFetchRequest.SetIncludesSubentities
Specifying Fetch Constraints ¶
- NSFetchRequest.Predicate: The predicate of the fetch request.
- NSFetchRequest.SetPredicate
- NSFetchRequest.FetchLimit: The fetch limit of the fetch request.
- NSFetchRequest.SetFetchLimit
- NSFetchRequest.FetchOffset: The fetch offset of the fetch request.
- NSFetchRequest.SetFetchOffset
- NSFetchRequest.FetchBatchSize: The batch size of the objects specified in the fetch request.
- NSFetchRequest.SetFetchBatchSize
Sorting the Results ¶
- NSFetchRequest.SortDescriptors: The sort descriptors of the fetch request.
- NSFetchRequest.SetSortDescriptors
Prefetching Related Objects ¶
- NSFetchRequest.RelationshipKeyPathsForPrefetching: The relationship key paths to prefetch along with the entity for the request.
- NSFetchRequest.SetRelationshipKeyPathsForPrefetching
Managing How Results Are Returned ¶
- NSFetchRequest.ResultType: The result type of the fetch request.
- NSFetchRequest.SetResultType
- NSFetchRequest.IncludesPendingChanges: A Boolean value that indicates whether, when the fetch is executed, it matches against currently unsaved changes in the managed object context.
- NSFetchRequest.SetIncludesPendingChanges
- NSFetchRequest.PropertiesToFetch: A collection of either property descriptions or string property names that specify which properties should be returned by the fetch.
- NSFetchRequest.SetPropertiesToFetch
- NSFetchRequest.ReturnsDistinctResults: A Boolean value that indicates whether the fetch request returns only distinct values for the fields specified by [propertiesToFetch](<https://developer.apple.com/documentation/CoreData/NSFetchRequest/propertiesToFetch>).
- NSFetchRequest.SetReturnsDistinctResults
- NSFetchRequest.IncludesPropertyValues: A Boolean value that indicates whether, when the fetch is executed, property data is obtained from the persistent store.
- NSFetchRequest.SetIncludesPropertyValues
- NSFetchRequest.ShouldRefreshRefetchedObjects: A Boolean value that indicates whether the property values of fetched objects will be updated with the current values in the persistent store.
- NSFetchRequest.SetShouldRefreshRefetchedObjects
- NSFetchRequest.ReturnsObjectsAsFaults: A Boolean value that indicates whether the objects resulting from a fetch request are faults.
- NSFetchRequest.SetReturnsObjectsAsFaults
Grouping and Filtering Dictionary Results ¶
- NSFetchRequest.PropertiesToGroupBy: An array of objects that indicates how data should be grouped before a select statement is run in a SQL database.
- NSFetchRequest.SetPropertiesToGroupBy
- NSFetchRequest.HavingPredicate: The predicate used to filter rows being returned by a query containing a GROUP BY directive.
- NSFetchRequest.SetHavingPredicate
Executing a Fetch Request Directly ¶
- NSFetchRequest.Execute: Executes the fetch request against the managed object context that is associated with the current queue.
See: https://developer.apple.com/documentation/CoreData/NSFetchRequest
func NSFetchRequestFromID ¶
func NSFetchRequestFromID(id objc.ID) NSFetchRequest
NSFetchRequestFromID constructs a NSFetchRequest from an objc.ID.
A description of search criteria used to retrieve data from a persistent store.
func NewFetchRequestWithEntityName ¶
func NewFetchRequestWithEntityName(entityName string) NSFetchRequest
Initializes a fetch request configured with a given entity name.
entityName: The name of the entity to fetch.
Return Value ¶
A fetch request configured to fetch using the entity named `entityName`.
Discussion ¶
This method provides a convenient way to configure the entity for a fetch request without having to retrieve an NSEntityDescription object. When the fetch is executed, the request uses the managed object context to find the entity with the given name. The model associated with the context’s persistent store coordinator must contain an entity named `entityName`.
See: https://developer.apple.com/documentation/CoreData/NSFetchRequest/init(entityName:)
func NewNSFetchRequest ¶
func NewNSFetchRequest() NSFetchRequest
NewNSFetchRequest creates a new NSFetchRequest instance.
func (NSFetchRequest) Autorelease ¶
func (f NSFetchRequest) Autorelease() NSFetchRequest
Autorelease adds the receiver to the current autorelease pool.
func (NSFetchRequest) Entity ¶
func (f NSFetchRequest) Entity() INSEntityDescription
The entity specified for the fetch request.
Discussion ¶
When an NSFetchRequest instance is created with `init()`, it is expected that the NSPropertyDescription.Entity property will be set. If this property is not set, the fetch request fails upon execution.
See: https://developer.apple.com/documentation/CoreData/NSFetchRequest/entity
func (NSFetchRequest) EntityName ¶
func (f NSFetchRequest) EntityName() string
The name of the entity the request is configured to fetch.
Discussion ¶
The entity name property is populated whenever the NSFetchRequest is created with NSFetchRequest.InitWithEntityName or fetchRequestWithEntityName:.
See: https://developer.apple.com/documentation/CoreData/NSFetchRequest/entityName
func (NSFetchRequest) Execute ¶
func (f NSFetchRequest) Execute() ([]objectivec.IObject, error)
Executes the fetch request against the managed object context that is associated with the current queue.
Discussion ¶
Calling `execute` on an NSFetchRequest will cause the NSFetchRequest to run against the managed object context (NSManagedObjectContext) that is associated with the queue on which the `execute` is called.
See: https://developer.apple.com/documentation/CoreData/NSFetchRequest/execute()
func (NSFetchRequest) FetchBatchSize ¶
func (f NSFetchRequest) FetchBatchSize() uint
The batch size of the objects specified in the fetch request.
Discussion ¶
The default value is `0`. A batch size of `0` is treated as infinite, which disables the batch fetching behavior.
If you set a nonzero batch size, the collection of objects returned when an instance of NSFetchRequest is executed is broken into batches. When the fetch is executed, the entire request is evaluated and the identities of all matching objects recorded, but only data for objects up to the `batchSize` will be fetched from the persistent store at a time. The array returned from executing the request is a proxy object that transparently fetches subsequent batches on demand. (In database terms, this is an in-memory cursor.)
You can use this feature to restrict the working set of data in your application. In combination with NSFetchRequest.FetchLimit, you can create a subrange of an arbitrary result set.
Special Considerations ¶
For purposes of thread safety, when the fetch is executed, consider the array proxy returned as being owned by the managed object context the request is executed against. Treat the array proxy as if it were a managed object registered with that context.
See: https://developer.apple.com/documentation/CoreData/NSFetchRequest/fetchBatchSize
func (NSFetchRequest) FetchLimit ¶
func (f NSFetchRequest) FetchLimit() uint
The fetch limit of the fetch request.
Discussion ¶
The fetch limit specifies the maximum number of objects that a request should return when executed.
If you set a fetch limit, the framework makes a best effort to improve efficiency, but does not guarantee it. For every object store except the SQL store, a fetch request executed with a fetch limit in effect simply performs an unlimited fetch and throws away the unasked for rows.
See: https://developer.apple.com/documentation/CoreData/NSFetchRequest/fetchLimit
func (NSFetchRequest) FetchOffset ¶
func (f NSFetchRequest) FetchOffset() uint
The fetch offset of the fetch request.
Discussion ¶
The default value is `0`.
This setting allows you to specify an offset at which rows will begin being returned. Effectively, the request skips the specified number of matching entries. For example, given a fetch that typically returns `a, b, c, d`, specifying an offset of 1 will return `b, c, d`, and an offset of 4 will return an empty array. Offsets are ignored in nested requests such as subqueries.
This property can be used to restrict the working set of data. In combination with NSFetchRequest.FetchLimit, you can create a subrange of an arbitrary result set.
See: https://developer.apple.com/documentation/CoreData/NSFetchRequest/fetchOffset
func (NSFetchRequest) HavingPredicate ¶
func (f NSFetchRequest) HavingPredicate() foundation.NSPredicate
The predicate used to filter rows being returned by a query containing a GROUP BY directive.
Discussion ¶
If a `havingPredicate` value is supplied, the predicate will be run after. Specifying a `havingPredicate` requires that NSFetchRequest.PropertiesToGroupBy also be specified.
See: https://developer.apple.com/documentation/CoreData/NSFetchRequest/havingPredicate
func (NSFetchRequest) IncludesPendingChanges ¶
func (f NSFetchRequest) IncludesPendingChanges() bool
A Boolean value that indicates whether, when the fetch is executed, it matches against currently unsaved changes in the managed object context.
Discussion ¶
This value is true if when the fetch is executed, the fetch will match against currently unsaved changes in the managed object context; otherwise the value is false. The default value is true.
If the value is false, the fetch request doesn’t check unsaved changes and only returns objects that matched the predicate in the persistent store.
Special Considerations ¶
A value of true is not supported in conjunction with the result type NSDictionaryResultType, including calculation of aggregate results (such as `max` and `min`). For dictionaries, the array returned from the fetch reflects the current state in the persistent store, and does not take into account any pending changes, insertions, or deletions in the context.
If you need to take pending changes into account for some simple aggregations like `max` and `min`, you can instead use a normal fetch request, sorted on the attribute you want, with a fetch limit of 1.
See: https://developer.apple.com/documentation/CoreData/NSFetchRequest/includesPendingChanges
func (NSFetchRequest) IncludesPropertyValues ¶
func (f NSFetchRequest) IncludesPropertyValues() bool
A Boolean value that indicates whether, when the fetch is executed, property data is obtained from the persistent store.
Discussion ¶
This value is true if when the fetch is executed, property data is obtained from the persistent store; otherwise it is false. The default value is true.
You can set NSFetchRequest.IncludesPropertyValues to false to avoid creating objects to represent property values and thereby reduce memory overhead. You typically should only do so, however, if you are sure that you will not need the actual property data, or you already have the information in the row cache. Otherwise, you will incur multiple trips to the database.
During a normal fetch (NSFetchRequest.IncludesPropertyValues is true), Core Data fetches the object ID and property data for the matching records, fills the row cache with the information, and returns managed objects as faults (see NSFetchRequest.ReturnsObjectsAsFaults). Although these faults are managed objects, all of their property data still resides in the row cache until the fault is fired. When the fault is fired, Core Data retrieves the data from the row cache—there is no need to go back to the database.
If NSFetchRequest.IncludesPropertyValues is false, then Core Data fetches only the object ID information for the matching records—it does not populate the row cache. Core Data still returns managed objects because it only needs managed object IDs to create faults. However, if you subsequently fire the fault, Core Data looks in the (empty) row cache, doesn’t find any data, and then goes back to the store a second time for the data.
If NSFetchRequest.IncludesPropertyValues is true and NSFetchRequest.ResultType is set to NSManagedObjectIDResultType, the properties are fetched even though they are not being presented to the application and can result in a significant performance penalty.
See: https://developer.apple.com/documentation/CoreData/NSFetchRequest/includesPropertyValues
func (NSFetchRequest) IncludesSubentities ¶
func (f NSFetchRequest) IncludesSubentities() bool
A Boolean value that indicates whether the fetch request includes subentities in the results.
Discussion ¶
The value is true if the request will include all subentities of the entity for the request; otherwise it is false. The default is true.
See: https://developer.apple.com/documentation/CoreData/NSFetchRequest/includesSubentities
func (NSFetchRequest) Init ¶
func (f NSFetchRequest) Init() NSFetchRequest
Init initializes the instance.
func (NSFetchRequest) InitWithEntityName ¶
func (f NSFetchRequest) InitWithEntityName(entityName string) NSFetchRequest
Initializes a fetch request configured with a given entity name.
entityName: The name of the entity to fetch.
Return Value ¶
A fetch request configured to fetch using the entity named `entityName`.
Discussion ¶
This method provides a convenient way to configure the entity for a fetch request without having to retrieve an NSEntityDescription object. When the fetch is executed, the request uses the managed object context to find the entity with the given name. The model associated with the context’s persistent store coordinator must contain an entity named `entityName`.
See: https://developer.apple.com/documentation/CoreData/NSFetchRequest/init(entityName:)
func (NSFetchRequest) Predicate ¶
func (f NSFetchRequest) Predicate() foundation.NSPredicate
The predicate of the fetch request.
Discussion ¶
The predicate instance constrains the selection of objects the NSFetchRequest instance is to fetch.
If the predicate is empty—for example, if it is an [AND] predicate whose array of elements contains no predicates—the request has its predicate set to `nil`. For more about predicates, see Predicate Programming Guide.
See: https://developer.apple.com/documentation/CoreData/NSFetchRequest/predicate
func (NSFetchRequest) PropertiesToFetch ¶
func (f NSFetchRequest) PropertiesToFetch() foundation.INSArray
A collection of either property descriptions or string property names that specify which properties should be returned by the fetch.
Discussion ¶
Property descriptions can either be instances of NSPropertyDescription or NSString. The property descriptions may represent attributes, to-one relationships, or expressions. The name of an attribute or relationship description must match the name of a description on the fetch request’s entity.
Special Considerations ¶
You must set the entity for the fetch request before setting this value; otherwise, NSFetchRequest throws an invalidArgumentException exception.
This property can be set with NSManagedObjectResultType and thereby implement a partial faulting (whereby only some of the properties are populated) of the returned objects, as well as the NSDictionaryResultType to define what properties are included in the resulting NSDictionary.
See: https://developer.apple.com/documentation/CoreData/NSFetchRequest/propertiesToFetch
func (NSFetchRequest) PropertiesToGroupBy ¶
func (f NSFetchRequest) PropertiesToGroupBy() foundation.INSArray
An array of objects that indicates how data should be grouped before a select statement is run in a SQL database.
Discussion ¶
An array of NSPropertyDescription or NSExpressionDescription objects or key-path strings that indicate how data should be grouped before a select statement is run in an SQL database.
If you use this setting, you must set the NSFetchRequest.ResultType to NSDictionaryResultType, and the SELECT values must be literals, aggregates, or columns specified in `propertiesToGroupBy`.
Aggregates will operate on the groups specified in `propertiesToGroupBy`
rather than the whole table. If you set `propertiesToGroupBy`, you can also set a predicate to filter rows that are returned by `propertiesToGroupBy`.
See NSFetchRequest.HavingPredicate.
See: https://developer.apple.com/documentation/CoreData/NSFetchRequest/propertiesToGroupBy
func (NSFetchRequest) RelationshipKeyPathsForPrefetching ¶
func (f NSFetchRequest) RelationshipKeyPathsForPrefetching() []string
The relationship key paths to prefetch along with the entity for the request.
Discussion ¶
This property is an array of relationship key-path strings in NSKeyValueCoding notation (as you typically use with value(forKeyPath:)). The default value is an empty array (no prefetching).
Prefetching allows Core Data to obtain related objects in a single fetch (per entity), rather than incurring subsequent access to the store for each individual record as their faults are tripped. For example, given an Employee entity with a relationship to a Department entity, suppose you fetch all the employees, and then for each print out their name and the name of the department to which they belong. In this case, a fault might be fired for each individual Department object. This can represent a significant overhead. You can avoid this by prefetching the department relationship in the Employee fetch, as illustrated in Listing 1.
(For more details, see Core Data Performance in Core Data Programming Guide)
See: https://developer.apple.com/documentation/CoreData/NSFetchRequest/relationshipKeyPathsForPrefetching
func (NSFetchRequest) ResultType ¶
func (f NSFetchRequest) ResultType() NSFetchRequestResultType
The result type of the fetch request.
Discussion ¶
The default value is NSManagedObjectResultType.
If you set the value to NSManagedObjectIDResultType, and do not include property values in the request, sort orderings are demoted to “best efforts” hints.
NSFetchRequest.IncludesPendingChanges discusses with whether pending changes are taken into account when the `resultType` is set to `managedObjectResultType`.
NSFetchRequest.IncludesPropertyValues discusses whether property values are included or not by default when the `resultType` is set to `managedObjectResultType`.
See: https://developer.apple.com/documentation/CoreData/NSFetchRequest/resultType
func (NSFetchRequest) ReturnsDistinctResults ¶
func (f NSFetchRequest) ReturnsDistinctResults() bool
A Boolean value that indicates whether the fetch request returns only distinct values for the fields specified by NSFetchRequest.PropertiesToFetch.
Discussion ¶
This value is used only if a value has been set for NSFetchRequest.PropertiesToFetch.
This value is true if when the fetch is executed, it returns only distinct values for the fields specified by NSFetchRequest.PropertiesToFetch; otherwise, the value is false. The default value is false.
See: https://developer.apple.com/documentation/CoreData/NSFetchRequest/returnsDistinctResults
func (NSFetchRequest) ReturnsObjectsAsFaults ¶
func (f NSFetchRequest) ReturnsObjectsAsFaults() bool
A Boolean value that indicates whether the objects resulting from a fetch request are faults.
Discussion ¶
This value is true if the objects resulting from a fetch using the NSFetchRequest are faults; otherwise, it is false. The default value is true. This setting is not used if the result type (see NSFetchRequest.ResultType) is NSManagedObjectIDResultType, as object IDs do not have property values. You can set NSFetchRequest.ReturnsObjectsAsFaults to false to gain a performance benefit if you know you will need to access the property values from the returned objects.
When you execute a fetch, by default NSFetchRequest.ReturnsObjectsAsFaults is true; Core Data fetches the object data for the matching records, fills the row cache with the information, and returns managed object as faults. These faults are managed objects, but all of their property data resides in the row cache until the fault is fired. When the fault is fired, Core Data retrieves the data from the row cache. Although the overhead for this operation is small, for large datasets it may not be trivial. If you need to access the property values from the returned objects (for example, if you iterate over all the objects to calculate the average value of a particular attribute), then it is more efficient to set NSFetchRequest.ReturnsObjectsAsFaults to false to avoid the additional overhead.
See: https://developer.apple.com/documentation/CoreData/NSFetchRequest/returnsObjectsAsFaults
func (NSFetchRequest) SetEntity ¶
func (f NSFetchRequest) SetEntity(value INSEntityDescription)
func (NSFetchRequest) SetFetchBatchSize ¶
func (f NSFetchRequest) SetFetchBatchSize(value uint)
func (NSFetchRequest) SetFetchLimit ¶
func (f NSFetchRequest) SetFetchLimit(value uint)
func (NSFetchRequest) SetFetchOffset ¶
func (f NSFetchRequest) SetFetchOffset(value uint)
func (NSFetchRequest) SetHavingPredicate ¶
func (f NSFetchRequest) SetHavingPredicate(value foundation.NSPredicate)
func (NSFetchRequest) SetIncludesPendingChanges ¶
func (f NSFetchRequest) SetIncludesPendingChanges(value bool)
func (NSFetchRequest) SetIncludesPropertyValues ¶
func (f NSFetchRequest) SetIncludesPropertyValues(value bool)
func (NSFetchRequest) SetIncludesSubentities ¶
func (f NSFetchRequest) SetIncludesSubentities(value bool)
func (NSFetchRequest) SetPredicate ¶
func (f NSFetchRequest) SetPredicate(value foundation.NSPredicate)
func (NSFetchRequest) SetPropertiesToFetch ¶
func (f NSFetchRequest) SetPropertiesToFetch(value foundation.INSArray)
func (NSFetchRequest) SetPropertiesToGroupBy ¶
func (f NSFetchRequest) SetPropertiesToGroupBy(value foundation.INSArray)
func (NSFetchRequest) SetRelationshipKeyPathsForPrefetching ¶
func (f NSFetchRequest) SetRelationshipKeyPathsForPrefetching(value []string)
func (NSFetchRequest) SetResultType ¶
func (f NSFetchRequest) SetResultType(value NSFetchRequestResultType)
func (NSFetchRequest) SetReturnsDistinctResults ¶
func (f NSFetchRequest) SetReturnsDistinctResults(value bool)
func (NSFetchRequest) SetReturnsObjectsAsFaults ¶
func (f NSFetchRequest) SetReturnsObjectsAsFaults(value bool)
func (NSFetchRequest) SetShouldRefreshRefetchedObjects ¶
func (f NSFetchRequest) SetShouldRefreshRefetchedObjects(value bool)
func (NSFetchRequest) SetSortDescriptors ¶
func (f NSFetchRequest) SetSortDescriptors(value []foundation.NSSortDescriptor)
func (NSFetchRequest) ShouldRefreshRefetchedObjects ¶
func (f NSFetchRequest) ShouldRefreshRefetchedObjects() bool
A Boolean value that indicates whether the property values of fetched objects will be updated with the current values in the persistent store.
Discussion ¶
This value is true if the property values of fetched objects will be updated with the current values in the persistent store; otherwise, it is false.
By default when you fetch objects, they maintain their current property values, even if the values in the persistent store have changed. Invoking this method with the parameter true means that when the fetch is executed, the property values of fetched objects are updated with the current values in the persistent store. This is a more convenient way to ensure that managed object property values are consistent with the store than by using NSManagedObjectContext.RefreshObjectMergeChanges ([NSManagedObjetContext]) for multiple objects in turn.
See: https://developer.apple.com/documentation/CoreData/NSFetchRequest/shouldRefreshRefetchedObjects
func (NSFetchRequest) SortDescriptors ¶
func (f NSFetchRequest) SortDescriptors() []foundation.NSSortDescriptor
The sort descriptors of the fetch request.
Discussion ¶
The sort descriptors specify how the objects returned when the NSFetchRequest is issued should be ordered—for example, by last name and then by first name. The sort descriptors are applied in the order in which they appear in the `sortDescriptors` array (serially in lowest-array-index-first order).
A value of `nil` is treated as no sort descriptors.
See: https://developer.apple.com/documentation/CoreData/NSFetchRequest/sortDescriptors
type NSFetchRequestClass ¶
type NSFetchRequestClass struct {
// contains filtered or unexported fields
}
func GetNSFetchRequestClass ¶
func GetNSFetchRequestClass() NSFetchRequestClass
GetNSFetchRequestClass returns the class object for NSFetchRequest.
func (NSFetchRequestClass) Alloc ¶
func (nc NSFetchRequestClass) Alloc() NSFetchRequest
Alloc allocates memory for a new instance of the class.
func (NSFetchRequestClass) Class ¶
func (nc NSFetchRequestClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSFetchRequestExpression ¶
type NSFetchRequestExpression struct {
foundation.NSExpression
}
An expression that evaluates the result of a fetch request on a managed object context.
Overview ¶
NSFetchRequestExpression inherits from NSExpression, which provides most of the basic behavior. The first argument must be an expression which evaluates to an NSFetchRequest object, and the second must be an expression which evaluates to an NSManagedObjectContext object. If you simply want the count for the request, the `countOnly` argument should be true.
Examining a Fetch Request Expression ¶
- NSFetchRequestExpression.RequestExpression: The expression for the receiver’s fetch request.
- NSFetchRequestExpression.ContextExpression: The expression for the receiver’s managed object context.
- NSFetchRequestExpression.IsCountOnlyRequest: Returns a Boolean value that indicates whether the receiver represents a count-only fetch request.
See: https://developer.apple.com/documentation/CoreData/NSFetchRequestExpression
func NSFetchRequestExpressionFromID ¶
func NSFetchRequestExpressionFromID(id objc.ID) NSFetchRequestExpression
NSFetchRequestExpressionFromID constructs a NSFetchRequestExpression from an objc.ID.
An expression that evaluates the result of a fetch request on a managed object context.
func NewNSFetchRequestExpression ¶
func NewNSFetchRequestExpression() NSFetchRequestExpression
NewNSFetchRequestExpression creates a new NSFetchRequestExpression instance.
func (NSFetchRequestExpression) Autorelease ¶
func (f NSFetchRequestExpression) Autorelease() NSFetchRequestExpression
Autorelease adds the receiver to the current autorelease pool.
func (NSFetchRequestExpression) ContextExpression ¶
func (f NSFetchRequestExpression) ContextExpression() foundation.NSExpression
The expression for the receiver’s managed object context.
Discussion ¶
The expression must evaluate to an NSManagedObjectContext object.
See: https://developer.apple.com/documentation/CoreData/NSFetchRequestExpression/contextExpression
func (NSFetchRequestExpression) Init ¶
func (f NSFetchRequestExpression) Init() NSFetchRequestExpression
Init initializes the instance.
func (NSFetchRequestExpression) IsCountOnlyRequest ¶
func (f NSFetchRequestExpression) IsCountOnlyRequest() bool
Returns a Boolean value that indicates whether the receiver represents a count-only fetch request.
Discussion ¶
true if the receiver represents a count-only fetch request, otherwise false. If this method returns false, the managed object context (from the NSFetchRequestExpression.ContextExpression) will perform fetch(_:): with the NSFetchRequestExpression.RequestExpression; if this method returns true, the managed object context will perform NSManagedObjectContext.CountForFetchRequestError with the NSFetchRequestExpression.RequestExpression.
See: https://developer.apple.com/documentation/CoreData/NSFetchRequestExpression/isCountOnlyRequest
func (NSFetchRequestExpression) RequestExpression ¶
func (f NSFetchRequestExpression) RequestExpression() foundation.NSExpression
The expression for the receiver’s fetch request.
Discussion ¶
The expression must evaluate to an NSFetchRequest object.
See: https://developer.apple.com/documentation/CoreData/NSFetchRequestExpression/requestExpression
type NSFetchRequestExpressionClass ¶
type NSFetchRequestExpressionClass struct {
// contains filtered or unexported fields
}
func GetNSFetchRequestExpressionClass ¶
func GetNSFetchRequestExpressionClass() NSFetchRequestExpressionClass
GetNSFetchRequestExpressionClass returns the class object for NSFetchRequestExpression.
func (NSFetchRequestExpressionClass) Alloc ¶
func (nc NSFetchRequestExpressionClass) Alloc() NSFetchRequestExpression
Alloc allocates memory for a new instance of the class.
func (NSFetchRequestExpressionClass) Class ¶
func (nc NSFetchRequestExpressionClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (NSFetchRequestExpressionClass) ExpressionForFetchContextCountOnly ¶
func (_NSFetchRequestExpressionClass NSFetchRequestExpressionClass) ExpressionForFetchContextCountOnly(fetch foundation.NSExpression, context foundation.NSExpression, countFlag bool) foundation.NSExpression
Returns an expression which will evaluate to the result of executing a fetch request on a context.
fetch: An expression that evaluates to an instance of NSFetchRequest.
context: An expression that evaluates to an instance of NSManagedObjectContext.
countFlag: If true, when the new expression is evaluated the managed object context (from `context`) will perform NSManagedObjectContext.CountForFetchRequestError with the fetch request (from `fetch`). If false, when the new expression is evaluated the managed object context will perform fetch(_:) with the fetch request.
Return Value ¶
An expression which will evaluate to the result of executing a fetch request (from `fetch`) on a managed object context (from `context`).
type NSFetchRequestResult ¶
type NSFetchRequestResult interface {
objectivec.IObject
}
An abstract protocol used with parameterized fetch requests.
See: https://developer.apple.com/documentation/CoreData/NSFetchRequestResult
type NSFetchRequestResultObject ¶
type NSFetchRequestResultObject struct {
objectivec.Object
}
NSFetchRequestResultObject wraps an existing Objective-C object that conforms to the NSFetchRequestResult protocol.
func NSFetchRequestResultObjectFromID ¶
func NSFetchRequestResultObjectFromID(id objc.ID) NSFetchRequestResultObject
NSFetchRequestResultObjectFromID constructs a NSFetchRequestResultObject from an objc.ID. The object is determined to conform to the protocol at runtime.
func (NSFetchRequestResultObject) BaseObject ¶
func (o NSFetchRequestResultObject) BaseObject() objectivec.Object
type NSFetchRequestResultType ¶
type NSFetchRequestResultType uint
See: https://developer.apple.com/documentation/CoreData/NSFetchRequestResultType
const ( // NSCountResultType: The request returns the count of the objects that match the request. NSCountResultType NSFetchRequestResultType = 0x4 // NSDictionaryResultType: The request returns dictionaries. NSDictionaryResultType NSFetchRequestResultType = 0x2 // NSManagedObjectIDResultType: The request returns managed object IDs. NSManagedObjectIDResultType NSFetchRequestResultType = 0x1 // NSManagedObjectResultType: The request returns managed objects. NSManagedObjectResultType NSFetchRequestResultType = 0 )
func (NSFetchRequestResultType) String ¶
func (e NSFetchRequestResultType) String() string
type NSFetchedPropertyDescription ¶
type NSFetchedPropertyDescription struct {
NSPropertyDescription
}
A description object used to define which properties are fetched from Core Data.
Overview ¶
An example might be a iTunes playlist, if expressed as a property of a containing object. Songs don’t belong to a particular playlist, especially in the case that they’re on a remote server. The playlist may remain even after the songs have been deleted, or the remote server has become inaccessible. Note, however, that unlike a playlist a fetched property is static—it does not dynamically update itself as objects in the destination entity change.
The effect of a fetched property is similar to executing a fetch request yourself and placing the results in a transient attribute, although with the framework managing the details. In particular, a fetched property is not fetched until it is requested, and the results are then cached until the object is turned into a fault. You use NSManagedObjectContext.RefreshObjectMergeChanges (NSManagedObjectContext) to manually refresh the properties—this causes the fetch request associated with this property to be executed again when the object fault is next fired.
Unlike other relationships, which are all sets, fetched properties are represented by an ordered [NSArray] object just as if you executed the fetch request yourself. The fetch request associated with the property can have a sort ordering. The value for a fetched property of a managed object does not support “.
Fetch Request Variables ¶
Fetch requests set on an fetched property have 2 special variable bindings you can use: `$FETCH_SOURCE` and `$FETCHED_PROPERTY`. The source refers to the specific managed object that has this property; the property refers to the NSFetchedPropertyDescription object itself (which may have a user info associated with it that you want to use).
Editing Fetched Property Descriptions ¶
Fetched Property descriptions are editable until they are used by an object graph manager. This allows you to create or modify them dynamically. However, once a description is used (when the managed object model to which it belongs is associated with a persistent store coordinator), it must not (indeed cannot) be changed. This is enforced at runtime: any attempt to mutate a model or any of its subjects after the model is associated with a persistent store coordinator causes an exception to be thrown. If you need to modify a model that is in use, create a copy, modify the copy, and then discard the objects with the old model.
Getting and setting the fetch request ¶
- NSFetchedPropertyDescription.FetchRequest: The fetch request of the receiver.
- NSFetchedPropertyDescription.SetFetchRequest
See: https://developer.apple.com/documentation/CoreData/NSFetchedPropertyDescription
func NSFetchedPropertyDescriptionFromID ¶
func NSFetchedPropertyDescriptionFromID(id objc.ID) NSFetchedPropertyDescription
NSFetchedPropertyDescriptionFromID constructs a NSFetchedPropertyDescription from an objc.ID.
A description object used to define which properties are fetched from Core Data.
func NewNSFetchedPropertyDescription ¶
func NewNSFetchedPropertyDescription() NSFetchedPropertyDescription
NewNSFetchedPropertyDescription creates a new NSFetchedPropertyDescription instance.
func (NSFetchedPropertyDescription) Autorelease ¶
func (f NSFetchedPropertyDescription) Autorelease() NSFetchedPropertyDescription
Autorelease adds the receiver to the current autorelease pool.
func (NSFetchedPropertyDescription) FetchRequest ¶
func (f NSFetchedPropertyDescription) FetchRequest() INSFetchRequest
The fetch request of the receiver.
Discussion ¶
Setting the fetch request raises an exception if the receiver’s model has been used by an object graph manager.
See: https://developer.apple.com/documentation/CoreData/NSFetchedPropertyDescription/fetchRequest
func (NSFetchedPropertyDescription) Init ¶
func (f NSFetchedPropertyDescription) Init() NSFetchedPropertyDescription
Init initializes the instance.
func (NSFetchedPropertyDescription) SetFetchRequest ¶
func (f NSFetchedPropertyDescription) SetFetchRequest(value INSFetchRequest)
type NSFetchedPropertyDescriptionClass ¶
type NSFetchedPropertyDescriptionClass struct {
// contains filtered or unexported fields
}
func GetNSFetchedPropertyDescriptionClass ¶
func GetNSFetchedPropertyDescriptionClass() NSFetchedPropertyDescriptionClass
GetNSFetchedPropertyDescriptionClass returns the class object for NSFetchedPropertyDescription.
func (NSFetchedPropertyDescriptionClass) Alloc ¶
func (nc NSFetchedPropertyDescriptionClass) Alloc() NSFetchedPropertyDescription
Alloc allocates memory for a new instance of the class.
func (NSFetchedPropertyDescriptionClass) Class ¶
func (nc NSFetchedPropertyDescriptionClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSFetchedResultsChangeType ¶
type NSFetchedResultsChangeType uint
See: https://developer.apple.com/documentation/CoreData/NSFetchedResultsChangeType
const ( // NSFetchedResultsChangeDelete: Specifies that an object was deleted. NSFetchedResultsChangeDelete NSFetchedResultsChangeType = 2 // NSFetchedResultsChangeInsert: Specifies that an object was inserted. NSFetchedResultsChangeInsert NSFetchedResultsChangeType = 1 // NSFetchedResultsChangeMove: Specifies that an object was moved. NSFetchedResultsChangeMove NSFetchedResultsChangeType = 3 // NSFetchedResultsChangeUpdate: Specifies that an object was changed. NSFetchedResultsChangeUpdate NSFetchedResultsChangeType = 4 )
func (NSFetchedResultsChangeType) String ¶
func (e NSFetchedResultsChangeType) String() string
type NSFetchedResultsController ¶
type NSFetchedResultsController struct {
objectivec.Object
}
A controller that you use to manage the results of a Core Data fetch request and to display data to the user.
Overview ¶
While you can use table views can in several ways, fetched results controllers primarily assist you with a primary list view. UITableView expects its data source to provide cells as an array of sections made up of rows. You configure a fetched results controller using a fetch request — an object that specifies what type of entity to fetch and how to sort the results. You can also add criteria for when to include a specific instance of the entity.
The fetched results controller efficiently analyzes the result of the fetch request and computes all the information about sections in the result set. It also computes all the information for the index based on the result set.
In addition, fetched results controllers:
- Optionally monitor changes to objects in the associated managed object context, and report changes in the results set to its delegate (see NSFetchedResultsController). - Optionally cache the results of its computation to enable redisplaying the same data without repeating the work to fetch it. For more information, see NSFetchedResultsController.
A controller thus effectively has three modes of operation, determined by whether it has a delegate and whether you set the cache file name.
- No tracking: The delegate is `nil`. The controller provides access to the data as it was when it fetched it. - Memory-only tracking: the delegate is non-`nil` and the file cache name is `nil`. The controller monitors objects in its result set and updates section and ordering information in response to relevant changes. - Full persistent tracking: the delegate and the file cache name are non-`nil`. The controller monitors objects in its result set and updates section and ordering information in response to relevant changes. The controller maintains a persistent cache of the results of its computation.
Using NSFetchedResultsController ¶
Creating the fetched results controller ¶
You typically create an instance of NSFetchedResultsController as an instance variable of a table view controller. When you initialize the fetch results controller, you provide four parameters:
- A fetch request. This must contain at least one sort descriptor to order the results. - A managed object context. The controller uses this context to execute the fetch request. - Optionally, a key path on result objects that returns the section name. The controller uses the key path to split the results into sections (passing `nil` indicates that the controller should generate a single section). - Optionally, the name of the cache file the controller should use (passing `nil` prevents caching). Using a cache can avoid the overhead of computing the section and index information.
After creating an instance, you invoke NSFetchedResultsController.PerformFetch to actually execute the fetch:
The controller’s delegate ¶
If you set a delegate for a fetched results controller, the controller registers to receive change notifications from its managed object context. The controller processes any change in the context that affects the result set or section information and updates the results as necessary. The controller notifies the delegate when result objects change location or when changes occur in sections. For more information, see NSFetchedResultsControllerDelegate. You typically use these methods to update the display of the table view.
The cache ¶
Where possible, a controller uses a cache to avoid the need to repeat work performed in setting up any sections and ordering the contents. The system maintains the cache across launches of your application.
When you initialize an instance of NSFetchedResultsController, you typically specify a cache name. If you don’t specify a cache name, the controller doesn’t cache data. When you create a controller, it looks for an existing cache with the given name:
- If the controller can’t find an appropriate cache, it calculates the required sections and the order of objects within sections. It then writes this information to disk. - If it finds a cache with the same name, the controller tests the cache to determine whether its contents are still valid. The controller compares the current entity name, entity version hash, sort descriptors, and section key-path with those stored in the cache, as well as the modification date of the cached information file and the persistent store file.
If the cache is consistent with the current information, the controller reuses the previously-computed information.
If the cache isn’t consistent with the current information, then the controller recomputes the required information and updates the cache.
Any time the section and ordering information change, the controller updates cache.
If you create multiple fetched results controllers with different configurations, such as different sort descriptors, give each configuration a different cache name.
You can purge a cache using NSFetchedResultsControllerClass.DeleteCacheWithName.
Implementing the table view datasource methods ¶
You ask the object to provide relevant information in your implementation of the table view data source methods:
Responding to changes ¶
I[NSFetchedResultsController] responds to changes at the model layer, and informs its delegate when result objects change location or when sections change.
If you allow a user to reorder table rows, then your implementation of the delegate methods must take this into account; see NSFetchedResultsControllerDelegate.
The controller doesn’t show changes until after its managed object context receives a NSManagedObjectContext.ProcessPendingChanges message. Therefore, if you change the value of a managed object’s attribute so that its location in a fetched results controller’s results set changes, its index as reported by the controller won’t typically change until the end of the current event cycle, when the system calls NSManagedObjectContext.ProcessPendingChanges. For example, the following code would log `“same”`:
Modifying the fetch request ¶
You can’t change the fetch request to modify the results. Do the following if you want to change the fetch request:
- Delete the cache if you’re using one, by calling NSFetchedResultsControllerClass.DeleteCacheWithName. - Change the fetch request. - Call NSFetchedResultsController.PerformFetch.
Handling object invalidation ¶
When a managed object context notifies the fetched results controller of invalidated individual objects, the controller treats these as deleted objects and sends the proper delegate calls.
Simultaneous invalidation of all the objects in a managed object context is possible, for example, as a result of calling NSManagedObjectContext.Reset, or if you remove a store from the persistent store coordinator. When this happens, NSFetchedResultsController doesn’t invalidate all objects, nor does it send individual notifications for object deletions. Instead, you need to call NSFetchedResultsController.PerformFetch to reset the state of the controller then reload the data in the table view (reloadData()).
Subclassing notes ¶
You create a subclass of this class if you want to customize the creation of sections and index titles. You override NSFetchedResultsController.SectionIndexTitleForSectionName if you want the section index title to be something other than the capitalized first letter of the section name. You override NSFetchedResultsController.SectionIndexTitles if you want the index titles to be something other than the array created by calling NSFetchedResultsController.SectionIndexTitleForSectionName on all the known sections.
Initializing a Fetched Results Controller ¶
- NSFetchedResultsController.InitWithFetchRequestManagedObjectContextSectionNameKeyPathCacheName: Returns a fetch request controller initialized using the given arguments.
- NSFetchedResultsController.PerformFetch: Executes the controller’s fetch request.
Getting Configuration Information ¶
- NSFetchedResultsController.FetchRequest: The fetch request used to do the fetching.
- NSFetchedResultsController.ManagedObjectContext: The managed object context used to fetch objects.
- NSFetchedResultsController.SectionNameKeyPath: The key path of the attribute that determines which section the fetched entity belongs to.
- NSFetchedResultsController.CacheName: The name of the file used to cache section information.
- NSFetchedResultsController.Delegate: The object that is notified when the fetched results changed.
- NSFetchedResultsController.SetDelegate
Accessing Results ¶
- NSFetchedResultsController.FetchedObjects: The results of the fetch.
- NSFetchedResultsController.ObjectAtIndexPath: Returns the object at the given index path in the fetch results.
- NSFetchedResultsController.IndexPathForObject: Returns the index path of a given object.
Querying Section Information ¶
- NSFetchedResultsController.Sections: The sections for the fetch results.
- NSFetchedResultsController.SectionForSectionIndexTitleAtIndex: Returns the section number for a given section title and index in the section index.
Configuring Section Information ¶
- NSFetchedResultsController.SectionIndexTitleForSectionName: Returns the corresponding section index entry for a given section name.
- NSFetchedResultsController.SectionIndexTitles: The array of section index titles.
See: https://developer.apple.com/documentation/CoreData/NSFetchedResultsController
func NSFetchedResultsControllerFromID ¶
func NSFetchedResultsControllerFromID(id objc.ID) NSFetchedResultsController
NSFetchedResultsControllerFromID constructs a NSFetchedResultsController from an objc.ID.
A controller that you use to manage the results of a Core Data fetch request and to display data to the user.
func NewFetchedResultsControllerWithFetchRequestManagedObjectContextSectionNameKeyPathCacheName ¶
func NewFetchedResultsControllerWithFetchRequestManagedObjectContextSectionNameKeyPathCacheName(fetchRequest INSFetchRequest, context INSManagedObjectContext, sectionNameKeyPath string, name string) NSFetchedResultsController
Returns a fetch request controller initialized using the given arguments.
fetchRequest: The fetch request used to get the objects.
The fetch request must have at least one sort descriptor. If the controller generates sections, the first sort descriptor in the array is used to group the objects into sections; its key must either be the same as `sectionNameKeyPath` or the relative ordering using its key must match that using `sectionNameKeyPath`.
context: The managed object against which `fetchRequest` is executed.
sectionNameKeyPath: A key path on result objects that returns the section name. Pass `nil` to indicate that the controller should generate a single section.
The section name is used to pre-compute the section information.
If this key path is not the same as that specified by the first sort descriptor in `fetchRequest`, they must generate the same relative orderings. For example, the first sort descriptor in `fetchRequest` might specify the key for a persistent property; `sectionNameKeyPath` might specify a key for a transient property derived from the persistent property.
name: The name of the cache file the receiver should use. Pass `nil` to prevent caching.
Pre-computed section info is cached to a private directory under this name. If Core Data finds a cache stored with this name, it is checked to see if it matches the `fetchRequest`. If it does, the cache is loaded directly—this avoids the overhead of computing the section and index information. If the cached information doesn’t match the request, the cache is deleted and recomputed when the fetch happens.
Return Value ¶
The receiver initialized with the specified fetch request, context, key path, and cache name.
func NewNSFetchedResultsController ¶
func NewNSFetchedResultsController() NSFetchedResultsController
NewNSFetchedResultsController creates a new NSFetchedResultsController instance.
func (NSFetchedResultsController) Autorelease ¶
func (f NSFetchedResultsController) Autorelease() NSFetchedResultsController
Autorelease adds the receiver to the current autorelease pool.
func (NSFetchedResultsController) CacheName ¶
func (f NSFetchedResultsController) CacheName() string
The name of the file used to cache section information.
Discussion ¶
The file itself is stored in a private directory; you can only access it by name using NSFetchedResultsControllerClass.DeleteCacheWithName
See: https://developer.apple.com/documentation/CoreData/NSFetchedResultsController/cacheName
func (NSFetchedResultsController) Delegate ¶
func (f NSFetchedResultsController) Delegate() NSFetchedResultsControllerDelegate
The object that is notified when the fetched results changed.
Discussion ¶
If you do not specify a delegate, the controller does not track changes to managed objects associated with its managed object context.
See: https://developer.apple.com/documentation/CoreData/NSFetchedResultsController/delegate
func (NSFetchedResultsController) FetchRequest ¶
func (f NSFetchedResultsController) FetchRequest() INSFetchRequest
The fetch request used to do the fetching.
Discussion ¶
If you want to modify the fetch request, you must follow the steps described in NSFetchedResultsController.
See: https://developer.apple.com/documentation/CoreData/NSFetchedResultsController/fetchRequest
func (NSFetchedResultsController) FetchedObjects ¶
func (f NSFetchedResultsController) FetchedObjects() []objectivec.IObject
The results of the fetch.
Discussion ¶
The value of the property is `nil` if NSFetchedResultsController.PerformFetch hasn’t been called.
The results array only includes instances of the entity specified by the fetch request (NSFetchedResultsController.FetchRequest) and that match its predicate. (If the fetch request has no predicate, then the results array includes all instances of the entity specified by the fetch request.)
The results array reflects the in-memory state of managed objects in the controller’s managed object context, not their state in the persistent store. The returned array does not, however, update as managed objects are inserted, modified, or deleted.
See: https://developer.apple.com/documentation/CoreData/NSFetchedResultsController/fetchedObjects
func (NSFetchedResultsController) IndexPathForObject ¶
func (f NSFetchedResultsController) IndexPathForObject(object unsafe.Pointer) foundation.NSIndexPath
Returns the index path of a given object.
object: An object in the receiver’s fetch results.
Return Value ¶
The index path of `object` in the receiver’s fetch results, or `nil` if `object` could not be found.
Discussion ¶
In versions of iOS before 3.2, this method raises an exception if `object` is not contained in the receiver’s fetch results.
See: https://developer.apple.com/documentation/CoreData/NSFetchedResultsController/indexPath(forObject:)
func (NSFetchedResultsController) Init ¶
func (f NSFetchedResultsController) Init() NSFetchedResultsController
Init initializes the instance.
func (NSFetchedResultsController) InitWithFetchRequestManagedObjectContextSectionNameKeyPathCacheName ¶
func (f NSFetchedResultsController) InitWithFetchRequestManagedObjectContextSectionNameKeyPathCacheName(fetchRequest INSFetchRequest, context INSManagedObjectContext, sectionNameKeyPath string, name string) NSFetchedResultsController
Returns a fetch request controller initialized using the given arguments.
fetchRequest: The fetch request used to get the objects.
The fetch request must have at least one sort descriptor. If the controller generates sections, the first sort descriptor in the array is used to group the objects into sections; its key must either be the same as `sectionNameKeyPath` or the relative ordering using its key must match that using `sectionNameKeyPath`.
context: The managed object against which `fetchRequest` is executed.
sectionNameKeyPath: A key path on result objects that returns the section name. Pass `nil` to indicate that the controller should generate a single section.
The section name is used to pre-compute the section information.
If this key path is not the same as that specified by the first sort descriptor in `fetchRequest`, they must generate the same relative orderings. For example, the first sort descriptor in `fetchRequest` might specify the key for a persistent property; `sectionNameKeyPath` might specify a key for a transient property derived from the persistent property.
name: The name of the cache file the receiver should use. Pass `nil` to prevent caching.
Pre-computed section info is cached to a private directory under this name. If Core Data finds a cache stored with this name, it is checked to see if it matches the `fetchRequest`. If it does, the cache is loaded directly—this avoids the overhead of computing the section and index information. If the cached information doesn’t match the request, the cache is deleted and recomputed when the fetch happens.
Return Value ¶
The receiver initialized with the specified fetch request, context, key path, and cache name.
func (NSFetchedResultsController) ManagedObjectContext ¶
func (f NSFetchedResultsController) ManagedObjectContext() INSManagedObjectContext
The managed object context used to fetch objects.
Discussion ¶
The controller registers to listen to change notifications on this context and properly update its result set and section information.
See: https://developer.apple.com/documentation/CoreData/NSFetchedResultsController/managedObjectContext
func (NSFetchedResultsController) ObjectAtIndexPath ¶
func (f NSFetchedResultsController) ObjectAtIndexPath(indexPath foundation.NSIndexPath) unsafe.Pointer
Returns the object at the given index path in the fetch results.
indexPath: An index path in the fetch results.
If `indexPath` does not describe a valid index path in the fetch results, an exception is raised.
Return Value ¶
The object at a given index path in the fetch results.
See: https://developer.apple.com/documentation/CoreData/NSFetchedResultsController/object(at:)
func (NSFetchedResultsController) PerformFetch ¶
func (f NSFetchedResultsController) PerformFetch() (bool, error)
Executes the controller’s fetch request.
Discussion ¶
After you execute this method, access the controller’s fetched objects using the NSFetchedResultsController.FetchedObjects property.
See: https://developer.apple.com/documentation/CoreData/NSFetchedResultsController/performFetch()
func (NSFetchedResultsController) SectionForSectionIndexTitleAtIndex ¶
func (f NSFetchedResultsController) SectionForSectionIndexTitleAtIndex(title string, sectionIndex int) int
Returns the section number for a given section title and index in the section index.
title: The title of a section
sectionIndex: The index of a section.
Return Value ¶
The section number for the given section title and index in the section index
Discussion ¶
You would typically call this method when executing [UITableViewDataSource]’s tableView(_:sectionForSectionIndexTitle:at:) method.
func (NSFetchedResultsController) SectionIndexTitleForSectionName ¶
func (f NSFetchedResultsController) SectionIndexTitleForSectionName(sectionName string) string
Returns the corresponding section index entry for a given section name.
sectionName: The name of a section.
Return Value ¶
The section index entry corresponding to the section with name `sectionName`.
Discussion ¶
The default implementation returns the capitalized first letter of the section name.
You should override this method if you need a different way to convert from a section name to its name in the section index.
Special Considerations ¶
You only need this method if you use a section index.
func (NSFetchedResultsController) SectionIndexTitles ¶
func (f NSFetchedResultsController) SectionIndexTitles() []string
The array of section index titles.
Discussion ¶
The default implementation returns the array created by calling NSFetchedResultsController.SectionIndexTitleForSectionName on all the known sections. You should override this method if you want to return a different array for the section index.
Special Considerations ¶
You only need this method if you use a section index.
See: https://developer.apple.com/documentation/CoreData/NSFetchedResultsController/sectionIndexTitles
func (NSFetchedResultsController) SectionNameKeyPath ¶
func (f NSFetchedResultsController) SectionNameKeyPath() string
The key path of the attribute that determines which section the fetched entity belongs to.
Discussion ¶
This property returns the value you specify for the `sectionNameKeyPath` parameter when you initialize the fetched results controller.
If the controller generates sections, typically this property’s value matches the specified key path of the first sort descriptor in the controller’s fetch request. If the two key paths don’t match, then they must generate the same relative ordering. For example, the fetch request’s first sort descriptor might specify the key path of a persistent attribute, but NSFetchedResultsController.SectionNameKeyPath might specify the key path of a transient attribute that derives its value from the persistent one.
See: https://developer.apple.com/documentation/CoreData/NSFetchedResultsController/sectionNameKeyPath
func (NSFetchedResultsController) Sections ¶
func (f NSFetchedResultsController) Sections() []objectivec.IObject
The sections for the fetch results.
Discussion ¶
The objects in the sections array implement the NSFetchedResultsSectionInfo protocol.
You typically use the sections array when implementing [UITableViewDataSource] methods, such as numberOfSections(in:) and tableView(_:titleForHeaderInSection:).
See: https://developer.apple.com/documentation/CoreData/NSFetchedResultsController/sections
func (NSFetchedResultsController) SetDelegate ¶
func (f NSFetchedResultsController) SetDelegate(value NSFetchedResultsControllerDelegate)
type NSFetchedResultsControllerClass ¶
type NSFetchedResultsControllerClass struct {
// contains filtered or unexported fields
}
func GetNSFetchedResultsControllerClass ¶
func GetNSFetchedResultsControllerClass() NSFetchedResultsControllerClass
GetNSFetchedResultsControllerClass returns the class object for NSFetchedResultsController.
func (NSFetchedResultsControllerClass) Alloc ¶
func (nc NSFetchedResultsControllerClass) Alloc() NSFetchedResultsController
Alloc allocates memory for a new instance of the class.
func (NSFetchedResultsControllerClass) Class ¶
func (nc NSFetchedResultsControllerClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (NSFetchedResultsControllerClass) DeleteCacheWithName ¶
func (_NSFetchedResultsControllerClass NSFetchedResultsControllerClass) DeleteCacheWithName(name string)
Deletes the cached section information with the given name.
name: The name of the cache file to delete.
If `name` is `nil`, deletes all cache files.
See: https://developer.apple.com/documentation/CoreData/NSFetchedResultsController/deleteCache(withName:)
type NSFetchedResultsControllerDelegate ¶
type NSFetchedResultsControllerDelegate interface {
objectivec.IObject
}
A delegate protocol that describes the methods that the associated fetched results controller calls when the fetch results change.
See: https://developer.apple.com/documentation/CoreData/NSFetchedResultsControllerDelegate
type NSFetchedResultsControllerDelegateConfig ¶
type NSFetchedResultsControllerDelegateConfig struct {
// Responding to Changes
// ControllerWillChangeContent — Notifies the receiver that the fetched results controller is about to start processing of one or more changes due to an add, remove, move, or update.
ControllerWillChangeContent func(controller NSFetchedResultsController)
// ControllerDidChangeContent — Notifies the receiver that the fetched results controller has completed processing of one or more changes due to an add, remove, move, or update.
ControllerDidChangeContent func(controller NSFetchedResultsController)
// Other Methods
// ControllerDidChangeContentWithDifference — Notifies the receiver about changes to the content in the fetched results controller, by using a collection difference.
ControllerDidChangeContentWithDifference func(controller NSFetchedResultsController, diff foundation.NSOrderedCollectionDifference)
}
NSFetchedResultsControllerDelegateConfig holds optional typed callbacks for NSFetchedResultsControllerDelegate methods. Set non-nil fields to register the corresponding Objective-C delegate method. Methods with nil callbacks are not registered, so [NSObject.RespondsToSelector] returns false for them — matching the Objective-C delegate pattern exactly.
See Apple Documentation for protocol details.
type NSFetchedResultsControllerDelegateObject ¶
type NSFetchedResultsControllerDelegateObject struct {
objectivec.Object
}
NSFetchedResultsControllerDelegateObject wraps an existing Objective-C object that conforms to the NSFetchedResultsControllerDelegate protocol.
func NSFetchedResultsControllerDelegateObjectFromID ¶
func NSFetchedResultsControllerDelegateObjectFromID(id objc.ID) NSFetchedResultsControllerDelegateObject
NSFetchedResultsControllerDelegateObjectFromID constructs a NSFetchedResultsControllerDelegateObject from an objc.ID. The object is determined to conform to the protocol at runtime.
func NewNSFetchedResultsControllerDelegate ¶
func NewNSFetchedResultsControllerDelegate(config NSFetchedResultsControllerDelegateConfig) NSFetchedResultsControllerDelegateObject
NewNSFetchedResultsControllerDelegate creates an Objective-C object implementing the NSFetchedResultsControllerDelegate protocol.
Each call registers a unique Objective-C class containing only the methods set in config. This means [NSObject.RespondsToSelector] works correctly for optional delegate methods — only non-nil callbacks are registered.
The returned NSFetchedResultsControllerDelegateObject satisfies the NSFetchedResultsControllerDelegate interface and can be passed directly to SetDelegate and similar methods.
See Apple Documentation for protocol details.
func (NSFetchedResultsControllerDelegateObject) BaseObject ¶
func (o NSFetchedResultsControllerDelegateObject) BaseObject() objectivec.Object
func (NSFetchedResultsControllerDelegateObject) ControllerDidChangeContent ¶
func (o NSFetchedResultsControllerDelegateObject) ControllerDidChangeContent(controller INSFetchedResultsController)
Notifies the receiver that the fetched results controller has completed processing of one or more changes due to an add, remove, move, or update.
controller: The fetched results controller that sent the message.
Discussion ¶
This method is invoked after all invocations of [ControllerDidChangeObjectAtIndexPathForChangeTypeNewIndexPath] and [ControllerDidChangeSectionAtIndexForChangeType] have been sent for a given change event (such as the controller receiving a NSManagedObjectContextDidSave notification).
func (NSFetchedResultsControllerDelegateObject) ControllerDidChangeContentWithDifference ¶
func (o NSFetchedResultsControllerDelegateObject) ControllerDidChangeContentWithDifference(controller INSFetchedResultsController, diff foundation.NSOrderedCollectionDifference)
Notifies the receiver about changes to the content in the fetched results controller, by using a collection difference.
Discussion ¶
This method is only invoked if the controller’s NSFetchedResultsController.SectionNameKeyPath property is `nil` and [ControllerDidChangeContentWithDifference] is not implemented.
If this method is implemented, no other delegate methods are invoked.
func (NSFetchedResultsControllerDelegateObject) ControllerDidChangeContentWithSnapshot ¶
func (o NSFetchedResultsControllerDelegateObject) ControllerDidChangeContentWithSnapshot(controller INSFetchedResultsController, snapshot objectivec.IObject)
Notifies the receiver about changes to the content in the fetched results controller, by using a diffable data source snapshot.
Discussion ¶
To apply the changes, call applySnapshot(_:animatingDifferences:) on the collection or table view’s data source.
If this method is implemented, no other delegate methods are invoked.
func (NSFetchedResultsControllerDelegateObject) ControllerDidChangeObjectAtIndexPathForChangeTypeNewIndexPath ¶
func (o NSFetchedResultsControllerDelegateObject) ControllerDidChangeObjectAtIndexPathForChangeTypeNewIndexPath(controller INSFetchedResultsController, anObject objectivec.IObject, indexPath foundation.NSIndexPath, type_ NSFetchedResultsChangeType, newIndexPath foundation.NSIndexPath)
Notifies the receiver that a fetched object has been changed due to an add, remove, move, or update.
controller: The fetched results controller that sent the message.
anObject: The object in controller’s fetched results that changed.
indexPath: The index path of the changed object (this value is `nil` for insertions).
type: The type of change. For valid values see NSFetchedResultsChangeType.
newIndexPath: The destination path for the object for insertions or moves (this value is `nil` for a deletion).
Discussion ¶
The fetched results controller reports changes to its section before changes to the fetch result objects.
Changes are reported with the following heuristics:
- On add and remove operations, only the added/removed object is reported.
It’s assumed that all objects that come after the affected object are also moved, but these moves are not reported.
- A move is reported when the changed attribute on the object is one of the sort descriptors used in the fetch request.
An update of the object is assumed in this case, but no separate update message is sent to the delegate.
- An update is reported when an object’s state changes, but the changed attributes aren’t part of the sort keys.
Special Considerations ¶
This method may be invoked many times during an update event (for example, if you are importing data on a background thread and adding them to the context in a batch). You should consider carefully whether you want to update the table view on receipt of each message.
func (NSFetchedResultsControllerDelegateObject) ControllerDidChangeSectionAtIndexForChangeType ¶
func (o NSFetchedResultsControllerDelegateObject) ControllerDidChangeSectionAtIndexForChangeType(controller INSFetchedResultsController, sectionInfo NSFetchedResultsSectionInfo, sectionIndex uint, type_ NSFetchedResultsChangeType)
Notifies the receiver of the addition or removal of a section.
controller: The fetched results controller that sent the message.
sectionInfo: The section that changed.
sectionIndex: The index of the changed section.
type: The type of change (insert or delete). Valid values are NSFetchedResultsChangeType.insert and NSFetchedResultsChangeType.delete.
Discussion ¶
The fetched results controller reports changes to its section before changes to the fetched result objects.
Special Considerations ¶
This method may be invoked many times during an update event (for example, if you are importing data on a background thread and adding them to the context in a batch). You should consider carefully whether you want to update the table view on receipt of each message.
func (NSFetchedResultsControllerDelegateObject) ControllerSectionIndexTitleForSectionName ¶
func (o NSFetchedResultsControllerDelegateObject) ControllerSectionIndexTitleForSectionName(controller INSFetchedResultsController, sectionName string) string
Returns the name for a given section.
controller: The fetched results controller that sent the message.
sectionName: The default name of the section.
Return Value ¶
The string to use as the name for the specified section.
Discussion ¶
This method does not enable change tracking. It is only needed if a section index is used.
If the delegate doesn’t implement this method, the default implementation returns the capitalized first letter of the section name (see NSFetchedResultsController.SectionIndexTitleForSectionName in NSFetchedResultsController).
func (NSFetchedResultsControllerDelegateObject) ControllerWillChangeContent ¶
func (o NSFetchedResultsControllerDelegateObject) ControllerWillChangeContent(controller INSFetchedResultsController)
Notifies the receiver that the fetched results controller is about to start processing of one or more changes due to an add, remove, move, or update.
controller: The fetched results controller that sent the message.
Discussion ¶
This method is invoked before all invocations of [ControllerDidChangeObjectAtIndexPathForChangeTypeNewIndexPath] and [ControllerDidChangeSectionAtIndexForChangeType] have been sent for a given change event (such as the controller receiving a NSManagedObjectContextDidSave notification).
type NSFetchedResultsSectionInfo ¶
type NSFetchedResultsSectionInfo interface {
objectivec.IObject
// The number of objects (rows) in the section.
//
// See: https://developer.apple.com/documentation/CoreData/NSFetchedResultsSectionInfo/numberOfObjects
NumberOfObjects() uint
// The array of objects in the section.
//
// See: https://developer.apple.com/documentation/CoreData/NSFetchedResultsSectionInfo/objects
Objects() foundation.INSArray
// The name of the section.
//
// See: https://developer.apple.com/documentation/CoreData/NSFetchedResultsSectionInfo/name
Name() string
// The index title of the section.
//
// See: https://developer.apple.com/documentation/CoreData/NSFetchedResultsSectionInfo/indexTitle
IndexTitle() string
}
A protocol that defines the interface for section objects vended by a fetched results controller.
See: https://developer.apple.com/documentation/CoreData/NSFetchedResultsSectionInfo
type NSFetchedResultsSectionInfoObject ¶
type NSFetchedResultsSectionInfoObject struct {
objectivec.Object
}
NSFetchedResultsSectionInfoObject wraps an existing Objective-C object that conforms to the NSFetchedResultsSectionInfo protocol.
func NSFetchedResultsSectionInfoObjectFromID ¶
func NSFetchedResultsSectionInfoObjectFromID(id objc.ID) NSFetchedResultsSectionInfoObject
NSFetchedResultsSectionInfoObjectFromID constructs a NSFetchedResultsSectionInfoObject from an objc.ID. The object is determined to conform to the protocol at runtime.
func (NSFetchedResultsSectionInfoObject) BaseObject ¶
func (o NSFetchedResultsSectionInfoObject) BaseObject() objectivec.Object
func (NSFetchedResultsSectionInfoObject) IndexTitle ¶
func (o NSFetchedResultsSectionInfoObject) IndexTitle() string
The index title of the section.
Discussion ¶
This is used when displaying the index.
See: https://developer.apple.com/documentation/CoreData/NSFetchedResultsSectionInfo/indexTitle
func (NSFetchedResultsSectionInfoObject) Name ¶
func (o NSFetchedResultsSectionInfoObject) Name() string
The name of the section.
See: https://developer.apple.com/documentation/CoreData/NSFetchedResultsSectionInfo/name
func (NSFetchedResultsSectionInfoObject) NumberOfObjects ¶
func (o NSFetchedResultsSectionInfoObject) NumberOfObjects() uint
The number of objects (rows) in the section.
See: https://developer.apple.com/documentation/CoreData/NSFetchedResultsSectionInfo/numberOfObjects
func (NSFetchedResultsSectionInfoObject) Objects ¶
func (o NSFetchedResultsSectionInfoObject) Objects() foundation.INSArray
The array of objects in the section.
See: https://developer.apple.com/documentation/CoreData/NSFetchedResultsSectionInfo/objects
type NSIncrementalStore ¶
type NSIncrementalStore struct {
NSPersistentStore
}
An abstract superclass defining the API through which Core Data communicates with a store.
Overview ¶
You use this interface to create persistent stores that load and save data incrementally, allowing for the management of large and/or shared datasets.
Subclassing Notes ¶
Methods to Override ¶
In a subclass of NSIncrementalStore, you must override the following methods to provide behavior appropriate for your store:
- [NSIncrementalStore.LoadMetadata] - NSIncrementalStore.ExecuteRequestWithContextError - NSIncrementalStore.NewValuesForObjectWithIDWithContextError - NSIncrementalStore.NewValueForRelationshipForObjectWithIDWithContextError - NSIncrementalStore.ObtainPermanentIDsForObjectsError
You can also optionally override the following methods:
- NSIncrementalStoreClass.IdentifierForNewStoreAtURL - NSIncrementalStore.ManagedObjectContextDidRegisterObjectsWithIDs - NSIncrementalStore.ManagedObjectContextDidUnregisterObjectsWithIDs
There is no need to override the methods that you must otherwise override for a subclass of NSPersistentStore.
Methods that Should Not Be Overridden ¶
In a subclass of NSIncrementalStore, you should not override the following methods:
- NSIncrementalStore.NewObjectIDForEntityReferenceObject - NSIncrementalStore.ReferenceObjectForObjectID
Manipulating Managed Objects ¶
- NSIncrementalStore.ExecuteRequestWithContextError: Returns a value as appropriate for the given request, or nil if the request cannot be completed.
- NSIncrementalStore.NewValuesForObjectWithIDWithContextError: Returns an incremental store node encapsulating the persistent external values of the object with a given object ID.
- NSIncrementalStore.NewValueForRelationshipForObjectWithIDWithContextError: Returns the relationship for the given relationship of the object with a given object ID.
- NSIncrementalStore.ObtainPermanentIDsForObjectsError: Returns an array containing the object IDs for a given array of newly-inserted objects.
- NSIncrementalStore.NewObjectIDForEntityReferenceObject: Returns a new object ID that uses given data as the key.
- NSIncrementalStore.ReferenceObjectForObjectID: Returns the reference data used to construct a given object ID.
Responding to Context Changes ¶
- NSIncrementalStore.ManagedObjectContextDidRegisterObjectsWithIDs: Indicates that objects identified by a given array of object IDs are in use in a managed object context.
- NSIncrementalStore.ManagedObjectContextDidUnregisterObjectsWithIDs: Indicates that objects identified by a given array of object IDs are no longer being used by a managed object context.
See: https://developer.apple.com/documentation/CoreData/NSIncrementalStore
func NSIncrementalStoreFromID ¶
func NSIncrementalStoreFromID(id objc.ID) NSIncrementalStore
NSIncrementalStoreFromID constructs a NSIncrementalStore from an objc.ID.
An abstract superclass defining the API through which Core Data communicates with a store.
func NewIncrementalStoreWithPersistentStoreCoordinatorConfigurationNameURLOptions ¶
func NewIncrementalStoreWithPersistentStoreCoordinatorConfigurationNameURLOptions(root INSPersistentStoreCoordinator, name string, url foundation.NSURL, options foundation.INSDictionary) NSIncrementalStore
Returns a store initialized with the given arguments.
root: A persistent store coordinator.
name: The name of the managed object model configuration to use. Pass `nil` if you do not want to specify a configuration.
url: The URL of the store to load.
options: A dictionary containing configuration options. See NSPersistentStoreCoordinator for a list of key names for options in this dictionary.
Return Value ¶
A new store object, associated with `coordinator`, that represents a persistent store at url using the options in `options` and—if it is not `nil`—the managed object model configuration `configurationName`.
Discussion ¶
You must ensure that you load metadata during initialization and set it using NSPersistentStore.Metadata.
Special Considerations ¶
This is the designated initializer for persistent stores.
func NewNSIncrementalStore ¶
func NewNSIncrementalStore() NSIncrementalStore
NewNSIncrementalStore creates a new NSIncrementalStore instance.
func (NSIncrementalStore) Autorelease ¶
func (i NSIncrementalStore) Autorelease() NSIncrementalStore
Autorelease adds the receiver to the current autorelease pool.
func (NSIncrementalStore) ExecuteRequestWithContextError ¶
func (i NSIncrementalStore) ExecuteRequestWithContextError(request INSPersistentStoreRequest, context INSManagedObjectContext) (objectivec.IObject, error)
Returns a value as appropriate for the given request, or nil if the request cannot be completed.
request: A fetch request.
context: The managed object context used to execute `request`.
Return Value ¶
A value as appropriate for `request`, or `nil` if the request cannot be completed
Discussion ¶
The value to return depends on the result type (see NSFetchRequest.ResultType) of `request`:
- If it is NSManagedObjectResultType, NSManagedObjectIDResultType, or NSDictionaryResultType, the method should return an array containing all objects in the store matching the request. - If it is NSCountResultType, the method should return an array containing an [NSNumber] whose value is the count of all objects in the store matching the request. - If the request is a save request, the method should return an empty array.
If the save request contains nil values for the inserted/updated/deleted/locked collections; you should treat it as a request to save the store metadata.
You should implement this method conservatively, and expect that unknown request types may at some point be passed to the method. The correct behavior in these cases is to return `nil` and an error.
See: https://developer.apple.com/documentation/CoreData/NSIncrementalStore/execute(_:with:)
func (NSIncrementalStore) Init ¶
func (i NSIncrementalStore) Init() NSIncrementalStore
Init initializes the instance.
func (NSIncrementalStore) ManagedObjectContextDidRegisterObjectsWithIDs ¶
func (i NSIncrementalStore) ManagedObjectContextDidRegisterObjectsWithIDs(objectIDs []NSManagedObjectID)
Indicates that objects identified by a given array of object IDs are in use in a managed object context.
objectIDs: An array of object IDs.
Discussion ¶
This method and NSIncrementalStore.ManagedObjectContextDidUnregisterObjectsWithIDs allow managed object contexts to communicate interest in the row data of specific objects in a manner akin to reference counting. For more details, see NSIncrementalStore.ManagedObjectContextDidUnregisterObjectsWithIDs.
func (NSIncrementalStore) ManagedObjectContextDidUnregisterObjectsWithIDs ¶
func (i NSIncrementalStore) ManagedObjectContextDidUnregisterObjectsWithIDs(objectIDs []NSManagedObjectID)
Indicates that objects identified by a given array of object IDs are no longer being used by a managed object context.
objectIDs: An array of object IDs.
Discussion ¶
This method is the counterpart to NSIncrementalStore.ManagedObjectContextDidRegisterObjectsWithIDs.
Passing an object ID in the object IDs array of NSIncrementalStore.ManagedObjectContextDidRegisterObjectsWithIDs is akin to incrementing the object ID’s reference count by 1; passing an object ID in the object IDs array of NSIncrementalStore.ManagedObjectContextDidUnregisterObjectsWithIDs is akin to decrementing the object ID’s reference count by 1. It is only when an object ID’s reference count is 0 that no contexts indicate that they are using the corresponding managed object. (Object IDs start with a reference count of 0.)
For example, if the register methods is invoked on two occasions when the object IDs array contains a given object ID, and the unregister method is invoked once when the object IDs array contains that object ID, then a context is still using the object with the given ID.
func (NSIncrementalStore) NewObjectIDForEntityReferenceObject ¶
func (i NSIncrementalStore) NewObjectIDForEntityReferenceObject(entity INSEntityDescription, data objectivec.IObject) INSManagedObjectID
Returns a new object ID that uses given data as the key.
entity: The entity for the new object ID.
data: An object of type NSString or NSNumber to use as the key.
Return Value ¶
A new object ID for an instance of the entity specified by `entity` and that uses `data` as the key.
Discussion ¶
You should not override this method.
func (NSIncrementalStore) NewValueForRelationshipForObjectWithIDWithContextError ¶
func (i NSIncrementalStore) NewValueForRelationshipForObjectWithIDWithContextError(relationship INSRelationshipDescription, objectID INSManagedObjectID, context INSManagedObjectContext) (objectivec.IObject, error)
Returns the relationship for the given relationship of the object with a given object ID.
relationship: The relationship for which values are requested.
objectID: The ID of the object for which values are requested.
context: The managed object context into which values will be returned.
Return Value ¶
The value of the relationship specified `relationship` of the object with object ID `objectID`, or `nil` if an error occurs.
Discussion ¶
If the relationship is a to-one, the method should return an NSManagedObjectID instance that identifies the destination, or an instance of NSNull if the relationship value is `nil`.
If the relationship is a to-many, the method should return a collection object containing NSManagedObjectID instances to identify the related objects. Using an [NSArray] instance is preferred because it will be the most efficient. A store may also return an instance of [NSSet] or [NSOrderedSet]; an instance of [NSDictionary] is not acceptable.
If an object with object ID `objectID` cannot be found, the method should return `nil` and—if `error` is not [NULL]—create and return an appropriate error object in `error`.
func (NSIncrementalStore) NewValuesForObjectWithIDWithContextError ¶
func (i NSIncrementalStore) NewValuesForObjectWithIDWithContextError(objectID INSManagedObjectID, context INSManagedObjectContext) (INSIncrementalStoreNode, error)
Returns an incremental store node encapsulating the persistent external values of the object with a given object ID.
objectID: The ID of the object for which values are requested.
context: The managed object context into which values will be returned.
Return Value ¶
An incremental store node encapsulating the persistent external values of the object with object ID `objectID`, or `nil` if the corresponding object cannot be found.
Discussion ¶
The returned node should include all attributes values and may include to-one relationship values as instances of NSManagedObjectID.
If an object with object ID `objectID` cannot be found, the method should return `nil` and—if `error` is not [NULL]—create and return an appropriate error object in `error`.
See: https://developer.apple.com/documentation/CoreData/NSIncrementalStore/newValuesForObject(with:with:)
func (NSIncrementalStore) ObtainPermanentIDsForObjectsError ¶
func (i NSIncrementalStore) ObtainPermanentIDsForObjectsError(array []NSManagedObject) ([]NSManagedObjectID, error)
Returns an array containing the object IDs for a given array of newly-inserted objects.
array: An array of newly-inserted objects.
Return Value ¶
An array containing the object IDs for the objects in `array`.
Discussion ¶
The returned array must return the object IDs in the same order as the objects appear in `array`.
Discussion ¶
This method is called before NSIncrementalStore.ExecuteRequestWithContextError with a save request, to assign permanent IDs to newly-inserted objects.
See: https://developer.apple.com/documentation/CoreData/NSIncrementalStore/obtainPermanentIDs(for:)
func (NSIncrementalStore) ReferenceObjectForObjectID ¶
func (i NSIncrementalStore) ReferenceObjectForObjectID(objectID INSManagedObjectID) objectivec.IObject
Returns the reference data used to construct a given object ID.
objectID: An object ID created by the receiver.
Return Value ¶
The reference data used to construct objectID.
Discussion ¶
This method raises an invalidArgumentException if the object ID was not created by the receiving store.
You should not override this method.
See: https://developer.apple.com/documentation/CoreData/NSIncrementalStore/referenceObject(for:)
type NSIncrementalStoreClass ¶
type NSIncrementalStoreClass struct {
// contains filtered or unexported fields
}
func GetNSIncrementalStoreClass ¶
func GetNSIncrementalStoreClass() NSIncrementalStoreClass
GetNSIncrementalStoreClass returns the class object for NSIncrementalStore.
func (NSIncrementalStoreClass) Alloc ¶
func (nc NSIncrementalStoreClass) Alloc() NSIncrementalStore
Alloc allocates memory for a new instance of the class.
func (NSIncrementalStoreClass) Class ¶
func (nc NSIncrementalStoreClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (NSIncrementalStoreClass) IdentifierForNewStoreAtURL ¶
func (_NSIncrementalStoreClass NSIncrementalStoreClass) IdentifierForNewStoreAtURL(storeURL foundation.NSURL) objectivec.IObject
Returns the identifier for the store at a given URL.
storeURL: The URL of a persistent store.
Return Value ¶
The identifier for the store at `storeURL`.
See: https://developer.apple.com/documentation/CoreData/NSIncrementalStore/identifierForNewStore(at:)
type NSIncrementalStoreNode ¶
type NSIncrementalStoreNode struct {
objectivec.Object
}
A concrete class used to represent basic nodes in a Core Data incremental store.
Overview ¶
A node represents a single record in a persistent store.
You can subclass NSIncrementalStoreNode to provide custom behavior.
Initializing a Node ¶
- NSIncrementalStoreNode.InitWithObjectIDWithValuesVersion: Returns an object initialized with the given values.
Managing Node Data ¶
- NSIncrementalStoreNode.ObjectID: The object ID that identifies the data stored by the receiver.
- NSIncrementalStoreNode.UpdateWithValuesVersion: Update the values and version to reflect new data being saved to or loaded from the external store.
- NSIncrementalStoreNode.ValueForPropertyDescription: Returns the value for the given property.
- NSIncrementalStoreNode.Version: The version of data in the receiver.
See: https://developer.apple.com/documentation/CoreData/NSIncrementalStoreNode
func NSIncrementalStoreNodeFromID ¶
func NSIncrementalStoreNodeFromID(id objc.ID) NSIncrementalStoreNode
NSIncrementalStoreNodeFromID constructs a NSIncrementalStoreNode from an objc.ID.
A concrete class used to represent basic nodes in a Core Data incremental store.
func NewIncrementalStoreNodeWithObjectIDWithValuesVersion ¶
func NewIncrementalStoreNodeWithObjectIDWithValuesVersion(objectID INSManagedObjectID, values foundation.INSDictionary, version uint64) NSIncrementalStoreNode
Returns an object initialized with the given values.
objectID: A managed object ID.
values: A dictionary containing the values persisted in an external store with keys corresponding to the names of the property description in the NSEntityDescription object described by `objectID`:
- For attributes: an immutable value (an instance of a value class such as [NSNumber], [NSString], [NSData]). Missing attribute keys will assume a nil value. - For to-one relationships: the managed object ID of the related object or an instance of [NSNull] for nil relationship values. A missing key will be resolved lazily through calling “ on the NSPersistentStore object. Lazy resolution for to-one relationships is discouraged. - For to-many relationships: an instance of [NSArray] or [NSSet] containing the managed object IDs of the related objects. Empty to-many relationships must be represented by an empty non-nil collection. A missing key will be resolved lazily through calling “ on the NSPersistentStore object. Lazy resolution for to-many relationships is encouraged.
Unknown or unmodeled keys are stripped out.
version: The revision number of this state. This value is used for conflict detection and merging.
Return Value ¶
An object initialized with the given values.
func NewNSIncrementalStoreNode ¶
func NewNSIncrementalStoreNode() NSIncrementalStoreNode
NewNSIncrementalStoreNode creates a new NSIncrementalStoreNode instance.
func (NSIncrementalStoreNode) Autorelease ¶
func (i NSIncrementalStoreNode) Autorelease() NSIncrementalStoreNode
Autorelease adds the receiver to the current autorelease pool.
func (NSIncrementalStoreNode) Init ¶
func (i NSIncrementalStoreNode) Init() NSIncrementalStoreNode
Init initializes the instance.
func (NSIncrementalStoreNode) InitWithObjectIDWithValuesVersion ¶
func (i NSIncrementalStoreNode) InitWithObjectIDWithValuesVersion(objectID INSManagedObjectID, values foundation.INSDictionary, version uint64) NSIncrementalStoreNode
Returns an object initialized with the given values.
objectID: A managed object ID.
values: A dictionary containing the values persisted in an external store with keys corresponding to the names of the property description in the NSEntityDescription object described by `objectID`:
- For attributes: an immutable value (an instance of a value class such as [NSNumber], [NSString], [NSData]). Missing attribute keys will assume a nil value. - For to-one relationships: the managed object ID of the related object or an instance of [NSNull] for nil relationship values. A missing key will be resolved lazily through calling “ on the NSPersistentStore object. Lazy resolution for to-one relationships is discouraged. - For to-many relationships: an instance of [NSArray] or [NSSet] containing the managed object IDs of the related objects. Empty to-many relationships must be represented by an empty non-nil collection. A missing key will be resolved lazily through calling “ on the NSPersistentStore object. Lazy resolution for to-many relationships is encouraged.
Unknown or unmodeled keys are stripped out.
version: The revision number of this state. This value is used for conflict detection and merging.
Return Value ¶
An object initialized with the given values.
func (NSIncrementalStoreNode) ObjectID ¶
func (i NSIncrementalStoreNode) ObjectID() INSManagedObjectID
The object ID that identifies the data stored by the receiver.
See: https://developer.apple.com/documentation/CoreData/NSIncrementalStoreNode/objectID
func (NSIncrementalStoreNode) UpdateWithValuesVersion ¶
func (i NSIncrementalStoreNode) UpdateWithValuesVersion(values foundation.INSDictionary, version uint64)
Update the values and version to reflect new data being saved to or loaded from the external store.
values: A dictionary containing updated values, in the same format as that described in NSIncrementalStoreNode.InitWithObjectIDWithValuesVersion.
version: The version number for the transaction.
Discussion ¶
Update the values and version to reflect new data being saved to or loaded from the external store. // The values dictionary is in the same format as the initializer
func (NSIncrementalStoreNode) ValueForPropertyDescription ¶
func (i NSIncrementalStoreNode) ValueForPropertyDescription(prop INSPropertyDescription) objectivec.IObject
Returns the value for the given property.
prop: A property description for one of the properties in the receiver.
Return Value ¶
The value for the property specified by `prop`. May return an instance of [NSNull] for to-one relationships.
Discussion ¶
If a relationship is `nil`, you should create a new value by invoking “ on the NSPersistentStore object.
See: https://developer.apple.com/documentation/CoreData/NSIncrementalStoreNode/value(for:)
func (NSIncrementalStoreNode) Version ¶
func (i NSIncrementalStoreNode) Version() uint64
The version of data in the receiver.
Discussion ¶
The version number is used by the persistent store coordinator to detect and handle merge conflicts. The version number should be stored with the record. The version number should (implicitly) start at zero (where zero indicates an unsaved object in memory) and be incremented by exactly one every time you save. In addition, you increment the version number when you or the Core Data framework have marked the associated managed object for optimistic locking.
See: https://developer.apple.com/documentation/CoreData/NSIncrementalStoreNode/version
type NSIncrementalStoreNodeClass ¶
type NSIncrementalStoreNodeClass struct {
// contains filtered or unexported fields
}
func GetNSIncrementalStoreNodeClass ¶
func GetNSIncrementalStoreNodeClass() NSIncrementalStoreNodeClass
GetNSIncrementalStoreNodeClass returns the class object for NSIncrementalStoreNode.
func (NSIncrementalStoreNodeClass) Alloc ¶
func (nc NSIncrementalStoreNodeClass) Alloc() NSIncrementalStoreNode
Alloc allocates memory for a new instance of the class.
func (NSIncrementalStoreNodeClass) Class ¶
func (nc NSIncrementalStoreNodeClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSLightweightMigrationStage ¶
type NSLightweightMigrationStage struct {
NSMigrationStage
}
An object that describes a series of models suitable for lightweight migration.
Overview ¶
Use NSLightweightMigrationStage when you have a series of models to migrate and those models are compatible with lightweight migrations. Instances of this class supplement your custom migration stages and help maintain a consistent stage order for the entire migration.
Accessing the checksums ¶
- NSLightweightMigrationStage.VersionChecksums: The array of version checksums.
See: https://developer.apple.com/documentation/CoreData/NSLightweightMigrationStage
func NSLightweightMigrationStageFromID ¶
func NSLightweightMigrationStageFromID(id objc.ID) NSLightweightMigrationStage
NSLightweightMigrationStageFromID constructs a NSLightweightMigrationStage from an objc.ID.
An object that describes a series of models suitable for lightweight migration.
func NewNSLightweightMigrationStage ¶
func NewNSLightweightMigrationStage() NSLightweightMigrationStage
NewNSLightweightMigrationStage creates a new NSLightweightMigrationStage instance.
func (NSLightweightMigrationStage) Autorelease ¶
func (l NSLightweightMigrationStage) Autorelease() NSLightweightMigrationStage
Autorelease adds the receiver to the current autorelease pool.
func (NSLightweightMigrationStage) Init ¶
func (l NSLightweightMigrationStage) Init() NSLightweightMigrationStage
Init initializes the instance.
func (NSLightweightMigrationStage) VersionChecksums ¶
func (l NSLightweightMigrationStage) VersionChecksums() []string
The array of version checksums.
Discussion ¶
Core Data sets this property to the checksum you specify when creating the lightweight migration stage.
See: https://developer.apple.com/documentation/CoreData/NSLightweightMigrationStage/versionChecksums
type NSLightweightMigrationStageClass ¶
type NSLightweightMigrationStageClass struct {
// contains filtered or unexported fields
}
func GetNSLightweightMigrationStageClass ¶
func GetNSLightweightMigrationStageClass() NSLightweightMigrationStageClass
GetNSLightweightMigrationStageClass returns the class object for NSLightweightMigrationStage.
func (NSLightweightMigrationStageClass) Alloc ¶
func (nc NSLightweightMigrationStageClass) Alloc() NSLightweightMigrationStage
Alloc allocates memory for a new instance of the class.
func (NSLightweightMigrationStageClass) Class ¶
func (nc NSLightweightMigrationStageClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSManagedObject ¶
type NSManagedObject struct {
objectivec.Object
}
The base class that all Core Data model objects inherit from.
Overview ¶
A managed object has an associated entity description (NSEntityDescription) that provides metadata about the object, including the name of the entity that the object represents and the names of its attributes and relationships. A managed object also has an associated managed object context that tracks changes to the object graph.
You can’t use instances of direct subclasses of NSObject, or any other class that doesn’t inherit from NSManagedObject, with a managed object context. You may create custom subclasses of NSManagedObject, although this isn’t always necessary. If you don’t need custom logic, you can create a complete object graph with NSManagedObject instances.
If you instantiate a managed object directly, you must call the designated initializer NSManagedObject.InitWithEntityInsertIntoManagedObjectContext.
Data Storage ¶
In some respects, an NSManagedObject acts like a dictionary—it’s a generic container object that provides efficient storage for the properties defined by its associated NSEntityDescription instance. NSManagedObject supports a range of common types for attribute values, including string, date, and number (see NSAttributeDescription for full details). Therefore, typically you don’t need to define instance variables in subclasses. Sometimes, however, you want to use types that aren’t supported directly, such as colors and C structures. For example, in a graphics application you might want to define a Rectangle entity that has color and bounds attributes that are an instance of [NSColor] and an [NSRect] struct, respectively. For some types you can use a transformable attribute, for others this may require you to create a subclass of NSManagedObject.
Faulting ¶
Managed objects typically represent data held in a persistent store. In some situations a managed object may be a fault—an object whose property values haven’t yet been loaded from the external data store. When you access persistent property values, the fault “fires” and the data is retrieved from the store automatically. This can be a comparatively expensive process (potentially requiring a round trip to the persistent store), and you may wish to avoid unnecessarily firing a fault. See Faulting and Uniquing for more details on faults.
You can safely invoke the following methods and properties on a fault without causing it to fire: isEqual(_:), hash, superclass, class, self(), isProxy(), isKind(of:), isMember(of:), conforms(to:), responds(to:), description, NSManagedObject.ManagedObjectContext, NSManagedObject.Entity, NSManagedObject.ObjectID, [NSManagedObject.Inserted], [NSManagedObject.Updated], [NSManagedObject.Deleted], NSManagedObject.FaultingState, and [NSManagedObject.Fault]. Because `isEqual` and `hash` don’t cause a fault to fire, managed objects can typically be placed in collections without firing a fault. Note, however, that invoking key-value coding methods on the collection object might in turn result in an invocation of “ on a managed object, which would fire the fault.
Although the `description` property doesn’t cause a fault to fire, if you implement a custom `description` that accesses the object’s persistent properties, this does cause a fault to fire. You are strongly discouraged from overriding `description` in this way.
Subclassing Notes ¶
In combination with the entity description in the managed object model, NSManagedObject provides a rich set of default behaviors including support for arbitrary properties and value validation. If you decide to subclass NSManagedObject to implement custom features, make sure you don’t disrupt Core Data’s behavior.
Methods and Properties You Must Not Override ¶
NSManagedObject itself customizes many features of NSObject so that managed objects can be properly integrated into the Core Data infrastructure. Core Data relies on the NSManagedObject implementation of the following methods and properties, which you therefore absolutely must not override: NSManagedObject.PrimitiveValueForKey, NSManagedObject.SetPrimitiveValueForKey, isEqual(_:), hash, superclass, class, self(), isProxy(), isKind(of:), isMember(of:), conforms(to:), responds(to:), NSManagedObject.ManagedObjectContext, NSManagedObject.Entity, NSManagedObject.ObjectID, [NSManagedObject.Inserted], [NSManagedObject.Updated], [NSManagedObject.Deleted], and [NSManagedObject.Fault], alloc, allocWithZone:, new, instancesRespond(to:), instanceMethod(for:), method(for:), methodSignatureForSelector:, instanceMethodSignatureForSelector:, or isSubclass(of:).
Methods and Properties You Shouldn’t Override ¶
As with any class, you are strongly discouraged from overriding the key-value observing methods such as willChangeValue(forKey:) and didChangeValue(forKey:withSetMutation:using:). Avoid overriding `description`—if this method fires a fault during a debugging operation, the results may be unpredictable. Also avoid overriding NSManagedObject.InitWithEntityInsertIntoManagedObjectContext, or `dealloc`. Changing values in the NSManagedObject.InitWithEntityInsertIntoManagedObjectContext method won’t be noticed by the context, and if you aren’t careful, those changes may not be saved. Perform most initialization customization in one of the `awake…` methods. If you do override NSManagedObject.InitWithEntityInsertIntoManagedObjectContext, make sure you adhere to the requirements set out in the method description. See NSManagedObject.InitWithEntityInsertIntoManagedObjectContext.
Don’t override `dealloc` because NSManagedObject.DidTurnIntoFault is usually a better time to clear values—a managed object may not be reclaimed for some time after it has been turned into a fault. Core Data doesn’t guarantee that `dealloc` will be called in all scenarios (such as when the application quits). Therefore, don’t include required side effects (like saving or changes to the file system, user preferences, and so on) in these methods.
In summary, for NSManagedObject.InitWithEntityInsertIntoManagedObjectContext and `dealloc`, Core Data reserves exclusive control over the life cycle of the managed object (that is, raw memory management). This is so that the framework can provide features such as uniquing and by consequence, relationship maintenance, as well as much better performance than would be possible otherwise.
Additional Override Considerations ¶
The following methods are intended to be fine grained and aren’t suitable for large-scale operations. Don’t fetch or save in these methods. In particular, they shouldn’t have side effects on the managed object context.
- NSManagedObject.InitWithEntityInsertIntoManagedObjectContext - NSManagedObject.DidTurnIntoFault - NSManagedObject.WillTurnIntoFault - `dealloc`
In addition, if you plan to override `awakeFromInsert`, `awakeFromFetch`, and validation methods, first invoke `super.Method()`, the superclass’s implementation. Don’t modify relationships in NSManagedObject.AwakeFromFetch—see the method description for details.
Custom Accessor Methods ¶
Typically, you don’t need to write custom accessor methods for properties that are defined in the entity of a managed object’s corresponding managed object model. If you need to do so, follow the implementation patterns described in Managed Object Accessor Methods in Core Data Programming Guide.
Core Data automatically generates accessor methods (and primitive accessor methods) for you. For attributes and to-one relationships, Core Data generates the standard get and set accessor methods; for to-many relationships, Core Data generates the indexed accessor methods as described in Achieving Basic Key-Value Coding Compliance in Key-Value Coding Programming Guide. You do however need to declare the accessor methods or use Objective-C properties to suppress compiler warnings. For a full discussion, see Managed Object Accessor Methods in Core Data Programming Guide.
Custom Instance Variables ¶
By default, NSManagedObject stores its properties in an internal structure as objects, and in general Core Data is more efficient working with storage under its own control rather than by using custom instance variables.
NSManagedObject provides support for a range of common types for attribute values, including string, date, and number (see NSAttributeDescription for full details). If you want to use types that aren’t supported directly, like colors and C structures, you can either use transformable attributes or create a subclass of NSManagedObject.
Sometimes it’s convenient to represent variables as scalars—in drawing applications, for example, where variables represent dimensions and x and y coordinates and are frequently used in calculations. To represent attributes as scalars, you declare instance variables as you do in any other class. You also need to implement suitable accessor methods as described in Managed Object Accessor Methods.
If you define custom instance variables for example to store derived attributes or other transient properties, clean up these variables in NSManagedObject.DidTurnIntoFault rather than `dealloc`.
Validation Methods ¶
NSManagedObject provides consistent hooks for validating property and inter-property values. You typically shouldn’t override [NSManagedObject.ValidateValueForKeyError]. Instead implement methods of the form `validate:`, as defined by the NSKeyValueCoding protocol. If you want to validate inter-property values, you can override NSManagedObject.ValidateForUpdate and/or related validation methods.
Don’t call “ within custom property validation methods—if you do, you create an infinite loop when “ is invoked at runtime. If you do implement custom validation methods, don’t call them directly. Instead, call “ with the appropriate key. This ensures that any constraints defined in the managed object model are applied.
If you implement custom inter-property validation methods like NSManagedObject.ValidateForUpdate, call the superclass’s implementation first. This ensures that individual property validation methods are also invoked. If there are multiple validation failures in one operation, collect them in an array and add the array—using the key [NSDetailedErrorsKey]—to the userInfo dictionary in the [NSError] object you return. For an example, see Managed Object Validation.
Creating a Managed Object ¶
- NSManagedObject.InitWithEntityInsertIntoManagedObjectContext: Initializes a managed object from an entity description and inserts it into the specified managed object context.
- NSManagedObject.InitWithContext: Initializes a managed object subclass and inserts it into the specified managed object context.
Getting a Managed Object’s Identity ¶
- NSManagedObject.Entity: The entity description of the managed object.
- NSManagedObject.ObjectID: The object ID of the managed object.
Getting State Information ¶
- NSManagedObject.ManagedObjectContext: The managed object context with which the managed object is registered.
- NSManagedObject.HasChanges: A Boolean value that indicates whether the managed object has been inserted, has been deleted, or has unsaved changes.
- NSManagedObject.IsInserted: A Boolean value that indicates whether the managed object has been inserted in a managed object context.
- NSManagedObject.IsUpdated: A Boolean value that indicates whether the managed object has unsaved changes.
- NSManagedObject.IsDeleted: A Boolean value that indicates whether the managed object will be deleted during the next save.
- NSManagedObject.IsFault: A Boolean value that indicates whether the managed object is a fault.
- NSManagedObject.FaultingState: The faulting state of the managed object.
- NSManagedObject.HasFaultForRelationshipNamed: Returns a Boolean value that indicates whether the relationship for a given key is a fault.
- NSManagedObject.HasPersistentChangedValues: A Boolean value that indicates whether the managed object has persistent changes.
Managing Change Events ¶
- NSManagedObject.AwakeFromFetch: Provides an opportunity to add code into the life cycle of the managed object when fufilling it from a fault.
- NSManagedObject.AwakeFromInsert: Provides an opportunity to add code into the life cycle of the managed object when initially creating it.
- NSManagedObject.AwakeFromSnapshotEvents: Provides an opportunity to add code into the life cycle of the managed object when fulfilling it from a snapshot.
- NSManagedObject.ChangedValues: Returns a dictionary containing the keys and new values of persistent properties with changes since the last fetching or saving of the managed object.
- NSManagedObject.ChangedValuesForCurrentEvent: Returns a dictionary containing the keys and new values of persistent properties with changes since the last fetching or saving of the managed object.
- NSManagedObject.CommittedValuesForKeys: Returns a dictionary of the most recent fetched or saved values of the managed object for the properties of the specified keys.
- NSManagedObject.PrepareForDeletion: Provides an opportunity to add code into the life cycle of the managed object before deleting it.
- NSManagedObject.WillSave: Provides an opportunity to add code into the life cycle of the managed object before saving it.
- NSManagedObject.DidSave: Provides an opportunity to add code into the life cycle of the managed object after the managed object’s context completes a save operation.
- NSManagedObject.WillTurnIntoFault: Provides an opportunity to add code into the life cycle of the managed object before converting it to a fault.
- NSManagedObject.DidTurnIntoFault: Provides an opportunity to add code into the life cycle of the managed object after converting it to a fault.
Supporting Key-Value Coding ¶
- NSManagedObject.PrimitiveValueForKey: Returns the value for the specified property from the managed object’s private internal storage .
- NSManagedObject.SetPrimitiveValueForKey: Sets the value of a given property in the managed object’s private internal storage.
- NSManagedObject.ObjectIDsForRelationshipNamed: Returns the object IDs for all of the managed objects that are in the named relationship.
Managing Data Validation ¶
- NSManagedObject.ValidateForDelete: Determines whether the managed object can be deleted in its current state.
- NSManagedObject.ValidateForInsert: Determines whether the managed object can be inserted in its current state.
- NSManagedObject.ValidateForUpdate: Determines whether the managed object’s current state is valid.
Supporting Key-Value Observing ¶
- NSManagedObject.DidAccessValueForKey: Provides support for key-value observing access notification.
- NSManagedObject.ObservationInfo: Returns the observation info of the managed object.
- NSManagedObject.SetObservationInfo: Sets the observation info of the managed object.
- NSManagedObject.WillAccessValueForKey: Provides support for key-value observing access notification.
- NSManagedObject.DidChangeValueForKeyWithSetMutationUsingObjects: Provides an opportunity to respond when a change was made to a specified to-many relationship.
- NSManagedObject.WillChangeValueForKeyWithSetMutationUsingObjects: Provides an opportunity to respond when a change is about to be made to a specified to-many relationship.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject
func NSManagedObjectFromID ¶
func NSManagedObjectFromID(id objc.ID) NSManagedObject
NSManagedObjectFromID constructs a NSManagedObject from an objc.ID.
The base class that all Core Data model objects inherit from.
func NewManagedObjectWithContext ¶
func NewManagedObjectWithContext(moc INSManagedObjectContext) NSManagedObject
Initializes a managed object subclass and inserts it into the specified managed object context.
Return Value ¶
An initialized instance of the appropriate subclass.
Discussion ¶
This method is only legal to call on subclasses of NSManagedObject that represent a single entity in the model.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/init(context:)
func NewManagedObjectWithEntityInsertIntoManagedObjectContext ¶
func NewManagedObjectWithEntityInsertIntoManagedObjectContext(entity INSEntityDescription, context INSManagedObjectContext) NSManagedObject
Initializes a managed object from an entity description and inserts it into the specified managed object context.
entity: The entity of which to create an instance.
The model associated with `context`’s persistent store coordinator must contain `entity`.
context: The context into which the new instance is inserted.
Return Value ¶
An initialized instance of the appropriate class for `entity`.
Discussion ¶
NSManagedObject uses dynamic class generation to support the Objective-C 2 properties feature (see Declared Properties) by automatically creating a subclass of the class appropriate for `entity`. “ therefore returns an instance of the appropriate class for `entity`. The dynamically-generated subclass will be based on the class specified by the entity, so specifying a custom class in your model will supersede the class passed to `alloc`.
If `context` is not `nil`, this method invokes `[context self]` (which causes NSManagedObject.AwakeFromInsert to be invoked).
You are discouraged from overriding this method—you should instead override NSManagedObject.AwakeFromInsert and/or NSManagedObject.AwakeFromFetch (if there is logic common to these methods, it should be factored into a third method which is invoked from both). If you do perform custom initialization in this method, you may cause problems with undo and redo operations.
In many applications, there is no need to subsequently assign a newly-created managed object to a particular store—see NSManagedObjectContext.AssignObjectToPersistentStore. If your application has multiple stores and you do need to assign an object to a specific store, you should not do so in a managed object’s initializer method. Such an assignment is controller- not model-level logic.
Special Considerations ¶
If you override NSManagedObject.InitWithEntityInsertIntoManagedObjectContext, you must ensure that you set `self` to the return value from invocation of `super`’s implementation, as shown in the following example:
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/init(entity:insertInto:)
func NewNSManagedObject ¶
func NewNSManagedObject() NSManagedObject
NewNSManagedObject creates a new NSManagedObject instance.
func (NSManagedObject) Autorelease ¶
func (m NSManagedObject) Autorelease() NSManagedObject
Autorelease adds the receiver to the current autorelease pool.
func (NSManagedObject) AwakeFromFetch ¶
func (m NSManagedObject) AwakeFromFetch()
Provides an opportunity to add code into the life cycle of the managed object when fufilling it from a fault.
Discussion ¶
You typically use this method to compute derived values or to recreate transient relationships from the receiver’s persistent properties.
The managed object context’s change processing is explicitly disabled around this method so that you can use public setters to establish transient values and other caches without dirtying the object or its context. Because of this, however, you should not modify relationships in this method as the inverse will not be set.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/awakeFromFetch()
func (NSManagedObject) AwakeFromInsert ¶
func (m NSManagedObject) AwakeFromInsert()
Provides an opportunity to add code into the life cycle of the managed object when initially creating it.
Discussion ¶
You typically use this method to initialize special default property values. This method is invoked only once in the object’s lifetime.
If you want to set attribute values in an implementation of this method, you should typically use primitive accessor methods (either NSManagedObject.SetPrimitiveValueForKey or—better—the appropriate custom primitive accessors). This ensures that the new values are treated as baseline values rather than being recorded as undoable changes for the properties in question.
Special Considerations ¶
If you create a managed object then perform undo operations to bring the managed object context to a state prior to the object’s creation, then perform redo operations to bring the managed object context back to a state after the object’s creation, NSManagedObject.AwakeFromInsert is not invoked a second time.
You are typically discouraged from performing fetches within an implementation of NSManagedObject.AwakeFromInsert. Although it is allowed, execution of the fetch request can trigger the sending of internal Core Data notifications which may have unwanted side-effects. For example, in macOS, an instance of NSArrayController may end up inserting a new object into its content array twice.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/awakeFromInsert()
func (NSManagedObject) AwakeFromSnapshotEvents ¶
func (m NSManagedObject) AwakeFromSnapshotEvents(flags NSSnapshotEventType)
Provides an opportunity to add code into the life cycle of the managed object when fulfilling it from a snapshot.
flags: A bit mask of [NSManagedObject.DidChangeValueForKey] constants to denote the event or events that led to the method being invoked.
For possible values, see NSSnapshotEventType.
Discussion ¶
You typically use this method to compute derived values or to recreate transient relationships from the receiver’s persistent properties.
If you want to set attribute values and need to avoid emitting key-value observation change notifications, you should use primitive accessor methods (either NSManagedObject.SetPrimitiveValueForKey or—better—the appropriate custom primitive accessors). This ensures that the new values are treated as baseline values rather than being recorded as undoable changes for the properties in question.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/awake(fromSnapshotEvents:)
func (NSManagedObject) ChangedValues ¶
func (m NSManagedObject) ChangedValues() foundation.INSDictionary
Returns a dictionary containing the keys and new values of persistent properties with changes since the last fetching or saving of the managed object.
Return Value ¶
A dictionary with keys that are the names of persistent properties with changes since last fetching or saving the receiver, and with the new values for those properties.
Discussion ¶
This method only reports changes to properties that are persistent properties of the receiver, not changes to transient properties or custom instance variables.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/changedValues()
func (NSManagedObject) ChangedValuesForCurrentEvent ¶
func (m NSManagedObject) ChangedValuesForCurrentEvent() foundation.INSDictionary
Returns a dictionary containing the keys and new values of persistent properties with changes since the last fetching or saving of the managed object.
Return Value ¶
A dictionary with keys that are the names of persistent properties with changes since the last posting of NSManagedObjectContextObjectsDidChange, and with the new values for those properties.
Discussion ¶
This method only reports changes to properties that are persistent properties of the receiver, not changes to transient properties or custom instance variables.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/changedValuesForCurrentEvent()
func (NSManagedObject) CommittedValuesForKeys ¶
func (m NSManagedObject) CommittedValuesForKeys(keys []string) foundation.INSDictionary
Returns a dictionary of the most recent fetched or saved values of the managed object for the properties of the specified keys.
keys: An array containing names of properties of the receiver, or `nil`.
Return Value ¶
A dictionary containing the last fetched or saved values of the receiver for the properties specified by `keys`.
Discussion ¶
`nil` values are represented by an instance of NSNull.
This method only reports values of properties that are defined as persistent properties of the receiver, not values of transient properties or of custom instance variables.
You can invoke this method with the `keys` value of `nil` to retrieve committed values for all the receiver’s properties, as illustrated by the following example.
It is more efficient to use `nil` than to pass an array of all the property keys.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/committedValues(forKeys:)
func (NSManagedObject) DidAccessValueForKey ¶
func (m NSManagedObject) DidAccessValueForKey(key string)
Provides support for key-value observing access notification.
key: The name of one of the receiver’s properties.
Discussion ¶
Together with NSManagedObject.WillAccessValueForKey, this method is used to fire faults, to maintain inverse relationships, and so on. Each read access must be wrapped in this method pair (in the same way that each write access must be wrapped in the “/“ method pair). In the default implementation of NSManagedObject these methods are invoked for you automatically. If, say, you create a custom subclass that uses explicit instance variables, you must invoke them yourself, as in the following example.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/didAccessValue(forKey:)
func (NSManagedObject) DidChangeValueForKeyWithSetMutationUsingObjects ¶
func (m NSManagedObject) DidChangeValueForKeyWithSetMutationUsingObjects(inKey string, inMutationKind uint, inObjects foundation.INSSet)
Provides an opportunity to respond when a change was made to a specified to-many relationship.
inKey: The name of a property that is a to-many relationship.
inMutationKind: The type of change that was made.
inObjects: The objects that were involved in the change (see NSKeyValueSetMutationKind).
Discussion ¶
For more details, see Key-Value Observing Programming Guide.
You must not override this method.
func (NSManagedObject) DidSave ¶
func (m NSManagedObject) DidSave()
Provides an opportunity to add code into the life cycle of the managed object after the managed object’s context completes a save operation.
Discussion ¶
You can use this method to notify other objects after a save, and to compute transient values from persistent values.
This method can have “side effects” on the persistent values, however any changes you make using standard accessor methods will by default dirty the managed object context and leave your context with unsaved changes. Moreover, if the object’s context has an undo manager, such changes will add an undo operation. For document-based applications, changes made in `didSave` will therefore come into the next undo grouping, which can lead to “empty” undo operations from the user’s perspective. You may want to disable undo registration to avoid this issue.
The sense of “save” in the method name is that of a database commit statement and so applies to deletions as well as to updates to objects. For subclasses, this method is therefore an appropriate locus for code to be executed when an object deleted as well as “saved to disk.” You can find out if an object is marked for deletion with [NSManagedObject.Deleted].
Special Considerations ¶
You cannot attempt to resurrect a deleted object in `didSave`.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/didSave()
func (NSManagedObject) DidTurnIntoFault ¶
func (m NSManagedObject) DidTurnIntoFault()
Provides an opportunity to add code into the life cycle of the managed object after converting it to a fault.
Discussion ¶
You use this method to clear out custom data caches—transient values declared as entity properties are typically already cleared out by the time this method is invoked (see, for example, NSManagedObjectContext.RefreshObjectMergeChanges).
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/didTurnIntoFault()
func (NSManagedObject) Entity ¶
func (m NSManagedObject) Entity() INSEntityDescription
The entity description of the managed object.
Discussion ¶
If the receiver is a fault, accessing this property does not cause it to fire.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/entity-swift.property
func (NSManagedObject) FaultingState ¶
func (m NSManagedObject) FaultingState() uint
The faulting state of the managed object.
Return Value ¶
`0` if the object is fully initialized as a managed object and not transitioning to or from another state, otherwise some other value.
Discussion ¶
`0` if the object is fully initialized as a managed object and not transitioning to or from another state, otherwise some other value. This property allows you to determine if an object is in a transitional phase when receiving a key-value observing change notification.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/faultingState
func (NSManagedObject) HasChanges ¶
func (m NSManagedObject) HasChanges() bool
A Boolean value that indicates whether the managed object has been inserted, has been deleted, or has unsaved changes.
Discussion ¶
true if the receiver has been inserted, has been deleted, or has unsaved changes, otherwise false. The result is the equivalent of OR-ing the values of [NSManagedObject.Inserted], [NSManagedObject.Deleted], and [NSManagedObject.Updated].
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/hasChanges
func (NSManagedObject) HasFaultForRelationshipNamed ¶
func (m NSManagedObject) HasFaultForRelationshipNamed(key string) bool
Returns a Boolean value that indicates whether the relationship for a given key is a fault.
key: The name of one of the receiver’s relationships.
Return Value ¶
true if the relationship for `key` is a fault; otherwise, false.
Discussion ¶
If the specified relationship is a fault, calling this method does not result in the fault firing.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/hasFault(forRelationshipNamed:)
func (NSManagedObject) HasPersistentChangedValues ¶
func (m NSManagedObject) HasPersistentChangedValues() bool
A Boolean value that indicates whether the managed object has persistent changes.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/hasPersistentChangedValues
func (NSManagedObject) Init ¶
func (m NSManagedObject) Init() NSManagedObject
Init initializes the instance.
func (NSManagedObject) InitWithContext ¶
func (m NSManagedObject) InitWithContext(moc INSManagedObjectContext) NSManagedObject
Initializes a managed object subclass and inserts it into the specified managed object context.
Return Value ¶
An initialized instance of the appropriate subclass.
Discussion ¶
This method is only legal to call on subclasses of NSManagedObject that represent a single entity in the model.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/init(context:)
func (NSManagedObject) InitWithEntityInsertIntoManagedObjectContext ¶
func (m NSManagedObject) InitWithEntityInsertIntoManagedObjectContext(entity INSEntityDescription, context INSManagedObjectContext) NSManagedObject
Initializes a managed object from an entity description and inserts it into the specified managed object context.
entity: The entity of which to create an instance.
The model associated with `context`’s persistent store coordinator must contain `entity`.
context: The context into which the new instance is inserted.
Return Value ¶
An initialized instance of the appropriate class for `entity`.
Discussion ¶
NSManagedObject uses dynamic class generation to support the Objective-C 2 properties feature (see Declared Properties) by automatically creating a subclass of the class appropriate for `entity`. “ therefore returns an instance of the appropriate class for `entity`. The dynamically-generated subclass will be based on the class specified by the entity, so specifying a custom class in your model will supersede the class passed to `alloc`.
If `context` is not `nil`, this method invokes `[context self]` (which causes NSManagedObject.AwakeFromInsert to be invoked).
You are discouraged from overriding this method—you should instead override NSManagedObject.AwakeFromInsert and/or NSManagedObject.AwakeFromFetch (if there is logic common to these methods, it should be factored into a third method which is invoked from both). If you do perform custom initialization in this method, you may cause problems with undo and redo operations.
In many applications, there is no need to subsequently assign a newly-created managed object to a particular store—see NSManagedObjectContext.AssignObjectToPersistentStore. If your application has multiple stores and you do need to assign an object to a specific store, you should not do so in a managed object’s initializer method. Such an assignment is controller- not model-level logic.
Special Considerations ¶
If you override NSManagedObject.InitWithEntityInsertIntoManagedObjectContext, you must ensure that you set `self` to the return value from invocation of `super`’s implementation, as shown in the following example:
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/init(entity:insertInto:)
func (NSManagedObject) IsDeleted ¶
func (m NSManagedObject) IsDeleted() bool
A Boolean value that indicates whether the managed object will be deleted during the next save.
Discussion ¶
true if Core Data will ask the persistent store to delete the object during the next save operation, otherwise false. It may return false at other times, particularly after the object has been deleted. The immediacy with which it will stop returning true depends on where the object is in the process of being deleted.
If the receiver is a fault, accessing this property does not cause it to fire.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/isDeleted
func (NSManagedObject) IsFault ¶
func (m NSManagedObject) IsFault() bool
A Boolean value that indicates whether the managed object is a fault.
Discussion ¶
true if the receiver is a fault, otherwise false. Knowing whether an object is a fault is useful in many situations when computations are optional. It can also be used to avoid growing the object graph unnecessarily (which may improve performance as it can avoid time-consuming fetches from data stores).
If this property is false, then the receiver’s data must be in memory. However, if this property is true, it does not mean that the data is not in memory. The data may be in memory, or it may not, depending on many factors influencing caching.
If the receiver is a fault, accessing this property does not cause it to fire.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/isFault
func (NSManagedObject) IsInserted ¶
func (m NSManagedObject) IsInserted() bool
A Boolean value that indicates whether the managed object has been inserted in a managed object context.
Discussion ¶
true if the receiver has been inserted in a managed object context, otherwise false. If the receiver is a fault, accessing this property does not cause it to fire.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/isInserted
func (NSManagedObject) IsUpdated ¶
func (m NSManagedObject) IsUpdated() bool
A Boolean value that indicates whether the managed object has unsaved changes.
Discussion ¶
true if the receiver has unsaved changes, otherwise false. The receiver has unsaved changes if it has been updated since its managed object context was last saved.
If the receiver is a fault, accessing this property does not cause it to fire.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/isUpdated
func (NSManagedObject) ManagedObjectContext ¶
func (m NSManagedObject) ManagedObjectContext() INSManagedObjectContext
The managed object context with which the managed object is registered.
Discussion ¶
May be `nil` if the receiver has been deleted from its context.
If the receiver is a fault, accessing this property does not cause it to fire.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/managedObjectContext
func (NSManagedObject) ObjectID ¶
func (m NSManagedObject) ObjectID() INSManagedObjectID
The object ID of the managed object.
Discussion ¶
If the receiver is a fault, accessing this property does not cause it to fire.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/objectID
func (NSManagedObject) ObjectIDsForRelationshipNamed ¶
func (m NSManagedObject) ObjectIDsForRelationshipNamed(key string) []NSManagedObjectID
Returns the object IDs for all of the managed objects that are in the named relationship.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/objectIDs(forRelationshipNamed:)
func (NSManagedObject) ObservationInfo ¶
func (m NSManagedObject) ObservationInfo() unsafe.Pointer
Returns the observation info of the managed object.
Return Value ¶
The observation info of the receiver.
Discussion ¶
For more about key-value observation, see Key-Value Observing Programming Guide.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/observationInfo()
func (NSManagedObject) PrepareForDeletion ¶
func (m NSManagedObject) PrepareForDeletion()
Provides an opportunity to add code into the life cycle of the managed object before deleting it.
Discussion ¶
You can implement this method to perform any operations required before the object is deleted, such as custom propagation before relationships are torn down, or reconfiguration of objects using key-value observing.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/prepareForDeletion()
func (NSManagedObject) PrimitiveValueForKey ¶
func (m NSManagedObject) PrimitiveValueForKey(key string) objectivec.IObject
Returns the value for the specified property from the managed object’s private internal storage .
key: The name of one of the receiver’s properties.
Return Value ¶
The value of the property specified by `key`. Returns `nil` if no value has been set.
Discussion ¶
This method does not invoke the access notification methods (NSManagedObject.WillAccessValueForKey and NSManagedObject.DidAccessValueForKey). This method is used primarily by subclasses that implement custom accessor methods that need direct access to the receiver’s private storage.
Special Considerations ¶
Subclasses should not override this method.
The following points also apply:
- Primitive accessor methods are only supported on modeled properties. If you invoke a primitive accessor on an unmodeled property, it will instead operate upon a random modeled property. (The debug libraries and frameworks (available from Apple Developer Website) have assertions to test for passing unmodeled keys to these methods.) - You are strongly encouraged to use the dynamically-generated accessors rather than using this method directly (for example, “ instead of `@"name"`). The dynamic accessors are much more efficient, and allow for compile-time checking.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/primitiveValue(forKey:)
func (NSManagedObject) SetObservationInfo ¶
func (m NSManagedObject) SetObservationInfo(inObservationInfo unsafe.Pointer)
Sets the observation info of the managed object.
inObservationInfo: The new observation info for the receiver.
Discussion ¶
For more about observation information, see Key-Value Observing Programming Guide.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/setObservationInfo(_:)
func (NSManagedObject) SetPrimitiveValueForKey ¶
func (m NSManagedObject) SetPrimitiveValueForKey(value objectivec.IObject, key string)
Sets the value of a given property in the managed object’s private internal storage.
value: The new value for the property specified by `key`.
key: The name of one of the receiver’s properties.
Discussion ¶
Sets in the receiver’s private internal storage the value of the property specified by `key` to `value`. If `key` identifies a to-one relationship, relates the object specified by `value` to the receiver, unrelating the previously related object if there was one. Given a collection object and a key that identifies a to-many relationship, relates the objects contained in the collection to the receiver, unrelating previously related objects if there were any.
This method does not invoke the change notification methods (willChangeValue(forKey:) and didChangeValue(forKey:)). It is typically used by subclasses that implement custom accessor methods that need direct access to the receiver’s private internal storage. It is also used by the Core Data framework to initialize the receiver with values from a persistent store or to restore a value from a snapshot.
Special Considerations ¶
You must not override this method.
You should typically use this method only to modify attributes (usually transient), not relationships. If you try to set a to-many relationship to a new [NSMutableSet] object, it will (eventually) fail. In the unusual event that you need to modify a relationship using this method, you first get the existing set using “ (ensure the method does not return `nil`), create a mutable copy, and then modify the copy—as illustrated in the following example:
If the relationship is bi-directional (that is, if an inverse relationship is specified) then you are also responsible for maintaining the inverse relationship (regardless of cardinality)—in contrast with Core Data’s normal behavior described in Using Managed Objects.
The following points also apply:
- Primitive accessor methods are only supported on modeled properties. If you invoke a primitive accessor on an unmodeled property, it will instead operate upon a random modeled property. (The debug libraries and frameworks from (available from the Apple Developer Website) have assertions to test for passing unmodeled keys to these methods.) - You are strongly encouraged to use the dynamically-generated accessors rather than using this method directly (for example, “ instead of `newName @"name"`). The dynamic accessors are much more efficient, and allow for compile-time checking.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/setPrimitiveValue(_:forKey:)
func (NSManagedObject) ValidateForDelete ¶
func (m NSManagedObject) ValidateForDelete() (bool, error)
Determines whether the managed object can be deleted in its current state.
Discussion ¶
An object cannot be deleted if it has a relationship has a “deny” delete rule and that relationship has a destination object.
NSManagedObject‘s implementation sends the receiver’s entity description a message which performs basic checking based on the presence or absence of values.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/validateForDelete()
func (NSManagedObject) ValidateForInsert ¶
func (m NSManagedObject) ValidateForInsert() (bool, error)
Determines whether the managed object can be inserted in its current state.
Discussion ¶
Subclasses should invoke super’s implementation before performing their own validation, and should combine any error returned by super’s implementation with their own (see Managed Object Validation).
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/validateForInsert()
func (NSManagedObject) ValidateForUpdate ¶
func (m NSManagedObject) ValidateForUpdate() (bool, error)
Determines whether the managed object’s current state is valid.
Discussion ¶
NSManagedObject‘s implementation iterates through all of the receiver’s properties validating each in turn. If this results in more than one error, the `userInfo` dictionary in the [NSError] returned in `error` contains a key [NSDetailedErrorsKey]; the corresponding value is an array containing the individual validation errors. If you pass [NULL] as the error, validation will abort after the first failure.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/validateForUpdate()
func (NSManagedObject) WillAccessValueForKey ¶
func (m NSManagedObject) WillAccessValueForKey(key string)
Provides support for key-value observing access notification.
key: The name of one of the receiver’s properties.
Discussion ¶
See NSManagedObject.DidAccessValueForKey for more details. You can invoke this method with the `key` value of `nil` to ensure that a fault has been fired, as illustrated by the following example.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/willAccessValue(forKey:)
func (NSManagedObject) WillChangeValueForKeyWithSetMutationUsingObjects ¶
func (m NSManagedObject) WillChangeValueForKeyWithSetMutationUsingObjects(inKey string, inMutationKind uint, inObjects foundation.INSSet)
Provides an opportunity to respond when a change is about to be made to a specified to-many relationship.
inKey: The name of a property that is a to-many relationship
inMutationKind: The type of change that will be made.
inObjects: The objects that were involved in the change (see NSKeyValueSetMutationKind).
Discussion ¶
For more details, see Key-Value Observing Programming Guide.
You must not override this method.
func (NSManagedObject) WillSave ¶
func (m NSManagedObject) WillSave()
Provides an opportunity to add code into the life cycle of the managed object before saving it.
Discussion ¶
This method can have “side effects” on persistent values. You can use it to, for example, compute persistent values from other transient or scratchpad values.
If you want to update a persistent property value, you should typically test for equality of any new value with the existing value before making a change. If you change property values using standard accessor methods, Core Data will observe the resultant change notification and so invoke `willSave` again before saving the object’s managed object context. If you continue to modify a value in `willSave`, `willSave` will continue to be called until your program crashes.
For example, if you set a last-modified timestamp, you should check whether either you previously set it in the same save operation, or that the existing timestamp is not less than a small delta from the current time. Typically it’s better to calculate the timestamp once for all the objects being saved (for example, in response to an [NSManagedObjectContextWillSaveNotification]).
If you change property values using primitive accessors, you avoid the possibility of infinite recursion, but Core Data will not notice the change you make.
The sense of “save” in the method name is that of a database commit statement and so applies to deletions as well as to updates to objects. For subclasses, this method is therefore an appropriate locus for code to be executed when an object deleted as well as “saved to disk.” You can find out if an object is marked for deletion with [NSManagedObject.Deleted].
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/willSave()
func (NSManagedObject) WillTurnIntoFault ¶
func (m NSManagedObject) WillTurnIntoFault()
Provides an opportunity to add code into the life cycle of the managed object before converting it to a fault.
Discussion ¶
This method is the companion of the NSManagedObject.DidTurnIntoFault method. You can use it to (re)set state which requires access to property values (for example, observers across key paths). The default implementation does nothing.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/willTurnIntoFault()
type NSManagedObjectClass ¶
type NSManagedObjectClass struct {
// contains filtered or unexported fields
}
func GetNSManagedObjectClass ¶
func GetNSManagedObjectClass() NSManagedObjectClass
GetNSManagedObjectClass returns the class object for NSManagedObject.
func (NSManagedObjectClass) Alloc ¶
func (nc NSManagedObjectClass) Alloc() NSManagedObject
Alloc allocates memory for a new instance of the class.
func (NSManagedObjectClass) Class ¶
func (nc NSManagedObjectClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (NSManagedObjectClass) ContextShouldIgnoreUnmodeledPropertyChanges ¶
func (_NSManagedObjectClass NSManagedObjectClass) ContextShouldIgnoreUnmodeledPropertyChanges() bool
A Boolean value that indicates whether to mark instances of the class as having changes when an unmodeled property changes.
Return Value ¶
false if instances of the class should be marked as having changes if an unmodeled property is changed, otherwise true.
Discussion ¶
The default value is true.
func (NSManagedObjectClass) Entity ¶
func (_NSManagedObjectClass NSManagedObjectClass) Entity() NSEntityDescription
Returns the entity description that is associated with this subclass.
Discussion ¶
This method is only legal to call on subclasses of NSManagedObject that represent a single entity in the model.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/entity()
func (NSManagedObjectClass) FetchRequest ¶
func (_NSManagedObjectClass NSManagedObjectClass) FetchRequest() NSFetchRequest
Returns an initialized fetch request with the entity this subclass represents.
Discussion ¶
This method is only legal to call on subclasses of NSManagedObject that represent a single entity in the model.
See: https://developer.apple.com/documentation/CoreData/NSManagedObject/fetchRequest()
type NSManagedObjectContext ¶
type NSManagedObjectContext struct {
objectivec.Object
}
An object space to manipulate and track changes to managed objects.
Overview ¶
A context consists of a group of related model objects that represent an internally consistent view of one or more persistent stores. Changes to managed objects remain in memory in the associated context until Core Data saves that context to one or more persistent stores. A single managed object instance exists in one and only one context, but multiple copies of an object can exist in different contexts. Therefore, an object is unique to a particular context.
Life cycle management ¶
The context is a powerful object with a central role in the life cycle of managed objects, with responsibilities from life cycle management (including faulting) to validation, inverse relationship handling, and undo/redo. Through a context you can retrieve or “fetch” objects from a persistent store, make changes to those objects, and then either discard the changes or—again through the context—commit them back to the persistent store. The context is responsible for watching for changes in its objects and maintains an undo manager so you can have finer-grained control over undo and redo. You can insert new objects and delete ones you have fetched, and commit these modifications to the persistent store.
All objects fetched from an external store are registered in a context together with a global identifier (an instance of NSManagedObjectID) that’s used to uniquely identify each object to the external store.
Parent store ¶
Managed object contexts have a parent store from which they retrieve data representing managed objects and through which they commit changes to managed objects.
Prior to OS X v10.7 and iOS v5.0, the parent store is always a persistent store coordinator. In macOS 10.7 and later and iOS v5.0 and later, the parent store may be another managed object context. Ultimately the root of a context’s ancestry must be a persistent store coordinator. The coordinator provides the managed object model and dispatches requests to the various persistent stores containing the data.
If a context’s parent store is another managed object context, fetch and save operations are mediated by the parent context instead of a coordinator. This pattern has a number of usage scenarios, including:
- Performing background operations on a second thread or queue. - Managing discardable edits, such as in an inspector window or view.
As the first scenario implies, a parent context can service requests from children on different threads. You cannot, therefore, use parent contexts created with the thread confinement type (see NSManagedObjectContext).
When you save changes in a context, the changes are only committed “one store up.” If you save a child context, changes are pushed to its parent. Changes are not saved to the persistent store until the root context is saved. (A root managed object context is one whose parent context is `nil`.) In addition, a parent does not pull changes from children before it saves. You must save a child context if you want ultimately to commit the changes.
Notifications ¶
A context posts notifications at various points—see NSManagedObjectContextObjectsDidChange for example. Typically, you should register to receive these notifications only from known contexts:
Several system frameworks use Core Data internally. If you register to receive these notifications from all contexts (by passing `nil` as the object parameter to a method such as addObserver(_:selector:name:object:)), then you may receive unexpected notifications that are difficult to handle.
Concurrency ¶
Core Data uses thread (or serialized queue) confinement to protect managed objects and managed object contexts (see Core Data Programming Guide). A consequence of this is that a context assumes the default owner is the thread or queue that creates it. Don’t, therefore, initialize a context on one thread then pass it to another. Instead, pass a reference to a persistent store coordinator and have the receiving thread or queue create a new context using that. If you use Operation, you must create the context in main() (for a serial queue) or start() (for a concurrent queue).
When you create a context you specify the concurrency type with which you’ll use it. When you create a managed object context, you have two options for its thread (queue) association:
- Private: The context creates and manages a private queue. - Main: The context associates with the main queue and is dependent on the application’s event loop; otherwise, it’s similar to a private context. Use this type for contexts that update view controllers and other user interface elements.
You use contexts using the queue-based concurrency types in conjunction with NSManagedObjectContext.PerformBlock and NSManagedObjectContext.PerformBlockAndWait. You group “standard” messages to send to the context within a block to pass to one of these methods. There are two exceptions:
- Setter methods on queue-based managed object contexts are thread-safe. You can invoke these methods directly on any thread. - If your code executes on the main thread, you can invoke methods on the main queue style contexts directly instead of using the block based API.
NSManagedObjectContext.PerformBlock and NSManagedObjectContext.PerformBlockAndWait ensure the block operations execute on the correct queue for the context. The NSManagedObjectContext.PerformBlock method returns immediately and the context executes the block methods on its own thread. With the NSManagedObjectContext.PerformBlockAndWait method, the context still executes the block methods on its own thread, but the method doesn’t return until the block completes.
It’s important to appreciate that blocks execute as a distinct body of work. As soon as your block ends, anyone else can enqueue another block, undo changes, reset the context, and so on. Thus blocks may be quite large, and typically end by invoking NSManagedObjectContext.Save.
You can also perform other operations, such as:
Subclassing notes ¶
You are strongly discouraged from subclassing NSManagedObjectContext. The change tracking and undo management mechanisms are highly optimized and hence intricate and delicate. Interposing your own additional logic that might impact NSManagedObjectContext.ProcessPendingChanges can have unforeseen consequences. In situations such as store migration, Core Data will create instances of NSManagedObjectContext for its own use. Under these circumstances, you cannot rely on any features of your custom subclass. Any NSManagedObject subclass must always be fully compatible with NSManagedObjectContext (that is, it cannot rely on features of a subclass of NSManagedObjectContext).
Creating a context ¶
- NSManagedObjectContext.InitWithConcurrencyType: Creates a context that uses the specified concurrency type.
Configuring a context ¶
- NSManagedObjectContext.PersistentStoreCoordinator: The persistent store coordinator of the context.
- NSManagedObjectContext.SetPersistentStoreCoordinator
- NSManagedObjectContext.ParentContext: The parent of the context.
- NSManagedObjectContext.SetParentContext
- NSManagedObjectContext.Name: The developer-provided name of the context.
- NSManagedObjectContext.SetName
- NSManagedObjectContext.UserInfo: The user information for the context.
Registering and fetching objects ¶
- NSManagedObjectContext.CountForFetchRequestError: Returns the number of objects the specified request fetches when it executes.
- NSManagedObjectContext.ObjectRegisteredForID: Returns an object that exists in the context.
- NSManagedObjectContext.ObjectWithID: Returns either an existing object from the context or a fault that represents that object.
- NSManagedObjectContext.ExistingObjectWithIDError: Returns an existing object from either the context or the persistent store.
- NSManagedObjectContext.RegisteredObjects: The set of registered managed objects in the context.
- NSManagedObjectContext.ExecuteRequestError: Passes a request to the persistent store without affecting the contents of the managed object context, and returns a persistent store result.
- NSManagedObjectContext.RefreshAllObjects: Refreshes all of the registered managed objects in the context.
- NSManagedObjectContext.RetainsRegisteredObjects: A Boolean value that indicates whether the context keeps strong references to all registered managed objects.
- NSManagedObjectContext.SetRetainsRegisteredObjects
Handling managed objects ¶
- NSManagedObjectContext.ShouldDeleteInaccessibleFaults: A Boolean value that determines whether the context turns inaccessible faults into deleted objects.
- NSManagedObjectContext.SetShouldDeleteInaccessibleFaults
- NSManagedObjectContext.InsertedObjects: The set of objects that have been inserted into the context but not yet saved in a persistent store.
- NSManagedObjectContext.UpdatedObjects: The set of objects registered with the context that have uncommitted changes.
- NSManagedObjectContext.DeletedObjects: The set of objects that will be removed from their persistent store during the next save operation.
- NSManagedObjectContext.ShouldHandleInaccessibleFaultForObjectIDTriggeredByProperty: Creates a log of the inaccessible fault.
- NSManagedObjectContext.InsertObject: Registers an object to be inserted in the context’s persistent store the next time changes are saved.
- NSManagedObjectContext.DeleteObject: Specifies an object that should be removed from its persistent store when changes are committed.
- NSManagedObjectContext.AssignObjectToPersistentStore: Specifies the store in which a newly inserted object will be saved.
- NSManagedObjectContext.ObtainPermanentIDsForObjectsError: Converts to permanent IDs the object IDs of the objects in a given array.
- NSManagedObjectContext.DetectConflictsForObject: Marks an object for conflict detection.
- NSManagedObjectContext.RefreshObjectMergeChanges: Updates the persistent properties of a managed object to use the latest values from the persistent store.
- NSManagedObjectContext.ProcessPendingChanges: Forces the context to process changes to the object graph.
Managing concurrency ¶
- NSManagedObjectContext.AutomaticallyMergesChangesFromParent: A Boolean value that indicates whether the context automatically merges changes saved to its persistent store coordinator or parent context.
- NSManagedObjectContext.SetAutomaticallyMergesChangesFromParent
- NSManagedObjectContext.ConcurrencyType: The concurrency type for the context.
- NSManagedObjectContext.MergePolicy: The merge policy of the context.
- NSManagedObjectContext.SetMergePolicy
- NSManagedObjectContext.QueryGenerationToken: Returns the token associated with the query generation currently in use by this context.
- NSManagedObjectContext.TransactionAuthor: The author for the context that is used as an identifier in persistent history transactions.
- NSManagedObjectContext.SetTransactionAuthor
- NSManagedObjectContext.MergeChangesFromContextDidSaveNotification: Merges the changes specified in a given notification.
- NSManagedObjectContext.SetQueryGenerationFromTokenError: Sets the query generation this context should use.
Managing unsaved and uncommitted changes ¶
- NSManagedObjectContext.Save: Attempts to commit unsaved changes to registered objects to the context’s parent store.
- NSManagedObjectContext.HasChanges: A Boolean value that indicates whether the context has uncommitted changes.
Undoing changes ¶
- NSManagedObjectContext.UndoManager: The object that provides undo support for the context.
- NSManagedObjectContext.SetUndoManager
- NSManagedObjectContext.Undo: Sends an undo message to the context’s undo manager, asking it to reverse the latest uncommitted changes applied to objects in the object graph.
- NSManagedObjectContext.Redo: Sends a redo message to the context’s undo manager, asking it to reverse the latest undo operation applied to objects in the object graph.
- NSManagedObjectContext.Reset: Returns the context to its base state.
- NSManagedObjectContext.Rollback: Removes everything from the undo stack, discards all insertions and deletions, and restores updated objects to their last committed values.
Handling delete propagation ¶
- NSManagedObjectContext.PropagatesDeletesAtEndOfEvent: A Boolean value that indicates whether the context propagates deletes at the end of the event in which a change was made.
- NSManagedObjectContext.SetPropagatesDeletesAtEndOfEvent
Managing the staleness interval ¶
- NSManagedObjectContext.StalenessInterval: The maximum length of time that may have elapsed since the store previously fetched data before fulfilling a fault issues a new fetch.
- NSManagedObjectContext.SetStalenessInterval
Performing block operations ¶
- NSManagedObjectContext.PerformBlock: Asynchronously performs the specified closure on the context’s queue.
- NSManagedObjectContext.PerformBlockAndWait: Synchronously performs the specified closure on the context’s queue.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext
func NSManagedObjectContextFromID ¶
func NSManagedObjectContextFromID(id objc.ID) NSManagedObjectContext
NSManagedObjectContextFromID constructs a NSManagedObjectContext from an objc.ID.
An object space to manipulate and track changes to managed objects.
func NewManagedObjectContextWithConcurrencyType ¶
func NewManagedObjectContextWithConcurrencyType(ct NSManagedObjectContextConcurrencyType) NSManagedObjectContext
Creates a context that uses the specified concurrency type.
ct: The context’s concurrency type. For possible values, see NSManagedObjectContextConcurrencyType.
Discussion ¶
For more information, see NSManagedObjectContext.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/init(concurrencyType:)
func NewNSManagedObjectContext ¶
func NewNSManagedObjectContext() NSManagedObjectContext
NewNSManagedObjectContext creates a new NSManagedObjectContext instance.
func (NSManagedObjectContext) AssignObjectToPersistentStore ¶
func (m NSManagedObjectContext) AssignObjectToPersistentStore(object objectivec.IObject, store INSPersistentStore)
Specifies the store in which a newly inserted object will be saved.
object: A managed object.
store: A persistent store.
Discussion ¶
You can obtain a store from the persistent store coordinator, using for example NSPersistentStoreCoordinator.PersistentStoreForURL.
Special Considerations ¶
It is only necessary to use this method if the receiver’s persistent store coordinator manages multiple writable stores that have `object`‘s entity in their configuration. Maintaining configurations in the managed object model can eliminate the need for invoking this method directly in many situations. If the receiver’s persistent store coordinator manages only a single writable store, or if only one store has `object`’s entity in its model, `object` will automatically be assigned to that store.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/assign(_:to:)
func (NSManagedObjectContext) AutomaticallyMergesChangesFromParent ¶
func (m NSManagedObjectContext) AutomaticallyMergesChangesFromParent() bool
A Boolean value that indicates whether the context automatically merges changes saved to its persistent store coordinator or parent context.
func (NSManagedObjectContext) Autorelease ¶
func (m NSManagedObjectContext) Autorelease() NSManagedObjectContext
Autorelease adds the receiver to the current autorelease pool.
func (NSManagedObjectContext) ConcurrencyType ¶
func (m NSManagedObjectContext) ConcurrencyType() NSManagedObjectContextConcurrencyType
The concurrency type for the context.
Discussion ¶
For more details on concurrency type, see NSManagedObjectContext.
func (NSManagedObjectContext) CountForFetchRequestError ¶
func (m NSManagedObjectContext) CountForFetchRequestError(request INSFetchRequest) (uint, error)
Returns the number of objects the specified request fetches when it executes.
request: A fetch request that specifies the search criteria for the fetch.
Return Value ¶
The number of objects a given fetch request would have returned if it had been passed to fetch(_:), or [NSNotFound] if an error occurs.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/count(for:)-93zbm
func (NSManagedObjectContext) DeleteObject ¶
func (m NSManagedObjectContext) DeleteObject(object INSManagedObject)
Specifies an object that should be removed from its persistent store when changes are committed.
object: A managed object.
Discussion ¶
When changes are committed, `object` will be removed from the uniquing tables. If `object` has not yet been saved to a persistent store, it is simply removed from the receiver.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/delete(_:)
func (NSManagedObjectContext) DeletedObjects ¶
func (m NSManagedObjectContext) DeletedObjects() foundation.INSSet
The set of objects that will be removed from their persistent store during the next save operation.
Discussion ¶
The returned set does not necessarily include all the objects that have been deleted (using NSManagedObjectContext.DeleteObject)—if an object has been inserted and deleted without an intervening save operation, it may not be included in the set.
A managed object context does not post key-value observing notifications when the return value of `deletedObjects` changes. A context does, however, post a NSManagedObjectContextObjectsDidChange notification when a change is made, and a NSManagedObjectContextWillSave notification and a NSManagedObjectContextDidSave notification before and after changes are committed respectively (although again the set of deleted objects given for an NSManagedObjectContextDidSave does not include objects that were inserted and deleted without an intervening save operation—that is, they had never been saved to a persistent store).
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/deletedObjects
func (NSManagedObjectContext) DetectConflictsForObject ¶
func (m NSManagedObjectContext) DetectConflictsForObject(object INSManagedObject)
Marks an object for conflict detection.
object: A managed object.
Discussion ¶
If on the next invocation of NSManagedObjectContext.Save `object` has been modified in its persistent store, the save fails. This allows optimistic locking for unchanged objects. Conflict detection is always performed on changed or deleted objects.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/detectConflicts(for:)
func (NSManagedObjectContext) EncodeWithCoder ¶
func (m NSManagedObjectContext) EncodeWithCoder(coder foundation.INSCoder)
func (NSManagedObjectContext) ExecuteRequestError ¶
func (m NSManagedObjectContext) ExecuteRequestError(request INSPersistentStoreRequest) (INSPersistentStoreResult, error)
Passes a request to the persistent store without affecting the contents of the managed object context, and returns a persistent store result.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/execute(_:)
func (NSManagedObjectContext) ExistingObjectWithIDError ¶
func (m NSManagedObjectContext) ExistingObjectWithIDError(objectID INSManagedObjectID) (INSManagedObject, error)
Returns an existing object from either the context or the persistent store.
objectID: The identifier of the object to retrieve. For more information, see NSManagedObjectID.
Return Value ¶
The identified object from either the context or the persistent store.
Discussion ¶
If the context recognizes the specified object, the method returns that object. Otherwise, the context fetches and returns a fully realized object from the persistent store; unlike NSManagedObjectContext.ObjectWithID, this method never returns a fault. If the object doesn’t exist in both the context and the persistent store, the method throws an error.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/existingObject(with:)
func (NSManagedObjectContext) HasChanges ¶
func (m NSManagedObjectContext) HasChanges() bool
A Boolean value that indicates whether the context has uncommitted changes.
Discussion ¶
If you are observing this property using key-value observing (KVO) you should not touch the context or its objects within your implementation of observeValue(forKeyPath:of:change:context:) for this notification. (This is because of the intricacy of the locations of the KVO notifications—for example, the context may be in the middle of an undo operation, or repairing a merge conflict.) If you need to send messages to the context or change any of its managed objects as a result of a change to the value of `hasChanges`, you must do so after the call stack unwinds (typically using perform(_:with:afterDelay:) or a similar method).
Special Considerations ¶
In macOS 10.6 and later, this property is Key-value observing compliant.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/hasChanges
func (NSManagedObjectContext) Init ¶
func (m NSManagedObjectContext) Init() NSManagedObjectContext
Init initializes the instance.
func (NSManagedObjectContext) InitWithConcurrencyType ¶
func (m NSManagedObjectContext) InitWithConcurrencyType(ct NSManagedObjectContextConcurrencyType) NSManagedObjectContext
Creates a context that uses the specified concurrency type.
ct: The context’s concurrency type. For possible values, see NSManagedObjectContextConcurrencyType.
Discussion ¶
For more information, see NSManagedObjectContext.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/init(concurrencyType:)
func (NSManagedObjectContext) InsertObject ¶
func (m NSManagedObjectContext) InsertObject(object INSManagedObject)
Registers an object to be inserted in the context’s persistent store the next time changes are saved.
object: A managed object.
Discussion ¶
The managed object (`object`) is registered in the receiver with a temporary global ID. It is assigned a permanent global ID when changes are committed. If the current transaction is rolled back (for example, if the receiver is sent a NSManagedObjectContext.Rollback message) before a save operation, the object is unregistered from the receiver.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/insert(_:)
func (NSManagedObjectContext) InsertedObjects ¶
func (m NSManagedObjectContext) InsertedObjects() foundation.INSSet
The set of objects that have been inserted into the context but not yet saved in a persistent store.
Discussion ¶
A managed object context does not post key-value observing notifications when the return value of `insertedObjects` changes—it does, however, post a NSManagedObjectContextObjectsDidChange notification when a change is made, and a NSManagedObjectContextWillSave and a NSManagedObjectContextDidSave notification before and after changes are committed respectively.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/insertedObjects
func (NSManagedObjectContext) MergeChangesFromContextDidSaveNotification ¶
func (m NSManagedObjectContext) MergeChangesFromContextDidSaveNotification(notification foundation.NSNotification)
Merges the changes specified in a given notification.
notification: An instance of an NSManagedObjectContextDidSave notification posted by another context.
Discussion ¶
This method refreshes any objects which have been updated in the other context, faults in any newly-inserted objects, and invokes NSManagedObjectContext.DeleteObject: on those which have been deleted.
You can pass a NSManagedObjectContextDidSave notification posted by a managed object context on another thread, however you must not use the managed objects in the user info dictionary directly. For more details, see Concurrency with Core Data.
func (NSManagedObjectContext) MergePolicy ¶
func (m NSManagedObjectContext) MergePolicy() objectivec.IObject
The merge policy of the context.
Discussion ¶
The default is NSErrorMergePolicy. For possible values, see NSMergePolicy.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/mergePolicy
func (NSManagedObjectContext) Name ¶
func (m NSManagedObjectContext) Name() string
The developer-provided name of the context.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/name
func (NSManagedObjectContext) ObjectRegisteredForID ¶
func (m NSManagedObjectContext) ObjectRegisteredForID(objectID INSManagedObjectID) INSManagedObject
Returns an object that exists in the context.
objectID: The identifier of the object to retrieve. For more information, see NSManagedObjectID.
Return Value ¶
The identified object, if it’s known to the context; otherwise, `nil`.
Discussion ¶
This method provides a convenient way to retrieve an object from the context’s NSManagedObjectContext.RegisteredObjects property. A `nil` return value means the context doesn’t recognize the specified object; the object might still exist in the persistent store. If you need to query both the context and the store, use NSManagedObjectContext.ExistingObjectWithIDError instead.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/registeredObject(for:)
func (NSManagedObjectContext) ObjectWithID ¶
func (m NSManagedObjectContext) ObjectWithID(objectID INSManagedObjectID) INSManagedObject
Returns either an existing object from the context or a fault that represents that object.
objectID: The identifier of the object to retrieve. For more information, see NSManagedObjectID.
Return Value ¶
The identified object, if its known to the context; otherwise, a fault with its NSManagedObject.ObjectID property set to `objectID`.
Discussion ¶
If the context doesn’t recognize the specified object, this method returns a fault — a placeholder object that doesn’t load its properties until your code accesses them. The context then fetches the corresponding values from the persistent store and uses those values to turn the fault into a fully realized object.
When this method returns a fault, Core Data makes no attempts to verify the existence of the underlying object in the persistent store. If the object doesn’t exist when the context tries to the fetch the object’s values, the framework throws an exception.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/object(with:)
func (NSManagedObjectContext) ObtainPermanentIDsForObjectsError ¶
func (m NSManagedObjectContext) ObtainPermanentIDsForObjectsError(objects []NSManagedObject) (bool, error)
Converts to permanent IDs the object IDs of the objects in a given array.
objects: An array of managed objects.
Discussion ¶
This method converts the object ID of each managed object in `objects` to a permanent ID. Although the object will have a permanent ID, it will still respond positively to [NSManagedObject.Inserted] until it is saved. Any object that already has a permanent ID is ignored.
Any object not already assigned to a store is assigned based on the same rules Core Data uses for assignment during a save operation (first writable store supporting the entity, and appropriate for the instance and its related items).
Special Considerations ¶
This method results in a transaction with the underlying store which changes the file’s modification date.
In macOS, this results an additional consideration if you invoke this method on the managed object context associated with an instance of NSPersistentDocument. Instances of [NSDocument] need to know that they are in sync with the underlying content. To avoid problems, after invoking this method you must therefore update the document’s modification date (using fileModificationDate).
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/obtainPermanentIDs(for:)
func (NSManagedObjectContext) ParentContext ¶
func (m NSManagedObjectContext) ParentContext() INSManagedObjectContext
The parent of the context.
Discussion ¶
`nil` indicates there is no parent context. For more details, see NSManagedObjectContext.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/parent
func (NSManagedObjectContext) PerformBlock ¶
func (m NSManagedObjectContext) PerformBlock(block VoidHandler)
Asynchronously performs the specified closure on the context’s queue.
block: The closure to perform.
Discussion ¶
This method encapsulates an autorelease pool and a call to NSManagedObjectContext.ProcessPendingChanges.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/perform(_:)
func (NSManagedObjectContext) PerformBlockAndWait ¶
func (m NSManagedObjectContext) PerformBlockAndWait(block VoidHandler)
Synchronously performs the specified closure on the context’s queue.
block: The closure to perform.
Discussion ¶
This method supports reentrancy — meaning it’s safe to call the method again, from within the closure, before the previous invocation completes.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/performAndWait(_:)-ypye
func (NSManagedObjectContext) PerformBlockAndWaitSync ¶
func (m NSManagedObjectContext) PerformBlockAndWaitSync(ctx context.Context) error
PerformBlockAndWaitSync is a synchronous wrapper around NSManagedObjectContext.PerformBlockAndWait. It blocks until the completion handler fires or the context is cancelled.
func (NSManagedObjectContext) PerformBlockSync ¶
func (m NSManagedObjectContext) PerformBlockSync(ctx context.Context) error
PerformBlockSync is a synchronous wrapper around NSManagedObjectContext.PerformBlock. It blocks until the completion handler fires or the context is cancelled.
func (NSManagedObjectContext) PersistentStoreCoordinator ¶
func (m NSManagedObjectContext) PersistentStoreCoordinator() INSPersistentStoreCoordinator
The persistent store coordinator of the context.
Return Value ¶
The persistent store coordinator of the receiver.
Discussion ¶
The coordinator provides the managed object model and handles persistency. Note that multiple contexts can share a coordinator. May not be `nil`.
Setting NSManagedObjectContext.PersistentStoreCoordinator to `nil` will raise an exception. If you want to “disconnect” a context from its persistent store coordinator, you should simply set all strong references to the context to `nil` and allow it to be deallocated normally.
For more details, see NSManagedObjectContext.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/persistentStoreCoordinator
func (NSManagedObjectContext) ProcessPendingChanges ¶
func (m NSManagedObjectContext) ProcessPendingChanges()
Forces the context to process changes to the object graph.
Discussion ¶
This method causes changes to registered managed objects to be recorded with the undo manager.
In AppKit-based applications, this method is invoked automatically at least once during the event loop (at the end of the loop)—it may be called more often than that if the framework needs to coalesce your changes before doing something else. You can also invoke it manually to coalesce any pending unprocessed changes.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/processPendingChanges()
func (NSManagedObjectContext) PropagatesDeletesAtEndOfEvent ¶
func (m NSManagedObjectContext) PropagatesDeletesAtEndOfEvent() bool
A Boolean value that indicates whether the context propagates deletes at the end of the event in which a change was made.
Discussion ¶
true if the receiver propagates deletes at the end of the event in which a change was made, false if it propagates deletes only during a save operation. The default is true.
func (NSManagedObjectContext) QueryGenerationToken ¶
func (m NSManagedObjectContext) QueryGenerationToken() INSQueryGenerationToken
Returns the token associated with the query generation currently in use by this context.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/queryGenerationToken
func (NSManagedObjectContext) Redo ¶
func (m NSManagedObjectContext) Redo()
Sends a redo message to the context’s undo manager, asking it to reverse the latest undo operation applied to objects in the object graph.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/redo()
func (NSManagedObjectContext) RefreshAllObjects ¶
func (m NSManagedObjectContext) RefreshAllObjects()
Refreshes all of the registered managed objects in the context.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/refreshAllObjects()
func (NSManagedObjectContext) RefreshObjectMergeChanges ¶
func (m NSManagedObjectContext) RefreshObjectMergeChanges(object INSManagedObject, flag bool)
Updates the persistent properties of a managed object to use the latest values from the persistent store.
object: A managed object.
flag: A Boolean value.
If `flag` is false, the context discards pending changes and the managed object becomes a fault. Upon next access, the context reloads the object’s values from the persistent store or last cached state.
If `flag` is true, the context reloads the object’s property values from the store or the cache. Then the context applies local changes over the newly loaded values. Merging the local values into `object` always succeeds, and never results in a merge conflict.
Discussion ¶
If you call this method before the NSManagedObjectContext.StalenessInterval expires, the context reloads the data from the cache instead of fetching from the store. If `flag` is true, this method doesn’t affect any transient properties. If `flag` is false, the object disposes the value of transient properties.
You typically use this method to ensure data freshness if multiple managed object contexts share a single persistent store. You can use this method to resolve an optimistic locking failure when attempting to save.
Turning `object` into a fault by setting `flag` to false breaks strong references to related managed objects. You can use this method to release a portion of your object graph if you want to constrain memory usage.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/refresh(_:mergeChanges:)
func (NSManagedObjectContext) RegisteredObjects ¶
func (m NSManagedObjectContext) RegisteredObjects() foundation.INSSet
The set of registered managed objects in the context.
Discussion ¶
A managed object context does not post key-value observing notifications when the return value of `registeredObjects` changes.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/registeredObjects
func (NSManagedObjectContext) Reset ¶
func (m NSManagedObjectContext) Reset()
Returns the context to its base state.
Discussion ¶
All the receiver’s managed objects are “forgotten.” If you use this method, you should ensure that you also discard references to any managed objects fetched using the receiver, since they will be invalid afterwards.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/reset()
func (NSManagedObjectContext) RetainsRegisteredObjects ¶
func (m NSManagedObjectContext) RetainsRegisteredObjects() bool
A Boolean value that indicates whether the context keeps strong references to all registered managed objects.
Discussion ¶
If set to true, the receiver keeps strong references to all registered managed objects. If set to false, then the receiver keeps strong references to registered objects only when they are inserted, updated, deleted, or locked. The default is false.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/retainsRegisteredObjects
func (NSManagedObjectContext) Rollback ¶
func (m NSManagedObjectContext) Rollback()
Removes everything from the undo stack, discards all insertions and deletions, and restores updated objects to their last committed values.
Discussion ¶
This method does not refetch data from the persistent store or stores.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/rollback()
func (NSManagedObjectContext) Save ¶
func (m NSManagedObjectContext) Save() (bool, error)
Attempts to commit unsaved changes to registered objects to the context’s parent store.
Discussion ¶
If there were multiple errors (for example several edited objects had validation failures) the description of [NSError] returned indicates that there were multiple errors, and its userInfo dictionary contains the key [NSDetailedErrors]. The value associated with the [NSDetailedErrors] key is an array that contains the individual [NSError] objects.
If a context’s parent store is a persistent store coordinator, then changes are committed to the external store. If a context’s parent store is another managed object context, then NSManagedObjectContext.Save only updates managed objects in that parent store. To commit changes to the external store, you must save changes in the chain of contexts up to and including the context whose parent is the persistent store coordinator.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/save()
func (NSManagedObjectContext) SetAutomaticallyMergesChangesFromParent ¶
func (m NSManagedObjectContext) SetAutomaticallyMergesChangesFromParent(value bool)
func (NSManagedObjectContext) SetMergePolicy ¶
func (m NSManagedObjectContext) SetMergePolicy(value objectivec.IObject)
func (NSManagedObjectContext) SetName ¶
func (m NSManagedObjectContext) SetName(value string)
func (NSManagedObjectContext) SetParentContext ¶
func (m NSManagedObjectContext) SetParentContext(value INSManagedObjectContext)
func (NSManagedObjectContext) SetPersistentStoreCoordinator ¶
func (m NSManagedObjectContext) SetPersistentStoreCoordinator(value INSPersistentStoreCoordinator)
func (NSManagedObjectContext) SetPropagatesDeletesAtEndOfEvent ¶
func (m NSManagedObjectContext) SetPropagatesDeletesAtEndOfEvent(value bool)
func (NSManagedObjectContext) SetQueryGenerationFromTokenError ¶
func (m NSManagedObjectContext) SetQueryGenerationFromTokenError(generation INSQueryGenerationToken) (bool, error)
Sets the query generation this context should use.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/setQueryGenerationFrom(_:)
func (NSManagedObjectContext) SetRetainsRegisteredObjects ¶
func (m NSManagedObjectContext) SetRetainsRegisteredObjects(value bool)
func (NSManagedObjectContext) SetShouldDeleteInaccessibleFaults ¶
func (m NSManagedObjectContext) SetShouldDeleteInaccessibleFaults(value bool)
func (NSManagedObjectContext) SetStalenessInterval ¶
func (m NSManagedObjectContext) SetStalenessInterval(value foundation.NSTimeInterval)
func (NSManagedObjectContext) SetTransactionAuthor ¶
func (m NSManagedObjectContext) SetTransactionAuthor(value string)
func (NSManagedObjectContext) SetUndoManager ¶
func (m NSManagedObjectContext) SetUndoManager(value foundation.UndoManager)
func (NSManagedObjectContext) ShouldDeleteInaccessibleFaults ¶
func (m NSManagedObjectContext) ShouldDeleteInaccessibleFaults() bool
A Boolean value that determines whether the context turns inaccessible faults into deleted objects.
Discussion ¶
Use this property to control how the context behaves when it encounters an inaccessible fault — an object with no underlying data in the persistent store. For example, you might fetch an object that has a to-many relationship, but then a background context deletes the related objects from the store before you traverse that relationship.
When this property is set to true, the context returns a managed object with the following characteristics:
- The object’s attributes, including scalars, nullable, and mandatory attributes are all set to `nil` or `0`. - The object’s [NSManagedObject.Deleted] property is set to true, which adds the object to the context’s NSManagedObjectContext.DeletedObjects set. - The object is exempt from validation rules, including optionality, because the object is nonexistent and the context discards it when you next call NSManagedObjectContext.Save or NSManagedObjectContext.Reset.
When the context returns an object with these characteristics, your app can continue running and process this object in the same way as any other deleted object.
When this property is set to false, the context throws an exception.
The default value is true.
func (NSManagedObjectContext) ShouldHandleInaccessibleFaultForObjectIDTriggeredByProperty ¶
func (m NSManagedObjectContext) ShouldHandleInaccessibleFaultForObjectIDTriggeredByProperty(fault INSManagedObject, oid INSManagedObjectID, property INSPropertyDescription) bool
Creates a log of the inaccessible fault.
func (NSManagedObjectContext) StalenessInterval ¶
func (m NSManagedObjectContext) StalenessInterval() foundation.NSTimeInterval
The maximum length of time that may have elapsed since the store previously fetched data before fulfilling a fault issues a new fetch.
Discussion ¶
The staleness interval controls whether fulfilling a fault uses data previously fetched by the application, or issues a new fetch (see also NSManagedObjectContext.RefreshObjectMergeChanges). The staleness interval does not affect objects currently in use (that is, it is not used to automatically update property values from a persistent store after a certain period of time).
The expiration value is applied on a per object basis. It is the relative time until cached data (snapshots) should be considered stale. For example, a value of 300.0 informs the context to utilize cached information for no more than 5 minutes after an object was originally fetched.
Note that the staleness interval is a hint and may not be supported by all persistent store types. It is not used by XML and binary stores, because these stores maintain all current values in memory.
The default is a negative value, which represents infinite staleness allowed. `0.0` represents “no staleness acceptable”.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/stalenessInterval
func (NSManagedObjectContext) TransactionAuthor ¶
func (m NSManagedObjectContext) TransactionAuthor() string
The author for the context that is used as an identifier in persistent history transactions.
Discussion ¶
Set a managed object context’s NSManagedObjectContext.TransactionAuthor before saving it to differentiate among multiple call sites that modify the same context. Doing this records an NSPersistentHistoryTransaction.Author in subsequent transactions.
Reset the context’s NSManagedObjectContext.TransactionAuthor to nil after the save to prevent misattribution of future transactions.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/transactionAuthor
func (NSManagedObjectContext) Undo ¶
func (m NSManagedObjectContext) Undo()
Sends an undo message to the context’s undo manager, asking it to reverse the latest uncommitted changes applied to objects in the object graph.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/undo()
func (NSManagedObjectContext) UndoManager ¶
func (m NSManagedObjectContext) UndoManager() foundation.UndoManager
The object that provides undo support for the context.
Discussion ¶
Enable undo support for a context by setting this property to an instance of UndoManager. This can be an undo manager that’s exclusive to the context, or an existing undo manager if you want to integrate the context’s undo operations with those of the rest of your app.
If your context uses an undo manager, you can realize a performance benefit by temporarily setting this property to `nil` when performing expensive operations on that context, such as importing a large number of objects.
The default value is `nil`.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/undoManager
func (NSManagedObjectContext) UpdatedObjects ¶
func (m NSManagedObjectContext) UpdatedObjects() foundation.INSSet
The set of objects registered with the context that have uncommitted changes.
Discussion ¶
A managed object context does not post key-value observing notifications when the return value of `updatedObjects` changes. A context does, however, post a NSManagedObjectContextObjectsDidChange notification when a change is made, and a NSManagedObjectContextWillSave notification and a NSManagedObjectContextDidSave notification before and after changes are committed respectively.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/updatedObjects
func (NSManagedObjectContext) UserInfo ¶
func (m NSManagedObjectContext) UserInfo() foundation.INSDictionary
The user information for the context.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContext/userInfo
type NSManagedObjectContextClass ¶
type NSManagedObjectContextClass struct {
// contains filtered or unexported fields
}
func GetNSManagedObjectContextClass ¶
func GetNSManagedObjectContextClass() NSManagedObjectContextClass
GetNSManagedObjectContextClass returns the class object for NSManagedObjectContext.
func (NSManagedObjectContextClass) Alloc ¶
func (nc NSManagedObjectContextClass) Alloc() NSManagedObjectContext
Alloc allocates memory for a new instance of the class.
func (NSManagedObjectContextClass) Class ¶
func (nc NSManagedObjectContextClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (NSManagedObjectContextClass) MergeChangesFromRemoteContextSaveIntoContexts ¶
func (_NSManagedObjectContextClass NSManagedObjectContextClass) MergeChangesFromRemoteContextSaveIntoContexts(changeNotificationData foundation.INSDictionary, contexts []NSManagedObjectContext)
Handles changes from other processes or from a serialized state.
Discussion ¶
This method more efficiently merges changes into multiple contexts as well as nested contexts. The dictionary keys should be one or more from an NSManagedObjectContextObjectsDidChange: NSInsertedObjectsKey, NSUpdatedObjectsKey, NSDeletedObjectsKey. The values should be an NSArray of either NSManagedObjectID or NSURL objects conforming to valid results from NSManagedObjectID.URIRepresentation.
type NSManagedObjectContextConcurrencyType ¶
type NSManagedObjectContextConcurrencyType uint
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectContextConcurrencyType
const ( // NSConfinementConcurrencyType: Specifies that the context will use the thread confinement pattern. NSConfinementConcurrencyType NSManagedObjectContextConcurrencyType = 0 // NSMainQueueConcurrencyType: Specifies that the context will be associated with the main queue. NSMainQueueConcurrencyType NSManagedObjectContextConcurrencyType = 0x2 // NSPrivateQueueConcurrencyType: Specifies that the context will be associated with a private dispatch queue. NSPrivateQueueConcurrencyType NSManagedObjectContextConcurrencyType = 0x1 )
func (NSManagedObjectContextConcurrencyType) String ¶
func (e NSManagedObjectContextConcurrencyType) String() string
type NSManagedObjectID ¶
type NSManagedObjectID struct {
objectivec.Object
}
A compact, universal identifier for a managed object.
Overview ¶
This identifier forms the basis for uniquing in the Core Data Framework. A managed object ID uniquely identifies the same managed object both between managed object contexts in a single application, and in multiple applications (as in distributed systems). Identifiers contain the information needed to exactly describe an object in a persistent store (like the primary key in the database), although the detailed information is not exposed. The framework completely encapsulates the “external” information and presents a clean object oriented interface.
Object IDs can be transformed into a URI representation which can be archived and recreated later to refer back to a given object (using NSPersistentStoreCoordinator.ManagedObjectIDForURIRepresentation (NSPersistentStoreCoordinator) and NSManagedObjectContext.ObjectWithID (NSManagedObjectContext). For example, the last selected group in an application could be stored in the user defaults through the group object’s ID. You can also use object ID URI representations to store “weak” relationships across persistent stores (where no hard join is possible).
Getting Managed Object ID Information ¶
- NSManagedObjectID.Entity: The entity description associated with the object ID.
- NSManagedObjectID.IsTemporaryID: A Boolean value that indicates whether the object ID is temporary.
- NSManagedObjectID.PersistentStore: The persistent store that fetched the object for the object ID.
- NSManagedObjectID.URIRepresentation: Returns a URI that provides an archiveable reference to the object for the object ID.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectID
func NSManagedObjectIDFromID ¶
func NSManagedObjectIDFromID(id objc.ID) NSManagedObjectID
NSManagedObjectIDFromID constructs a NSManagedObjectID from an objc.ID.
A compact, universal identifier for a managed object.
func NewNSManagedObjectID ¶
func NewNSManagedObjectID() NSManagedObjectID
NewNSManagedObjectID creates a new NSManagedObjectID instance.
func (NSManagedObjectID) Autorelease ¶
func (m NSManagedObjectID) Autorelease() NSManagedObjectID
Autorelease adds the receiver to the current autorelease pool.
func (NSManagedObjectID) Entity ¶
func (m NSManagedObjectID) Entity() INSEntityDescription
The entity description associated with the object ID.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectID/entity
func (NSManagedObjectID) Init ¶
func (m NSManagedObjectID) Init() NSManagedObjectID
Init initializes the instance.
func (NSManagedObjectID) IsTemporaryID ¶
func (m NSManagedObjectID) IsTemporaryID() bool
A Boolean value that indicates whether the object ID is temporary.
Discussion ¶
true if the receiver is temporary, otherwise false. Most object IDs return false. New objects inserted into a managed object context are assigned a temporary ID which is replaced with a permanent one once the object gets saved to a persistent store.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectID/isTemporaryID
func (NSManagedObjectID) PersistentStore ¶
func (m NSManagedObjectID) PersistentStore() INSPersistentStore
The persistent store that fetched the object for the object ID.
Discussion ¶
`nil` if the ID is for a newly-inserted object that has not yet been saved to a persistent store.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectID/persistentStore
func (NSManagedObjectID) URIRepresentation ¶
func (m NSManagedObjectID) URIRepresentation() foundation.NSURL
Returns a URI that provides an archiveable reference to the object for the object ID.
Return Value ¶
An [NSURL] object containing a URI that provides an archiveable reference to the object which the receiver represents.
Discussion ¶
If the corresponding managed object has not yet been saved, the object ID (and hence URI) is a temporary value that will change when the corresponding managed object is saved.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectID/uriRepresentation()
type NSManagedObjectIDClass ¶
type NSManagedObjectIDClass struct {
// contains filtered or unexported fields
}
func GetNSManagedObjectIDClass ¶
func GetNSManagedObjectIDClass() NSManagedObjectIDClass
GetNSManagedObjectIDClass returns the class object for NSManagedObjectID.
func (NSManagedObjectIDClass) Alloc ¶
func (nc NSManagedObjectIDClass) Alloc() NSManagedObjectID
Alloc allocates memory for a new instance of the class.
func (NSManagedObjectIDClass) Class ¶
func (nc NSManagedObjectIDClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSManagedObjectModel ¶
type NSManagedObjectModel struct {
objectivec.Object
}
A programmatic representation of the `XCUIElementTypeXcdatamodeld` file describing your objects.
Overview ¶
The model contains one or more NSEntityDescription objects representing the entities in the schema. Each NSEntityDescription object has property description objects (instances of subclasses of NSPropertyDescription) that represent the properties (or fields) of the entity in the schema. The Core Data framework uses this description in several ways:
- Constraining UI creation in Interface Builder - Validating attribute and relationship values at runtime - Mapping between your managed objects and a database or file-based schema for object persistence
A managed object model maintains a mapping between each of its entity objects and a corresponding managed object class for use with the persistent storage mechanisms in the Core Data framework. You can determine the entity for a particular managed object with the `entity` method.
You typically create managed object models using the data modeling tool in Xcode, but it’s possible to build a model programmatically if needed.
Loading a model file ¶
Managed object model files are typically stored in a project or a framework. To load a model, you provide an URL to the constructor. Note that loading a model doesn’t have the effect of loading all of its entities.
Storing fetch requests ¶
Frequently, you need a collection of objects that share features in common. Sometimes you can define those features (property values) in advance; sometimes you need to be able to supply values at runtime. For example, suppose you want to retrieve all movies owned by Pixar, or retrieve all movies that earned more than an amount specified by the user at runtime.
Fetch requests are often predefined in a managed object model as templates. They allow you to predefine named queries and their parameters in the model. Typically they contain variables that need to be substituted at runtime. NSManagedObjectModel provides an API to retrieve a stored fetch request by name, and to perform variable substitution—see NSManagedObjectModel.FetchRequestTemplateForName and NSManagedObjectModel.FetchRequestFromTemplateWithNameSubstitutionVariables.
You typically define fetch request templates using the Data Model editor in Xcode. You can also create fetch request templates programmatically, and associate them with a model using NSManagedObjectModel.SetFetchRequestTemplateForName.
Supporting multiple configurations for the same model ¶
You may want to specify different sets of entities for the same model to be used in different situations. For example, suppose certain entities should only be available if a user has administrative privileges. To support this requirement, a model may have more than one configuration. Each configuration is named, and has an associated set of entities. The sets may overlap. You establish configurations programmatically using NSManagedObjectModel.SetEntitiesForConfiguration or using the Xcode design tool, and retrieve the entities for a given configuration name using NSManagedObjectModel.EntitiesForConfiguration.
Changing models ¶
Because a model describes the structure of the data in a persistent store, changing any parts of a model that alters the schema renders it incompatible with (and so unable to open) the stores it previously created. If you change your schema, you therefore need to migrate the data in existing stores to new version (see Core Data Model Versioning and Data Migration Programming Guide). For example, if you add a new entity or a new attribute to an existing entity, you can’t open old stores; if you add a validation constraint or set a new default value for an attribute, you can open old stores.
Editing models at runtime ¶
Managed object models are editable until they are used by an object graph manager (a managed object context or a persistent store coordinator). This allows you to create or modify them dynamically until their first use. However, once a model is being used, it must not be changed. This is enforced at runtime—when the object manager first fetches data using a model, the whole of that model becomes uneditable. Any attempt to mutate a model or any of its sub-objects after that point throws an exception. If you need to modify a model that’s in use, create a copy, modify the copy, and then discard the objects with the old model.
Enumerating entities with fast enumeration ¶
In macOS 10.5 and later and on iOS, NSManagedObjectModel supports the NSFastEnumeration protocol. You can use this to enumerate over a model’s entities, as illustrated in the following example:
Creating a managed object model ¶
- NSManagedObjectModel.InitWithContentsOfURL: Initializes the managed object model using the model file at the specified URL.
Managing entities and configurations ¶
- NSManagedObjectModel.Entities: The entities in the model.
- NSManagedObjectModel.SetEntities
- NSManagedObjectModel.EntitiesByName: The entities of the model, keyed by name.
- NSManagedObjectModel.Configurations: All the available configuration names of the model.
- NSManagedObjectModel.EntitiesForConfiguration: Returns the entities of the model for a specified configuration.
- NSManagedObjectModel.SetEntitiesForConfiguration: Associates the specified entities with the model using the given configuration name.
Manipulating fetch request templates ¶
- NSManagedObjectModel.FetchRequestTemplatesByName: A dictionary of the receiver’s fetch request templates, keyed by name.
- NSManagedObjectModel.FetchRequestTemplateForName: Returns the fetch request with a specified name.
- NSManagedObjectModel.FetchRequestFromTemplateWithNameSubstitutionVariables: Returns a copy of the fetch request template with the variables substituted by values from the substitutions dictionary.
- NSManagedObjectModel.SetFetchRequestTemplateForName: Associates the specified fetch request with the receiver using the given name.
Handling localization ¶
- NSManagedObjectModel.LocalizationDictionary: The localization dictionary of the model.
- NSManagedObjectModel.SetLocalizationDictionary
Versioning and migrating entities ¶
- NSManagedObjectModel.VersionChecksum: The Base64-encoded 128-bit model version hash.
- NSManagedObjectModel.VersionIdentifiers: The set of developer-defined version identifiers for the object model.
- NSManagedObjectModel.SetVersionIdentifiers
- NSManagedObjectModel.EntityVersionHashesByName: The dictionary of the model’s entity names and their corresponding version hashes.
- NSManagedObjectModel.IsConfigurationCompatibleWithStoreMetadata: Returns a Boolean value that indicates whether a given configuration in the model is compatible with given metadata from a persistent store.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectModel
func NSManagedObjectModelFromID ¶
func NSManagedObjectModelFromID(id objc.ID) NSManagedObjectModel
NSManagedObjectModelFromID constructs a NSManagedObjectModel from an objc.ID.
A programmatic representation of the `XCUIElementTypeXcdatamodeld` file describing your objects.
func NewManagedObjectModelByMergingModels ¶
func NewManagedObjectModelByMergingModels(models []NSManagedObjectModel) NSManagedObjectModel
Creates a single model from an array of existing models.
models: An array of instances of NSManagedObjectModel.
Return Value ¶
A single model made by combining the models in `models`.
Discussion ¶
You use this method to combine multiple models (typically from different frameworks) into one.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectModel/init(byMerging:)
func NewManagedObjectModelByMergingModelsForStoreMetadata ¶
func NewManagedObjectModelByMergingModelsForStoreMetadata(models []NSManagedObjectModel, metadata foundation.INSDictionary) NSManagedObjectModel
Returns, for the version information in given metadata, a model merged from a given array of models.
models: An array of instances of NSManagedObjectModel.
metadata: A dictionary containing version information from the metadata for a persistent store.
Return Value ¶
A merged model from `models` for the version information in `metadata`. If a model cannot be created to match the version information in `metadata`, returns `nil`.
Discussion ¶
This is the companion method to NSManagedObjectModelClass.MergedModelFromBundlesForStoreMetadata.
func NewManagedObjectModelWithContentsOfURL ¶
func NewManagedObjectModelWithContentsOfURL(url foundation.NSURL) NSManagedObjectModel
Initializes the managed object model using the model file at the specified URL.
url: An URL object specifying the location of a model file.
Return Value ¶
A managed object model initialized using the file at `url`.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectModel/init(contentsOf:)
func NewNSManagedObjectModel ¶
func NewNSManagedObjectModel() NSManagedObjectModel
NewNSManagedObjectModel creates a new NSManagedObjectModel instance.
func (NSManagedObjectModel) Autorelease ¶
func (m NSManagedObjectModel) Autorelease() NSManagedObjectModel
Autorelease adds the receiver to the current autorelease pool.
func (NSManagedObjectModel) Configurations ¶
func (m NSManagedObjectModel) Configurations() []string
All the available configuration names of the model.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectModel/configurations
func (NSManagedObjectModel) EncodeWithCoder ¶
func (m NSManagedObjectModel) EncodeWithCoder(coder foundation.INSCoder)
func (NSManagedObjectModel) Entities ¶
func (m NSManagedObjectModel) Entities() []NSEntityDescription
The entities in the model.
Discussion ¶
Entities are instances of NSEntityDescription.
Special Considerations ¶
Setting the entities for an object model raises an exception if the object model has been used by an object graph manager.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectModel/entities
func (NSManagedObjectModel) EntitiesByName ¶
func (m NSManagedObjectModel) EntitiesByName() foundation.INSDictionary
The entities of the model, keyed by name.
Discussion ¶
Entities are instances of NSEntityDescription.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectModel/entitiesByName
func (NSManagedObjectModel) EntitiesForConfiguration ¶
func (m NSManagedObjectModel) EntitiesForConfiguration(configuration string) []NSEntityDescription
Returns the entities of the model for a specified configuration.
configuration: The name of a configuration in the receiver.
Return Value ¶
An array containing the entities of the receiver for the configuration specified by `configuration`.
func (NSManagedObjectModel) EntityVersionHashesByName ¶
func (m NSManagedObjectModel) EntityVersionHashesByName() foundation.INSDictionary
The dictionary of the model’s entity names and their corresponding version hashes.
Discussion ¶
Core Data use the dictionary of version hash information is to determine schema compatibility.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectModel/entityVersionHashesByName
func (NSManagedObjectModel) FetchRequestFromTemplateWithNameSubstitutionVariables ¶
func (m NSManagedObjectModel) FetchRequestFromTemplateWithNameSubstitutionVariables(name string, variables foundation.INSDictionary) INSFetchRequest
Returns a copy of the fetch request template with the variables substituted by values from the substitutions dictionary.
name: A string containing the name of a fetch request template.
variables: A dictionary containing key-value pairs where the keys are the names of variables specified in the template; the corresponding values are substituted before the fetch request is returned. The dictionary must provide values for all the variables in the template.
Return Value ¶
A copy of the fetch request template with the variables substituted by values from `variables`.
Discussion ¶
The `variables` dictionary must provide values for all the variables. If you want to test for a nil value, use `[NSNull null]`.
This method provides the usual way to bind an “abstractly” defined fetch request template to a concrete fetch. For more details on using this method, see Creating Predicates.
func (NSManagedObjectModel) FetchRequestTemplateForName ¶
func (m NSManagedObjectModel) FetchRequestTemplateForName(name string) INSFetchRequest
Returns the fetch request with a specified name.
name: A string containing the name of a fetch request template.
Return Value ¶
The fetch request named `name`.
Discussion ¶
If the template contains substitution variables, you should instead use NSManagedObjectModel.FetchRequestFromTemplateWithNameSubstitutionVariables to create a new fetch request.
func (NSManagedObjectModel) FetchRequestTemplatesByName ¶
func (m NSManagedObjectModel) FetchRequestTemplatesByName() foundation.INSDictionary
A dictionary of the receiver’s fetch request templates, keyed by name.
Discussion ¶
If the template contains a predicate with substitution variables, you should instead use NSManagedObjectModel.FetchRequestFromTemplateWithNameSubstitutionVariables to create a new fetch request.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectModel/fetchRequestTemplatesByName
func (NSManagedObjectModel) Init ¶
func (m NSManagedObjectModel) Init() NSManagedObjectModel
Init initializes the instance.
func (NSManagedObjectModel) InitWithContentsOfURL ¶
func (m NSManagedObjectModel) InitWithContentsOfURL(url foundation.NSURL) NSManagedObjectModel
Initializes the managed object model using the model file at the specified URL.
url: An URL object specifying the location of a model file.
Return Value ¶
A managed object model initialized using the file at `url`.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectModel/init(contentsOf:)
func (NSManagedObjectModel) IsConfigurationCompatibleWithStoreMetadata ¶
func (m NSManagedObjectModel) IsConfigurationCompatibleWithStoreMetadata(configuration string, metadata foundation.INSDictionary) bool
Returns a Boolean value that indicates whether a given configuration in the model is compatible with given metadata from a persistent store.
configuration: The name of a configuration in the receiver. Pass `nil` to specify no configuration.
metadata: Metadata for a persistent store.
Return Value ¶
true if the configuration in the receiver specified by `configuration` is compatible with the store metadata given by `metadata`, otherwise false.
Discussion ¶
This method compares the version information in the store metadata with the entity versions of a given configuration. For information on specific differences, use NSManagedObjectModel.EntityVersionHashesByName and perform an entity-by-entity comparison.
func (NSManagedObjectModel) LocalizationDictionary ¶
func (m NSManagedObjectModel) LocalizationDictionary() foundation.INSDictionary
The localization dictionary of the model.
Discussion ¶
The following table describes the key and value pattern for the localization dictionary.
[Table data omitted]
(1) For properties in different entities with the same non-localized name but that should have different localized names.
Special Considerations ¶
In OS X v10.4, `localizationDictionary` may return `nil` until Core Data lazily loads the dictionary for its own purposes (for example, reporting a localized error).
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectModel/localizationDictionary
func (NSManagedObjectModel) SetEntities ¶
func (m NSManagedObjectModel) SetEntities(value []NSEntityDescription)
func (NSManagedObjectModel) SetEntitiesForConfiguration ¶
func (m NSManagedObjectModel) SetEntitiesForConfiguration(entities []NSEntityDescription, configuration string)
Associates the specified entities with the model using the given configuration name.
entities: An array of instances of NSEntityDescription.
configuration: A name for the configuration.
Discussion ¶
This method raises an exception if the receiver has been used by an object graph manager.
func (NSManagedObjectModel) SetFetchRequestTemplateForName ¶
func (m NSManagedObjectModel) SetFetchRequestTemplateForName(fetchRequestTemplate INSFetchRequest, name string)
Associates the specified fetch request with the receiver using the given name.
fetchRequestTemplate: A fetch request, typically containing predicates with variables for substitution.
name: A string that specifies the name of the fetch request template.
Discussion ¶
For more details on using this method, see Creating Predicates.
Special Considerations ¶
This method raises an exception if the receiver has been used by an object graph manager.
func (NSManagedObjectModel) SetLocalizationDictionary ¶
func (m NSManagedObjectModel) SetLocalizationDictionary(value foundation.INSDictionary)
func (NSManagedObjectModel) SetVersionIdentifiers ¶
func (m NSManagedObjectModel) SetVersionIdentifiers(value foundation.INSSet)
func (NSManagedObjectModel) VersionChecksum ¶
func (m NSManagedObjectModel) VersionChecksum() string
The Base64-encoded 128-bit model version hash.
Discussion ¶
This value is also available in the versioned model’s `VersionInfo.Plist()` file and in Xcode’s build log.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectModel/versionChecksum
func (NSManagedObjectModel) VersionIdentifiers ¶
func (m NSManagedObjectModel) VersionIdentifiers() foundation.INSSet
The set of developer-defined version identifiers for the object model.
Discussion ¶
Merged models return the combined collection of identifiers. The Core Data framework does not assign a default identifier to object models, nor does it depend on this value at runtime. For models you create in Xcode, set this value in the model inspector.
Use this value when debugging to help determine the models that Core Data merges to create the merged model.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectModel/versionIdentifiers
type NSManagedObjectModelClass ¶
type NSManagedObjectModelClass struct {
// contains filtered or unexported fields
}
func GetNSManagedObjectModelClass ¶
func GetNSManagedObjectModelClass() NSManagedObjectModelClass
GetNSManagedObjectModelClass returns the class object for NSManagedObjectModel.
func (NSManagedObjectModelClass) Alloc ¶
func (nc NSManagedObjectModelClass) Alloc() NSManagedObjectModel
Alloc allocates memory for a new instance of the class.
func (NSManagedObjectModelClass) Class ¶
func (nc NSManagedObjectModelClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (NSManagedObjectModelClass) MergedModelFromBundles ¶
func (_NSManagedObjectModelClass NSManagedObjectModelClass) MergedModelFromBundles(bundles []foundation.NSBundle) NSManagedObjectModel
Returns a model created by merging all the models found in given bundles.
bundles: An array of instances of [NSBundle] to search. If you specify `nil`, then the main bundle is searched.
Return Value ¶
A model created by merging all the models found in `bundles`.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectModel/mergedModel(from:)
func (NSManagedObjectModelClass) MergedModelFromBundlesForStoreMetadata ¶
func (_NSManagedObjectModelClass NSManagedObjectModelClass) MergedModelFromBundlesForStoreMetadata(bundles []foundation.NSBundle, metadata foundation.INSDictionary) NSManagedObjectModel
Returns a merged model from a specified array for the version information in provided metadata.
bundles: An array of bundles.
metadata: A dictionary containing version information from the metadata for a persistent store.
Return Value ¶
The managed object model used to create the store for the metadata. If a model cannot be created to match the version information specified by `metadata`, returns `nil`.
Discussion ¶
This method is a companion to NSManagedObjectModelClass.MergedModelFromBundles.
type NSManagedObjectModelReference ¶
type NSManagedObjectModelReference struct {
objectivec.Object
}
An object that describes a specific version of an object model.
Creating a reference ¶
- NSManagedObjectModelReference.InitWithModelVersionChecksum: Creates an object model reference for the specified model.
- NSManagedObjectModelReference.InitWithFileURLVersionChecksum: Creates an object model reference for the model at the specified file URL.
- NSManagedObjectModelReference.InitWithNameInBundleVersionChecksum: Creates an object model reference for the named model in the specified bundle.
- NSManagedObjectModelReference.InitWithEntityVersionHashesInBundleVersionChecksum: Creates an object model reference with the entities corresponding to the specified entity version hashes.
Resolving the model object ¶
- NSManagedObjectModelReference.ResolvedModel: The resolved object model.
- NSManagedObjectModelReference.VersionChecksum: The version checksum of the resolved model.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectModelReference
func NSManagedObjectModelReferenceFromID ¶
func NSManagedObjectModelReferenceFromID(id objc.ID) NSManagedObjectModelReference
NSManagedObjectModelReferenceFromID constructs a NSManagedObjectModelReference from an objc.ID.
An object that describes a specific version of an object model.
func NewManagedObjectModelReferenceWithEntityVersionHashesInBundleVersionChecksum ¶
func NewManagedObjectModelReferenceWithEntityVersionHashesInBundleVersionChecksum(versionHash foundation.INSDictionary, bundle foundation.NSBundle, versionChecksum string) NSManagedObjectModelReference
Creates an object model reference with the entities corresponding to the specified entity version hashes.
versionHash: The dictionary of entity names and their corresponding version hashes.
bundle: The bundle to search.
versionChecksum: The checksum of the object model’s version.
Discussion ¶
To determine an object model’s version checksum, use its NSManagedObjectModel.VersionChecksum property. Alternatively, you can find the checksum in the versioned model’s `VersionInfo.Plist()` file or in Xcode’s build log.
func NewManagedObjectModelReferenceWithFileURLVersionChecksum ¶
func NewManagedObjectModelReferenceWithFileURLVersionChecksum(fileURL foundation.NSURL, versionChecksum string) NSManagedObjectModelReference
Creates an object model reference for the model at the specified file URL.
fileURL: The on-disk location of the managed object model.
versionChecksum: The checksum of the object model’s version.
Discussion ¶
To determine an object model’s version checksum, use its NSManagedObjectModel.VersionChecksum property. Alternatively, you can find the checksum in the versioned model’s `VersionInfo.Plist()` file or in Xcode’s build log.
func NewManagedObjectModelReferenceWithModelVersionChecksum ¶
func NewManagedObjectModelReferenceWithModelVersionChecksum(model INSManagedObjectModel, versionChecksum string) NSManagedObjectModelReference
Creates an object model reference for the specified model.
model: The managed object model.
versionChecksum: The checksum of the object model’s version.
Discussion ¶
To determine an object model’s version checksum, use its NSManagedObjectModel.VersionChecksum property. Alternatively, you can find the checksum in the versioned model’s `VersionInfo.Plist()` file or in Xcode’s build log.
func NewManagedObjectModelReferenceWithNameInBundleVersionChecksum ¶
func NewManagedObjectModelReferenceWithNameInBundleVersionChecksum(modelName string, bundle foundation.NSBundle, versionChecksum string) NSManagedObjectModelReference
Creates an object model reference for the named model in the specified bundle.
modelName: The name of the managed object model in the specified bundle.
bundle: The bundle to search.
versionChecksum: The checksum of the object model’s version.
Discussion ¶
To determine an object model’s version checksum, use its NSManagedObjectModel.VersionChecksum property. Alternatively, you can find the checksum in the versioned model’s `VersionInfo.Plist()` file or in Xcode’s build log.
func NewNSManagedObjectModelReference ¶
func NewNSManagedObjectModelReference() NSManagedObjectModelReference
NewNSManagedObjectModelReference creates a new NSManagedObjectModelReference instance.
func (NSManagedObjectModelReference) Autorelease ¶
func (m NSManagedObjectModelReference) Autorelease() NSManagedObjectModelReference
Autorelease adds the receiver to the current autorelease pool.
func (NSManagedObjectModelReference) Init ¶
func (m NSManagedObjectModelReference) Init() NSManagedObjectModelReference
Init initializes the instance.
func (NSManagedObjectModelReference) InitWithEntityVersionHashesInBundleVersionChecksum ¶
func (m NSManagedObjectModelReference) InitWithEntityVersionHashesInBundleVersionChecksum(versionHash foundation.INSDictionary, bundle foundation.NSBundle, versionChecksum string) NSManagedObjectModelReference
Creates an object model reference with the entities corresponding to the specified entity version hashes.
versionHash: The dictionary of entity names and their corresponding version hashes.
bundle: The bundle to search.
versionChecksum: The checksum of the object model’s version.
Discussion ¶
To determine an object model’s version checksum, use its NSManagedObjectModel.VersionChecksum property. Alternatively, you can find the checksum in the versioned model’s `VersionInfo.Plist()` file or in Xcode’s build log.
func (NSManagedObjectModelReference) InitWithFileURLVersionChecksum ¶
func (m NSManagedObjectModelReference) InitWithFileURLVersionChecksum(fileURL foundation.NSURL, versionChecksum string) NSManagedObjectModelReference
Creates an object model reference for the model at the specified file URL.
fileURL: The on-disk location of the managed object model.
versionChecksum: The checksum of the object model’s version.
Discussion ¶
To determine an object model’s version checksum, use its NSManagedObjectModel.VersionChecksum property. Alternatively, you can find the checksum in the versioned model’s `VersionInfo.Plist()` file or in Xcode’s build log.
func (NSManagedObjectModelReference) InitWithModelVersionChecksum ¶
func (m NSManagedObjectModelReference) InitWithModelVersionChecksum(model INSManagedObjectModel, versionChecksum string) NSManagedObjectModelReference
Creates an object model reference for the specified model.
model: The managed object model.
versionChecksum: The checksum of the object model’s version.
Discussion ¶
To determine an object model’s version checksum, use its NSManagedObjectModel.VersionChecksum property. Alternatively, you can find the checksum in the versioned model’s `VersionInfo.Plist()` file or in Xcode’s build log.
func (NSManagedObjectModelReference) InitWithNameInBundleVersionChecksum ¶
func (m NSManagedObjectModelReference) InitWithNameInBundleVersionChecksum(modelName string, bundle foundation.NSBundle, versionChecksum string) NSManagedObjectModelReference
Creates an object model reference for the named model in the specified bundle.
modelName: The name of the managed object model in the specified bundle.
bundle: The bundle to search.
versionChecksum: The checksum of the object model’s version.
Discussion ¶
To determine an object model’s version checksum, use its NSManagedObjectModel.VersionChecksum property. Alternatively, you can find the checksum in the versioned model’s `VersionInfo.Plist()` file or in Xcode’s build log.
func (NSManagedObjectModelReference) ResolvedModel ¶
func (m NSManagedObjectModelReference) ResolvedModel() INSManagedObjectModel
The resolved object model.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectModelReference/resolvedModel
func (NSManagedObjectModelReference) VersionChecksum ¶
func (m NSManagedObjectModelReference) VersionChecksum() string
The version checksum of the resolved model.
See: https://developer.apple.com/documentation/CoreData/NSManagedObjectModelReference/versionChecksum
type NSManagedObjectModelReferenceClass ¶
type NSManagedObjectModelReferenceClass struct {
// contains filtered or unexported fields
}
func GetNSManagedObjectModelReferenceClass ¶
func GetNSManagedObjectModelReferenceClass() NSManagedObjectModelReferenceClass
GetNSManagedObjectModelReferenceClass returns the class object for NSManagedObjectModelReference.
func (NSManagedObjectModelReferenceClass) Alloc ¶
func (nc NSManagedObjectModelReferenceClass) Alloc() NSManagedObjectModelReference
Alloc allocates memory for a new instance of the class.
func (NSManagedObjectModelReferenceClass) Class ¶
func (nc NSManagedObjectModelReferenceClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSManagedObjectValidationErrorConstants ¶
type NSManagedObjectValidationErrorConstants int
const ( // NSCoreDataError: An error code that indicates a nonspecific Core Data error. NSCoreDataError NSManagedObjectValidationErrorConstants = 134060 // NSEntityMigrationPolicyError: An error code that indicates a migration failure during processing of an entity migration policy. NSEntityMigrationPolicyError NSManagedObjectValidationErrorConstants = 134170 // NSExternalRecordImportError: Error code to denote a general error encountered while importing external records. NSExternalRecordImportError NSManagedObjectValidationErrorConstants = 134200 // NSInferredMappingModelError: Error code to denote a problem with the creation of an inferred mapping model. NSInferredMappingModelError NSManagedObjectValidationErrorConstants = 134190 // NSManagedObjectConstraintMergeError: Error code to denote a problem with the merging of instances of a managed object. NSManagedObjectConstraintMergeError NSManagedObjectValidationErrorConstants = 133021 // NSManagedObjectConstraintValidationError: Error code to denote a problem with the validation of a managed object. NSManagedObjectConstraintValidationError NSManagedObjectValidationErrorConstants = 1551 // NSManagedObjectContextLockingError: Error code to denote an inability to acquire a lock in a managed object context. NSManagedObjectContextLockingError NSManagedObjectValidationErrorConstants = 132000 // NSManagedObjectExternalRelationshipError: Error code to denote that an object being saved has a relationship containing an object from another store. NSManagedObjectExternalRelationshipError NSManagedObjectValidationErrorConstants = 133010 // NSManagedObjectMergeError: Error code to denote that a merge policy failed—Core Data is unable to complete merging. NSManagedObjectMergeError NSManagedObjectValidationErrorConstants = 133020 // NSManagedObjectModelReferenceNotFoundError: An error code that indicates Core Data isn’t able to find or instantiate the referenced object model. NSManagedObjectModelReferenceNotFoundError NSManagedObjectValidationErrorConstants = 134504 // NSManagedObjectReferentialIntegrityError: Error code to denote an attempt to fire a fault pointing to an object that does not exist. NSManagedObjectReferentialIntegrityError NSManagedObjectValidationErrorConstants = 133000 // NSManagedObjectValidationError: Error code to denote a generic validation error. NSManagedObjectValidationError NSManagedObjectValidationErrorConstants = 1550 // NSMigrationCancelledError: Error code to denote that migration failed due to manual cancellation. NSMigrationCancelledError NSManagedObjectValidationErrorConstants = 134120 // NSMigrationConstraintViolationError: Error code to denote a problem with the validation of a managed object during a migration. NSMigrationConstraintViolationError NSManagedObjectValidationErrorConstants = 134111 // NSMigrationError: Error code to denote a general migration error. NSMigrationError NSManagedObjectValidationErrorConstants = 134110 // NSMigrationManagerDestinationStoreError: Error code to denote that migration failed due to a problem with the destination data store. NSMigrationManagerDestinationStoreError NSManagedObjectValidationErrorConstants = 134160 // NSMigrationManagerSourceStoreError: Error code to denote that migration failed due to a problem with the source data store. NSMigrationManagerSourceStoreError NSManagedObjectValidationErrorConstants = 134150 // NSMigrationMissingMappingModelError: Error code to denote that migration failed due to a missing mapping model. NSMigrationMissingMappingModelError NSManagedObjectValidationErrorConstants = 134140 // NSMigrationMissingSourceModelError: Error code to denote that migration failed due to a missing source data model. NSMigrationMissingSourceModelError NSManagedObjectValidationErrorConstants = 134130 // NSPersistentHistoryTokenExpiredError: Error code to denote that the persistent history token has expired. NSPersistentHistoryTokenExpiredError NSManagedObjectValidationErrorConstants = 134301 // NSPersistentStoreCoordinatorLockingError: Error code to denote an inability to acquire a lock in a persistent store. NSPersistentStoreCoordinatorLockingError NSManagedObjectValidationErrorConstants = 132010 // NSPersistentStoreIncompatibleSchemaError: Error code to denote that a persistent store returned an error for a save operation. NSPersistentStoreIncompatibleSchemaError NSManagedObjectValidationErrorConstants = 134020 // NSPersistentStoreIncompatibleVersionHashError: Error code to denote that entity version hashes in the store are incompatible with the current managed object model. NSPersistentStoreIncompatibleVersionHashError NSManagedObjectValidationErrorConstants = 134100 // NSPersistentStoreIncompleteSaveError: Error code to denote that one or more of the stores returned an error during a save operations. NSPersistentStoreIncompleteSaveError NSManagedObjectValidationErrorConstants = 134040 // NSPersistentStoreInvalidTypeError: Error code to denote an unknown persistent store type/format/version. NSPersistentStoreInvalidTypeError NSManagedObjectValidationErrorConstants = 134000 // NSPersistentStoreOpenError: Error code to denote an error occurred while attempting to open a persistent store. NSPersistentStoreOpenError NSManagedObjectValidationErrorConstants = 134080 // NSPersistentStoreOperationError: Error code to denote that a persistent store operation failed. NSPersistentStoreOperationError NSManagedObjectValidationErrorConstants = 134070 // NSPersistentStoreSaveConflictsError: Error code to denote that an unresolved merge conflict was encountered during a save. NSPersistentStoreSaveConflictsError NSManagedObjectValidationErrorConstants = 134050 // NSPersistentStoreSaveError: Error code to denote that a persistent store returned an error for a save operation. NSPersistentStoreSaveError NSManagedObjectValidationErrorConstants = 134030 // NSPersistentStoreTimeoutError: Error code to denote that Core Data failed to connect to a persistent store within the time specified by [NSPersistentStoreTimeoutOption]. NSPersistentStoreTimeoutError NSManagedObjectValidationErrorConstants = 134090 // NSPersistentStoreTypeMismatchError: Error code returned by a persistent store coordinator if a store is accessed that does not match the specified type. NSPersistentStoreTypeMismatchError NSManagedObjectValidationErrorConstants = 134010 // NSPersistentStoreUnsupportedRequestTypeError: Error code to denote that an [NSPersistentStore] subclass was passed a request (an instance of NSPersistentStoreRequest) that it did not understand. NSPersistentStoreUnsupportedRequestTypeError NSManagedObjectValidationErrorConstants = 134091 // NSSQLiteError: Error code to denote a general SQLite error. NSSQLiteError NSManagedObjectValidationErrorConstants = 134180 // NSStagedMigrationBackwardMigrationError: An error code that indicates a failed migration because of an attempt to migrate backward. NSStagedMigrationBackwardMigrationError NSManagedObjectValidationErrorConstants = 134506 // NSStagedMigrationFrameworkVersionMismatchError: An error code that indicates a failed migration because the persistent store’s metadata doesn’t support staged lightweight migrations. NSStagedMigrationFrameworkVersionMismatchError NSManagedObjectValidationErrorConstants = 134505 // NSValidationDateTooLateError: Error code to denote some date value is too late. NSValidationDateTooLateError NSManagedObjectValidationErrorConstants = 1630 // NSValidationDateTooSoonError: Error code to denote some date value is too soon. NSValidationDateTooSoonError NSManagedObjectValidationErrorConstants = 1640 // NSValidationInvalidDateError: Error code to denote some date value fails to match date pattern. NSValidationInvalidDateError NSManagedObjectValidationErrorConstants = 1650 // NSValidationInvalidURIError: Error code to denote a problem with the validation of a URI property. NSValidationInvalidURIError NSManagedObjectValidationErrorConstants = 1690 // NSValidationMissingMandatoryPropertyError: Error code for a non-optional property with a nil value. NSValidationMissingMandatoryPropertyError NSManagedObjectValidationErrorConstants = 1570 // NSValidationMultipleErrorsError: Error code to denote an error containing multiple validation errors. NSValidationMultipleErrorsError NSManagedObjectValidationErrorConstants = 1560 // NSValidationNumberTooLargeError: Error code to denote some numerical value is too large. NSValidationNumberTooLargeError NSManagedObjectValidationErrorConstants = 1610 // NSValidationNumberTooSmallError: Error code to denote some numerical value is too small. NSValidationNumberTooSmallError NSManagedObjectValidationErrorConstants = 1620 // NSValidationRelationshipDeniedDeleteError: Error code to denote some relationship with delete rule [NSDeleteRuleDeny] is non-empty. NSValidationRelationshipDeniedDeleteError NSManagedObjectValidationErrorConstants = 1600 // NSValidationRelationshipExceedsMaximumCountError: Error code to denote a bounded to-many relationship with too many destination objects. NSValidationRelationshipExceedsMaximumCountError NSManagedObjectValidationErrorConstants = 1590 // NSValidationRelationshipLacksMinimumCountError: Error code to denote a to-many relationship with too few destination objects. NSValidationRelationshipLacksMinimumCountError NSManagedObjectValidationErrorConstants = 1580 // NSValidationStringPatternMatchingError: Error code to denote some string value fails to match some pattern. NSValidationStringPatternMatchingError NSManagedObjectValidationErrorConstants = 1680 // NSValidationStringTooLongError: Error code to denote some string value is too long. NSValidationStringTooLongError NSManagedObjectValidationErrorConstants = 1660 // NSValidationStringTooShortError: Error code to denote some string value is too short. NSValidationStringTooShortError NSManagedObjectValidationErrorConstants = 1670 )
func (NSManagedObjectValidationErrorConstants) String ¶
func (e NSManagedObjectValidationErrorConstants) String() string
type NSMappingModel ¶
type NSMappingModel struct {
objectivec.Object
}
A model instance that specifies how to map a model from a source to a destination managed object model.
Creating a Mapping ¶
- NSMappingModel.InitWithContentsOfURL: Returns a mapping model initialized from a given URL.
Managing Entity Mappings ¶
- NSMappingModel.EntityMappings: The entity mappings for the mapping model.
- NSMappingModel.SetEntityMappings
- NSMappingModel.EntityMappingsByName: The entity mappings for the mapping model, keyed by name.
See: https://developer.apple.com/documentation/CoreData/NSMappingModel
func NSMappingModelFromID ¶
func NSMappingModelFromID(id objc.ID) NSMappingModel
NSMappingModelFromID constructs a NSMappingModel from an objc.ID.
A model instance that specifies how to map a model from a source to a destination managed object model.
func NewMappingModelFromBundlesForSourceModelDestinationModel ¶
func NewMappingModelFromBundlesForSourceModelDestinationModel(bundles []foundation.NSBundle, sourceModel INSManagedObjectModel, destinationModel INSManagedObjectModel) NSMappingModel
Returns the mapping model that will translate data from the source to the destination model.
bundles: An array of bundles in which to search for mapping models.
sourceModel: The managed object model for the source store.
destinationModel: The managed object model for the destination store.
Return Value ¶
Returns the mapping model to translate data from `sourceModel` to `destinationModel`. If a suitable mapping model cannot be found, returns `nil`.
Discussion ¶
This method is a companion to the NSManagedObjectModelClass.MergedModelFromBundles and NSManagedObjectModelClass.MergedModelFromBundlesForStoreMetadata methods. In this case, the framework uses the version information from the models to locate the appropriate mapping model in the available bundles.
func NewMappingModelWithContentsOfURL ¶
func NewMappingModelWithContentsOfURL(url foundation.NSURL) NSMappingModel
Returns a mapping model initialized from a given URL.
url: The location of an archived mapping model.
Return Value ¶
A mapping model initialized from `url`.
See: https://developer.apple.com/documentation/CoreData/NSMappingModel/init(contentsOf:)
func NewNSMappingModel ¶
func NewNSMappingModel() NSMappingModel
NewNSMappingModel creates a new NSMappingModel instance.
func (NSMappingModel) Autorelease ¶
func (m NSMappingModel) Autorelease() NSMappingModel
Autorelease adds the receiver to the current autorelease pool.
func (NSMappingModel) EntityMappings ¶
func (m NSMappingModel) EntityMappings() []NSEntityMapping
The entity mappings for the mapping model.
Discussion ¶
The order of the mappings in the array determines the order in which they will be processed during migration.
See: https://developer.apple.com/documentation/CoreData/NSMappingModel/entityMappings
func (NSMappingModel) EntityMappingsByName ¶
func (m NSMappingModel) EntityMappingsByName() foundation.INSDictionary
The entity mappings for the mapping model, keyed by name.
See: https://developer.apple.com/documentation/CoreData/NSMappingModel/entityMappingsByName
func (NSMappingModel) Init ¶
func (m NSMappingModel) Init() NSMappingModel
Init initializes the instance.
func (NSMappingModel) InitWithContentsOfURL ¶
func (m NSMappingModel) InitWithContentsOfURL(url foundation.NSURL) NSMappingModel
Returns a mapping model initialized from a given URL.
url: The location of an archived mapping model.
Return Value ¶
A mapping model initialized from `url`.
See: https://developer.apple.com/documentation/CoreData/NSMappingModel/init(contentsOf:)
func (NSMappingModel) SetEntityMappings ¶
func (m NSMappingModel) SetEntityMappings(value []NSEntityMapping)
type NSMappingModelClass ¶
type NSMappingModelClass struct {
// contains filtered or unexported fields
}
func GetNSMappingModelClass ¶
func GetNSMappingModelClass() NSMappingModelClass
GetNSMappingModelClass returns the class object for NSMappingModel.
func (NSMappingModelClass) Alloc ¶
func (nc NSMappingModelClass) Alloc() NSMappingModel
Alloc allocates memory for a new instance of the class.
func (NSMappingModelClass) Class ¶
func (nc NSMappingModelClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (NSMappingModelClass) InferredMappingModelForSourceModelDestinationModelError ¶
func (_NSMappingModelClass NSMappingModelClass) InferredMappingModelForSourceModelDestinationModelError(sourceModel INSManagedObjectModel, destinationModel INSManagedObjectModel) (NSMappingModel, error)
Returns a newly created mapping model that will migrate data from the source to the destination model.
sourceModel: The source managed object model.
destinationModel: The destination managed object model.
Return Value ¶
A newly-created mapping model to migrate data from the source to the destination model. If the mapping model can not be created, returns `nil`.
Discussion ¶
A model will be created only if all changes are simple enough to be able to reasonably infer a mapping (for example, removing or renaming an attribute, adding an optional attribute or relationship, or adding renaming or deleting an entity). Element IDs are used to track renamed properties and entities.
type NSMergeConflict ¶
type NSMergeConflict struct {
objectivec.Object
}
An encapsulation of conflicts that occur during an attempt to save changes in a managed object context.
Overview ¶
A conflict can occur in two situations:
- Between the managed object context and its in-memory cached state at the persistent store coordinator layer. - Between the cached state at the persistent store coordinator layer and the external store (file, database, and so forth). In this case, the merge conflict has a cached snapshot and a persisted snapshot. The source object is also provided as a convenience, but it is not directly involved in the conflict.
Snapshot dictionaries include values for all attributes and to-one relationships, but not to-many relationships. Relationship values are NSManagedObjectID references. To-many relationships must be pulled from the persistent store as needed.
Initializing a Merge Conflict ¶
- NSMergeConflict.InitWithSourceNewVersionOldVersionCachedSnapshotPersistedSnapshot: Initializes a merge conflict.
Accessing Merge Conflict Details ¶
- NSMergeConflict.SourceObject: The source object for the conflict.
- NSMergeConflict.ObjectSnapshot: A dictionary containing the values of the source object.
- NSMergeConflict.CachedSnapshot: A dictionary containing the values of the source object held in the persistent store coordinator layer.
- NSMergeConflict.PersistedSnapshot: A dictionary containing the values of the source object held in the persistent store.
- NSMergeConflict.NewVersionNumber: The new version number for the change.
- NSMergeConflict.OldVersionNumber: The old version number for the change.
See: https://developer.apple.com/documentation/CoreData/NSMergeConflict
func NSMergeConflictFromID ¶
func NSMergeConflictFromID(id objc.ID) NSMergeConflict
NSMergeConflictFromID constructs a NSMergeConflict from an objc.ID.
An encapsulation of conflicts that occur during an attempt to save changes in a managed object context.
func NewMergeConflictWithSourceNewVersionOldVersionCachedSnapshotPersistedSnapshot ¶
func NewMergeConflictWithSourceNewVersionOldVersionCachedSnapshotPersistedSnapshot(srcObject INSManagedObject, newvers uint, oldvers uint, cachesnap foundation.INSDictionary, persnap foundation.INSDictionary) NSMergeConflict
Initializes a merge conflict.
srcObject: The source object for the conflict.
newvers: The new version number for the change.
A value of 0 means the object was deleted and the corresponding snapshot is `nil`.
oldvers: The old version number for the change.
cachesnap: A dictionary containing the values of `srcObject` held in the persistent store coordinator layer.
persnap: A dictionary containing the values of `srcObject` held in the persistent store.
Return Value ¶
A merge conflict object initialized with the given parameters.
func NewNSMergeConflict ¶
func NewNSMergeConflict() NSMergeConflict
NewNSMergeConflict creates a new NSMergeConflict instance.
func (NSMergeConflict) Autorelease ¶
func (m NSMergeConflict) Autorelease() NSMergeConflict
Autorelease adds the receiver to the current autorelease pool.
func (NSMergeConflict) CachedSnapshot ¶
func (m NSMergeConflict) CachedSnapshot() foundation.INSDictionary
A dictionary containing the values of the source object held in the persistent store coordinator layer.
See: https://developer.apple.com/documentation/CoreData/NSMergeConflict/cachedSnapshot
func (NSMergeConflict) Init ¶
func (m NSMergeConflict) Init() NSMergeConflict
Init initializes the instance.
func (NSMergeConflict) InitWithSourceNewVersionOldVersionCachedSnapshotPersistedSnapshot ¶
func (m NSMergeConflict) InitWithSourceNewVersionOldVersionCachedSnapshotPersistedSnapshot(srcObject INSManagedObject, newvers uint, oldvers uint, cachesnap foundation.INSDictionary, persnap foundation.INSDictionary) NSMergeConflict
Initializes a merge conflict.
srcObject: The source object for the conflict.
newvers: The new version number for the change.
A value of 0 means the object was deleted and the corresponding snapshot is `nil`.
oldvers: The old version number for the change.
cachesnap: A dictionary containing the values of `srcObject` held in the persistent store coordinator layer.
persnap: A dictionary containing the values of `srcObject` held in the persistent store.
Return Value ¶
A merge conflict object initialized with the given parameters.
func (NSMergeConflict) NewVersionNumber ¶
func (m NSMergeConflict) NewVersionNumber() uint
The new version number for the change.
Discussion ¶
A new version number of 0 means the object was deleted and the corresponding snapshot is `nil`.
See: https://developer.apple.com/documentation/CoreData/NSMergeConflict/newVersionNumber
func (NSMergeConflict) ObjectSnapshot ¶
func (m NSMergeConflict) ObjectSnapshot() foundation.INSDictionary
A dictionary containing the values of the source object.
See: https://developer.apple.com/documentation/CoreData/NSMergeConflict/objectSnapshot
func (NSMergeConflict) OldVersionNumber ¶
func (m NSMergeConflict) OldVersionNumber() uint
The old version number for the change.
See: https://developer.apple.com/documentation/CoreData/NSMergeConflict/oldVersionNumber
func (NSMergeConflict) PersistedSnapshot ¶
func (m NSMergeConflict) PersistedSnapshot() foundation.INSDictionary
A dictionary containing the values of the source object held in the persistent store.
See: https://developer.apple.com/documentation/CoreData/NSMergeConflict/persistedSnapshot
func (NSMergeConflict) SourceObject ¶
func (m NSMergeConflict) SourceObject() INSManagedObject
The source object for the conflict.
See: https://developer.apple.com/documentation/CoreData/NSMergeConflict/sourceObject
type NSMergeConflictClass ¶
type NSMergeConflictClass struct {
// contains filtered or unexported fields
}
func GetNSMergeConflictClass ¶
func GetNSMergeConflictClass() NSMergeConflictClass
GetNSMergeConflictClass returns the class object for NSMergeConflict.
func (NSMergeConflictClass) Alloc ¶
func (nc NSMergeConflictClass) Alloc() NSMergeConflict
Alloc allocates memory for a new instance of the class.
func (NSMergeConflictClass) Class ¶
func (nc NSMergeConflictClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSMergePolicy ¶
type NSMergePolicy struct {
objectivec.Object
}
A policy object that you use to resolve conflicts between the persistent store and in-memory versions of managed objects.
Overview ¶
A conflict is a mismatch between state held at two different layers in the Core Data stack. A conflict can arise when you save a managed object context and you have stale data at another layer. There are two places in which a conflict may occur:
- Between the managed object context layer and its in-memory cached state at the persistent store coordinator layer. - Between the cached state at the persistent store coordinator and the external store (file, database, and so forth).
Conflicts are represented by instances of NSMergeConflict.
Getting a Merge Policy ¶
- NSMergePolicy.InitWithMergeType: Returns a merge policy initialized with a given policy type.
- NSMergePolicy.MergeType: The merge type.
Resolving a Conflict ¶
- NSMergePolicy.ResolveConflictsError: Resolves the conflicts in a given list.
- NSMergePolicy.ResolveConstraintConflictsError: Resolves the conflicts in a given list.
- NSMergePolicy.ResolveOptimisticLockingVersionConflictsError: Resolves the conflicts in a given list.
See: https://developer.apple.com/documentation/CoreData/NSMergePolicy
func NSMergePolicyFromID ¶
func NSMergePolicyFromID(id objc.ID) NSMergePolicy
NSMergePolicyFromID constructs a NSMergePolicy from an objc.ID.
A policy object that you use to resolve conflicts between the persistent store and in-memory versions of managed objects.
func NewMergePolicyWithMergeType ¶
func NewMergePolicyWithMergeType(ty NSMergePolicyType) NSMergePolicy
Returns a merge policy initialized with a given policy type.
ty: A merge policy type.
Return Value ¶
A merge policy initialized with a given policy type.
Discussion ¶
If you override this method in a subclass, you should invoke the superclass’s implementation with the merge policy that is closest to the behavior you want.
- This will make it easier to use the superclass’s implementation of NSMergePolicy.ResolveConflictsError and then customize the results. - Due to the complexity of merging to-many relationships, this class is designed with the expectation that you call super as the base implementation.
See: https://developer.apple.com/documentation/CoreData/NSMergePolicy/init(merge:)
func NewNSMergePolicy ¶
func NewNSMergePolicy() NSMergePolicy
NewNSMergePolicy creates a new NSMergePolicy instance.
func (NSMergePolicy) Autorelease ¶
func (m NSMergePolicy) Autorelease() NSMergePolicy
Autorelease adds the receiver to the current autorelease pool.
func (NSMergePolicy) Init ¶
func (m NSMergePolicy) Init() NSMergePolicy
Init initializes the instance.
func (NSMergePolicy) InitWithMergeType ¶
func (m NSMergePolicy) InitWithMergeType(ty NSMergePolicyType) NSMergePolicy
Returns a merge policy initialized with a given policy type.
ty: A merge policy type.
Return Value ¶
A merge policy initialized with a given policy type.
Discussion ¶
If you override this method in a subclass, you should invoke the superclass’s implementation with the merge policy that is closest to the behavior you want.
- This will make it easier to use the superclass’s implementation of NSMergePolicy.ResolveConflictsError and then customize the results. - Due to the complexity of merging to-many relationships, this class is designed with the expectation that you call super as the base implementation.
See: https://developer.apple.com/documentation/CoreData/NSMergePolicy/init(merge:)
func (NSMergePolicy) MergeType ¶
func (m NSMergePolicy) MergeType() NSMergePolicyType
The merge type.
See: https://developer.apple.com/documentation/CoreData/NSMergePolicy/mergeType
func (NSMergePolicy) ResolveConflictsError ¶
func (m NSMergePolicy) ResolveConflictsError(list foundation.INSArray) (bool, error)
Resolves the conflicts in a given list.
list: An array of merge conflicts (instances of NSMergeConflict).
Discussion ¶
If you override this method in a subclass, you should typically invoke the superclass’s implementation in addition to performing your own operations.
See: https://developer.apple.com/documentation/CoreData/NSMergePolicy/resolve(mergeConflicts:)
func (NSMergePolicy) ResolveConstraintConflictsError ¶
func (m NSMergePolicy) ResolveConstraintConflictsError(list []NSConstraintConflict) (bool, error)
Resolves the conflicts in a given list.
See: https://developer.apple.com/documentation/CoreData/NSMergePolicy/resolve(constraintConflicts:)
func (NSMergePolicy) ResolveOptimisticLockingVersionConflictsError ¶
func (m NSMergePolicy) ResolveOptimisticLockingVersionConflictsError(list []NSMergeConflict) (bool, error)
Resolves the conflicts in a given list.
type NSMergePolicyClass ¶
type NSMergePolicyClass struct {
// contains filtered or unexported fields
}
func GetNSMergePolicyClass ¶
func GetNSMergePolicyClass() NSMergePolicyClass
GetNSMergePolicyClass returns the class object for NSMergePolicy.
func (NSMergePolicyClass) Alloc ¶
func (nc NSMergePolicyClass) Alloc() NSMergePolicy
Alloc allocates memory for a new instance of the class.
func (NSMergePolicyClass) Class ¶
func (nc NSMergePolicyClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (NSMergePolicyClass) ErrorMergePolicy ¶
func (_NSMergePolicyClass NSMergePolicyClass) ErrorMergePolicy() NSMergePolicy
The default merge policy for all managed object contexts.
Discussion ¶
If a save fails because of conflicting objects, you can find the IDs of those objects in error’s `userInfo` dictionary. Use the NSInsertedObjectsKey and NSUpdatedObjectsKey keys to extract the object IDs.
See: https://developer.apple.com/documentation/CoreData/NSMergePolicy/error
func (NSMergePolicyClass) MergeByPropertyObjectTrumpMergePolicy ¶
func (_NSMergePolicyClass NSMergePolicyClass) MergeByPropertyObjectTrumpMergePolicy() NSMergePolicy
A property-based merge policy that applies in-memory changes.
Discussion ¶
A policy that merges conflicts between the persistent store’s version of the object and the current in-memory version by individual property, with in-memory changes trumping external changes.
See: https://developer.apple.com/documentation/CoreData/NSMergePolicy/mergeByPropertyObjectTrump
func (NSMergePolicyClass) MergeByPropertyStoreTrumpMergePolicy ¶
func (_NSMergePolicyClass NSMergePolicyClass) MergeByPropertyStoreTrumpMergePolicy() NSMergePolicy
A property-based merge policy that applies external changes.
Discussion ¶
A policy that merges conflicts between the persistent store’s version of the object and the current in-memory version by individual property, with external changes trumping in-memory changes.
See: https://developer.apple.com/documentation/CoreData/NSMergePolicy/mergeByPropertyStoreTrump
func (NSMergePolicyClass) OverwriteMergePolicy ¶
func (_NSMergePolicyClass NSMergePolicyClass) OverwriteMergePolicy() NSMergePolicy
A merge policy that overwrites the entire stored object.
Discussion ¶
This policy merges conflicts between the persistent store’s version of the object and the current in-memory version by saving the entire in-memory object to the persistent store.
See: https://developer.apple.com/documentation/CoreData/NSMergePolicy/overwrite
func (NSMergePolicyClass) RollbackMergePolicy ¶
func (_NSMergePolicyClass NSMergePolicyClass) RollbackMergePolicy() NSMergePolicy
A merge policy that discards unsaved changes.
Discussion ¶
This policy merges conflicts between the persistent store’s version of the object and the current in-memory version by discarding unsaved changes.
See: https://developer.apple.com/documentation/CoreData/NSMergePolicy/rollback
type NSMergePolicyType ¶
type NSMergePolicyType uint
See: https://developer.apple.com/documentation/CoreData/NSMergePolicyType
const ( // NSErrorMergePolicyType: The default merge policy for all managed object contexts. NSErrorMergePolicyType NSMergePolicyType = 0 // NSMergeByPropertyObjectTrumpMergePolicyType: A property-based merge policy that applies in-memory changes. NSMergeByPropertyObjectTrumpMergePolicyType NSMergePolicyType = 0x2 // NSMergeByPropertyStoreTrumpMergePolicyType: A property-based merge policy that applies external changes. NSMergeByPropertyStoreTrumpMergePolicyType NSMergePolicyType = 0x1 // NSOverwriteMergePolicyType: A merge policy type that overwrites the entire stored object. NSOverwriteMergePolicyType NSMergePolicyType = 0x3 // NSRollbackMergePolicyType: A merge policy that discards unsaved changes. NSRollbackMergePolicyType NSMergePolicyType = 0x4 )
func (NSMergePolicyType) String ¶
func (e NSMergePolicyType) String() string
type NSMigrationManager ¶
type NSMigrationManager struct {
objectivec.Object
}
A migration manager instance that performs a migration of data from one persistent store to another using a given mapping model.
Creating a Migration Manager ¶
- NSMigrationManager.InitWithSourceModelDestinationModel: Initializes a migration manager instance with given source and destination models.
Getting the Manager’s Configuration ¶
- NSMigrationManager.DestinationContext: The managed object context the migration manager uses for writing the destination persistent store.
- NSMigrationManager.DestinationModel: The destination model for the migration manager.
- NSMigrationManager.MappingModel: The mapping model for the migration manager.
- NSMigrationManager.SourceContext: The managed object context the migration manager uses for reading the source persistent store.
- NSMigrationManager.SourceModel: The source model for the migration manager.
- NSMigrationManager.DestinationEntityForEntityMapping: Returns the entity description for the destination entity of a given entity mapping.
- NSMigrationManager.SourceEntityForEntityMapping: Returns the entity description for the source entity of a given entity mapping.
Customizing the Manager ¶
- NSMigrationManager.UserInfo: The user info for the migration manager.
- NSMigrationManager.SetUserInfo
- NSMigrationManager.UsesStoreSpecificMigrationManager: A Boolean value that indicates whether the migration manager tries to use a store specific migration manager to perform the migration.
- NSMigrationManager.SetUsesStoreSpecificMigrationManager
Managing Sources and Destinations ¶
- NSMigrationManager.AssociateSourceInstanceWithDestinationInstanceForEntityMapping: Associates a given source managed object instance with an array of destination instances for a given property mapping.
- NSMigrationManager.DestinationInstancesForEntityMappingNamedSourceInstances: Returns the managed object instances created in the destination store for the named entity mapping for the given array of source instances.
- NSMigrationManager.SourceInstancesForEntityMappingNamedDestinationInstances: Returns the managed object instances in the source store used to create the given destination instances for the passed in property mapping.
Performing a Migration ¶
- NSMigrationManager.MigrateStoreFromURLTypeOptionsWithMappingModelToDestinationURLDestinationTypeDestinationOptionsError: Migrates the store at a given source URL to the store at a given destination URL, performing all of the mappings specified in a given mapping model.
Monitoring a Migration’s Progress ¶
- NSMigrationManager.MigrationProgress: A number between `0` and `1` that indicates the proportion of completeness of the migration.
- NSMigrationManager.CurrentEntityMapping: The entity mapping currently being processed.
Aborting a Migration ¶
- NSMigrationManager.CancelMigrationWithError: Cancels the migration with a given error.
- NSMigrationManager.Reset: Resets the association tables for the migration.
See: https://developer.apple.com/documentation/CoreData/NSMigrationManager
func NSMigrationManagerFromID ¶
func NSMigrationManagerFromID(id objc.ID) NSMigrationManager
NSMigrationManagerFromID constructs a NSMigrationManager from an objc.ID.
A migration manager instance that performs a migration of data from one persistent store to another using a given mapping model.
func NewMigrationManagerWithSourceModelDestinationModel ¶
func NewMigrationManagerWithSourceModelDestinationModel(sourceModel INSManagedObjectModel, destinationModel INSManagedObjectModel) NSMigrationManager
Initializes a migration manager instance with given source and destination models.
sourceModel: The source managed object model for the migration manager.
destinationModel: The destination managed object model for the migration manager.
Return Value ¶
A migration manager instance initialized to migrate data in a store that uses `sourceModel` to a store that uses `destinationModel`.
Discussion ¶
You specify the mapping model in the migration method, NSMigrationManager.MigrateStoreFromURLTypeOptionsWithMappingModelToDestinationURLDestinationTypeDestinationOptionsError.
Special Considerations ¶
This is the designated initializer for NSMigrationManager.
Although validation of the models is performed during NSMigrationManager.MigrateStoreFromURLTypeOptionsWithMappingModelToDestinationURLDestinationTypeDestinationOptionsError, as with NSPersistentStoreCoordinator once models are added to the migration manager they are immutable and cannot be altered.
func NewNSMigrationManager ¶
func NewNSMigrationManager() NSMigrationManager
NewNSMigrationManager creates a new NSMigrationManager instance.
func (NSMigrationManager) AssociateSourceInstanceWithDestinationInstanceForEntityMapping ¶
func (m NSMigrationManager) AssociateSourceInstanceWithDestinationInstanceForEntityMapping(sourceInstance INSManagedObject, destinationInstance INSManagedObject, entityMapping INSEntityMapping)
Associates a given source managed object instance with an array of destination instances for a given property mapping.
sourceInstance: A source managed object.
destinationInstance: The destination manage object for `sourceInstance`.
entityMapping: The entity mapping to use to associate `sourceInstance` with the object in `destinationInstances`.
Discussion ¶
Data migration is performed as a three-stage process (first create the data, then relate the data, then validate the data). You use this method to associate data between the source and destination stores, in order to allow for relationship creation or fix-up after the creation stage.
This method is called in the default implementation of NSEntityMigrationPolicy’s NSEntityMigrationPolicy.CreateDestinationInstancesForSourceInstanceEntityMappingManagerError method.
func (NSMigrationManager) Autorelease ¶
func (m NSMigrationManager) Autorelease() NSMigrationManager
Autorelease adds the receiver to the current autorelease pool.
func (NSMigrationManager) CancelMigrationWithError ¶
func (m NSMigrationManager) CancelMigrationWithError(error_ foundation.NSError)
Cancels the migration with a given error.
error: An error object that describes the reason why the migration is canceled.
Discussion ¶
You can invoke this method from anywhere in the migration process to abort the migration. Calling this method causes NSMigrationManager.MigrateStoreFromURLTypeOptionsWithMappingModelToDestinationURLDestinationTypeDestinationOptionsError to abort the migration and return `error`—you should provide an appropriate error to indicate the reason for the cancellation.
See: https://developer.apple.com/documentation/CoreData/NSMigrationManager/cancelMigrationWithError(_:)
func (NSMigrationManager) CurrentEntityMapping ¶
func (m NSMigrationManager) CurrentEntityMapping() INSEntityMapping
The entity mapping currently being processed.
Discussion ¶
Each entity is processed a total of three times—instance creation, relationship creation, and validation.
Special Considerations ¶
You can observe this value using key-value observing.
See: https://developer.apple.com/documentation/CoreData/NSMigrationManager/currentEntityMapping
func (NSMigrationManager) DestinationContext ¶
func (m NSMigrationManager) DestinationContext() INSManagedObjectContext
The managed object context the migration manager uses for writing the destination persistent store.
Discussion ¶
This context is created on demand as part of the initialization of the Core Data stacks used for migration.
See: https://developer.apple.com/documentation/CoreData/NSMigrationManager/destinationContext
func (NSMigrationManager) DestinationEntityForEntityMapping ¶
func (m NSMigrationManager) DestinationEntityForEntityMapping(mEntity INSEntityMapping) INSEntityDescription
Returns the entity description for the destination entity of a given entity mapping.
mEntity: An entity mapping.
Return Value ¶
The entity description for the destination entity of `mEntity`.
Discussion ¶
Entity mappings do not store the actual description objects, but rather the name and version information of the entity.
See: https://developer.apple.com/documentation/CoreData/NSMigrationManager/destinationEntity(for:)
func (NSMigrationManager) DestinationInstancesForEntityMappingNamedSourceInstances ¶
func (m NSMigrationManager) DestinationInstancesForEntityMappingNamedSourceInstances(mappingName string, sourceInstances []NSManagedObject) []NSManagedObject
Returns the managed object instances created in the destination store for the named entity mapping for the given array of source instances.
mappingName: The name of an entity mapping in use.
sourceInstances: A array of managed objects in the source store.
Return Value ¶
An array containing the managed object instances created in the destination store for the entity mapping named `mappingName` for `sourceInstances`. If `sourceInstances` is `nil`, all of the destination instances created by the specified property mapping are returned.
Discussion ¶
This method throws an [NSInvalidArgumentException] exception if `mappingName` is not a valid mapping name.
func (NSMigrationManager) DestinationModel ¶
func (m NSMigrationManager) DestinationModel() INSManagedObjectModel
The destination model for the migration manager.
See: https://developer.apple.com/documentation/CoreData/NSMigrationManager/destinationModel
func (NSMigrationManager) Init ¶
func (m NSMigrationManager) Init() NSMigrationManager
Init initializes the instance.
func (NSMigrationManager) InitWithSourceModelDestinationModel ¶
func (m NSMigrationManager) InitWithSourceModelDestinationModel(sourceModel INSManagedObjectModel, destinationModel INSManagedObjectModel) NSMigrationManager
Initializes a migration manager instance with given source and destination models.
sourceModel: The source managed object model for the migration manager.
destinationModel: The destination managed object model for the migration manager.
Return Value ¶
A migration manager instance initialized to migrate data in a store that uses `sourceModel` to a store that uses `destinationModel`.
Discussion ¶
You specify the mapping model in the migration method, NSMigrationManager.MigrateStoreFromURLTypeOptionsWithMappingModelToDestinationURLDestinationTypeDestinationOptionsError.
Special Considerations ¶
This is the designated initializer for NSMigrationManager.
Although validation of the models is performed during NSMigrationManager.MigrateStoreFromURLTypeOptionsWithMappingModelToDestinationURLDestinationTypeDestinationOptionsError, as with NSPersistentStoreCoordinator once models are added to the migration manager they are immutable and cannot be altered.
func (NSMigrationManager) MappingModel ¶
func (m NSMigrationManager) MappingModel() INSMappingModel
The mapping model for the migration manager.
See: https://developer.apple.com/documentation/CoreData/NSMigrationManager/mappingModel
func (NSMigrationManager) MigrateStoreFromURLTypeOptionsWithMappingModelToDestinationURLDestinationTypeDestinationOptionsError ¶
func (m NSMigrationManager) MigrateStoreFromURLTypeOptionsWithMappingModelToDestinationURLDestinationTypeDestinationOptionsError(sourceURL foundation.NSURL, sStoreType string, sOptions foundation.INSDictionary, mappings INSMappingModel, dURL foundation.NSURL, dStoreType string, dOptions foundation.INSDictionary) (bool, error)
Migrates the store at a given source URL to the store at a given destination URL, performing all of the mappings specified in a given mapping model.
sourceURL: The location of an existing persistent store. A store must exist at this URL.
sStoreType: The type of store at `sourceURL` (see NSPersistentStoreCoordinator for possible values).
sOptions: A dictionary of options for the source (see NSPersistentStoreCoordinator for possible values).
mappings: The mapping model to use to effect the migration.
dURL: The location of the destination store.
dStoreType: The type of store at `dURL` (see NSPersistentStoreCoordinator for possible values).
dOptions: A dictionary of options for the destination (see NSPersistentStoreCoordinator for possible values).
Discussion ¶
This method performs compatibility checks on the source and destination models and the mapping model.
Special Considerations ¶
If a store does not exist at the destination URL (`dURL`), one is created; otherwise, the migration appends to the existing store.
func (NSMigrationManager) MigrationProgress ¶
func (m NSMigrationManager) MigrationProgress() float32
A number between `0` and `1` that indicates the proportion of completeness of the migration.
Discussion ¶
If a migration is not taking place, this property is `1`. You can observe this value using key-value observing.
See: https://developer.apple.com/documentation/CoreData/NSMigrationManager/migrationProgress
func (NSMigrationManager) Reset ¶
func (m NSMigrationManager) Reset()
Resets the association tables for the migration.
Discussion ¶
This method does not reset the source or destination contexts.
See: https://developer.apple.com/documentation/CoreData/NSMigrationManager/reset()
func (NSMigrationManager) SetUserInfo ¶
func (m NSMigrationManager) SetUserInfo(value foundation.INSDictionary)
func (NSMigrationManager) SetUsesStoreSpecificMigrationManager ¶
func (m NSMigrationManager) SetUsesStoreSpecificMigrationManager(value bool)
func (NSMigrationManager) SourceContext ¶
func (m NSMigrationManager) SourceContext() INSManagedObjectContext
The managed object context the migration manager uses for reading the source persistent store.
Discussion ¶
This context is created on demand as part of the initialization of the Core Data stacks used for migration.
See: https://developer.apple.com/documentation/CoreData/NSMigrationManager/sourceContext
func (NSMigrationManager) SourceEntityForEntityMapping ¶
func (m NSMigrationManager) SourceEntityForEntityMapping(mEntity INSEntityMapping) INSEntityDescription
Returns the entity description for the source entity of a given entity mapping.
mEntity: An entity mapping.
Return Value ¶
The entity description for the source entity of `mEntity`.
Discussion ¶
Entity mappings do not store the actual description objects, but rather the name and version information of the entity.
See: https://developer.apple.com/documentation/CoreData/NSMigrationManager/sourceEntity(for:)
func (NSMigrationManager) SourceInstancesForEntityMappingNamedDestinationInstances ¶
func (m NSMigrationManager) SourceInstancesForEntityMappingNamedDestinationInstances(mappingName string, destinationInstances []NSManagedObject) []NSManagedObject
Returns the managed object instances in the source store used to create the given destination instances for the passed in property mapping.
mappingName: The name of an entity mapping in use.
destinationInstances: A array of managed objects in the destination store.
Return Value ¶
An array containing the managed object instances in the source store used to create `destinationInstances` using the entity mapping named `mappingName`. If `destinationInstances` is `nil`, all of the source instances used to create the destination instance for this property mapping are returned.
Discussion ¶
This method throws an [NSInvalidArgumentException] exception if `mappingName` is not a valid mapping name.
func (NSMigrationManager) SourceModel ¶
func (m NSMigrationManager) SourceModel() INSManagedObjectModel
The source model for the migration manager.
See: https://developer.apple.com/documentation/CoreData/NSMigrationManager/sourceModel
func (NSMigrationManager) UserInfo ¶
func (m NSMigrationManager) UserInfo() foundation.INSDictionary
The user info for the migration manager.
Discussion ¶
You can use the user info dictionary to aid the customization of your migration process.
See: https://developer.apple.com/documentation/CoreData/NSMigrationManager/userInfo
func (NSMigrationManager) UsesStoreSpecificMigrationManager ¶
func (m NSMigrationManager) UsesStoreSpecificMigrationManager() bool
A Boolean value that indicates whether the migration manager tries to use a store specific migration manager to perform the migration.
Return Value ¶
true if the receiver uses a store-specific migration manager, otherwise false.
Discussion ¶
true if the receiver uses a store-specific migration manager, otherwise false. The default value is true.
A store-specific migration manager class is not guaranteed to perform any of the migration manager delegate callbacks or update values for the observable properties.
type NSMigrationManagerClass ¶
type NSMigrationManagerClass struct {
// contains filtered or unexported fields
}
func GetNSMigrationManagerClass ¶
func GetNSMigrationManagerClass() NSMigrationManagerClass
GetNSMigrationManagerClass returns the class object for NSMigrationManager.
func (NSMigrationManagerClass) Alloc ¶
func (nc NSMigrationManagerClass) Alloc() NSMigrationManager
Alloc allocates memory for a new instance of the class.
func (NSMigrationManagerClass) Class ¶
func (nc NSMigrationManagerClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSMigrationStage ¶
type NSMigrationStage struct {
objectivec.Object
}
An abstract base class for describing an individual stage of a migration.
Overview ¶
Describing the purpose ¶
- NSMigrationStage.Label: The textual description of the migration stage’s purpose.
- NSMigrationStage.SetLabel
See: https://developer.apple.com/documentation/CoreData/NSMigrationStage
func NSMigrationStageFromID ¶
func NSMigrationStageFromID(id objc.ID) NSMigrationStage
NSMigrationStageFromID constructs a NSMigrationStage from an objc.ID.
An abstract base class for describing an individual stage of a migration.
func NewNSMigrationStage ¶
func NewNSMigrationStage() NSMigrationStage
NewNSMigrationStage creates a new NSMigrationStage instance.
func (NSMigrationStage) Autorelease ¶
func (m NSMigrationStage) Autorelease() NSMigrationStage
Autorelease adds the receiver to the current autorelease pool.
func (NSMigrationStage) Init ¶
func (m NSMigrationStage) Init() NSMigrationStage
Init initializes the instance.
func (NSMigrationStage) Label ¶
func (m NSMigrationStage) Label() string
The textual description of the migration stage’s purpose.
Discussion ¶
Persistent history tracking, if enabled, records the label for later use. The default value is an empty string.
See: https://developer.apple.com/documentation/CoreData/NSMigrationStage/label
func (NSMigrationStage) SetLabel ¶
func (m NSMigrationStage) SetLabel(value string)
type NSMigrationStageClass ¶
type NSMigrationStageClass struct {
// contains filtered or unexported fields
}
func GetNSMigrationStageClass ¶
func GetNSMigrationStageClass() NSMigrationStageClass
GetNSMigrationStageClass returns the class object for NSMigrationStage.
func (NSMigrationStageClass) Alloc ¶
func (nc NSMigrationStageClass) Alloc() NSMigrationStage
Alloc allocates memory for a new instance of the class.
func (NSMigrationStageClass) Class ¶
func (nc NSMigrationStageClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSPersistentCloudKitContainer ¶
type NSPersistentCloudKitContainer struct {
NSPersistentContainer
}
A container that encapsulates the Core Data stack in your app, and mirrors select persistent stores to a CloudKit private database.
Overview ¶
NSPersistentCloudKitContainer is a subclass of NSPersistentContainer capable of managing both CloudKit-backed and noncloud stores.
By default, NSPersistentCloudKitContainer contains a single store description, which Core Data assigns to the first CloudKit container identifier in an app’s entitlements. Use NSPersistentCloudKitContainerOptions to customize this behavior or create additional store descriptions with backing by different containers.
For more information about setting up multiple stores, see Setting Up Core Data with CloudKit.
Checking Permissions ¶
- NSPersistentCloudKitContainer.CanUpdateRecordForManagedObjectWithID: Returns a Boolean value that indicates whether the user can modify the managed object’s underlying CloudKit record.
- NSPersistentCloudKitContainer.CanDeleteRecordForManagedObjectWithID: Returns a Boolean value that indicates whether the user can delete the managed object’s underlying CloudKit record.
- NSPersistentCloudKitContainer.CanModifyManagedObjectsInStore: Returns a Boolean value that indicates whether the user can modify the specified persistent store.
Promoting Your Schema ¶
- NSPersistentCloudKitContainer.InitializeCloudKitSchemaWithOptionsError: Creates the CloudKit schema for all stores in the container that manage a CloudKit database.
See: https://developer.apple.com/documentation/CoreData/NSPersistentCloudKitContainer
func NSPersistentCloudKitContainerFromID ¶
func NSPersistentCloudKitContainerFromID(id objc.ID) NSPersistentCloudKitContainer
NSPersistentCloudKitContainerFromID constructs a NSPersistentCloudKitContainer from an objc.ID.
A container that encapsulates the Core Data stack in your app, and mirrors select persistent stores to a CloudKit private database.
func NewNSPersistentCloudKitContainer ¶
func NewNSPersistentCloudKitContainer() NSPersistentCloudKitContainer
NewNSPersistentCloudKitContainer creates a new NSPersistentCloudKitContainer instance.
func NewPersistentCloudKitContainerWithName ¶
func NewPersistentCloudKitContainerWithName(name string) NSPersistentCloudKitContainer
Creates a container with the specified name.
name: The name of the NSPersistentContainer object.
Return Value ¶
A persistent container initialized with the given name.
Discussion ¶
By default, the provided name value is used to name the persistent store and is used to look up the name of the NSManagedObjectModel object to be used with the NSPersistentContainer object.
See: https://developer.apple.com/documentation/CoreData/NSPersistentContainer/init(name:)
func NewPersistentCloudKitContainerWithNameManagedObjectModel ¶
func NewPersistentCloudKitContainerWithNameManagedObjectModel(name string, model INSManagedObjectModel) NSPersistentCloudKitContainer
Create a container with the specified name and managed object model.
name: The name used by the persistent container.
model: The managed object model to be used by the persistent container.
Return Value ¶
A persistent container initialized with the given name and model.
Discussion ¶
By default, the provided name value of the container is used as the name of the persisent store associated with the container. Passing in the NSManagedObjectModel object overrides the lookup of the model by the provided name value.
func (NSPersistentCloudKitContainer) Autorelease ¶
func (p NSPersistentCloudKitContainer) Autorelease() NSPersistentCloudKitContainer
Autorelease adds the receiver to the current autorelease pool.
func (NSPersistentCloudKitContainer) CanDeleteRecordForManagedObjectWithID ¶
func (p NSPersistentCloudKitContainer) CanDeleteRecordForManagedObjectWithID(objectID INSManagedObjectID) bool
Returns a Boolean value that indicates whether the user can delete the managed object’s underlying CloudKit record.
objectID: The ID of the managed object.
Return Value ¶
true if the user can delete the CloudKit record; otherwise, false.
Discussion ¶
This method returns true if NSPersistentCloudKitContainer.CanModifyManagedObjectsInStore returns true and any of the following conditions are true:
- `objectID` is a temporary object identifier. - The persistent store that contains the managed object isn’t using CloudKit. - The persistent store manages the user’s private database. - The persistent store manages the public database, and the user owns the underlying record or Core Data has yet to save the managed object to iCloud. - The persistent store manages the shared database, and the user has the necessary permissions to delete the managed object’s underlying record. For more information, see CKShare.ParticipantPermission.
func (NSPersistentCloudKitContainer) CanModifyManagedObjectsInStore ¶
func (p NSPersistentCloudKitContainer) CanModifyManagedObjectsInStore(store INSPersistentStore) bool
Returns a Boolean value that indicates whether the user can modify the specified persistent store.
store: The persistent store.
Return Value ¶
true if the user can modify records in the persistent store’s CloudKit database; otherwise, false.
Discussion ¶
Use this method to determine whether the user is able to write any records to the CloudKit database. To find out if the user can modify a specific object, use the NSPersistentCloudKitContainer.CanUpdateRecordForManagedObjectWithID and NSPersistentCloudKitContainer.CanDeleteRecordForManagedObjectWithID methods instead.
This method always returns true for persistent stores that manage the user’s private CloudKit database.
func (NSPersistentCloudKitContainer) CanUpdateRecordForManagedObjectWithID ¶
func (p NSPersistentCloudKitContainer) CanUpdateRecordForManagedObjectWithID(objectID INSManagedObjectID) bool
Returns a Boolean value that indicates whether the user can modify the managed object’s underlying CloudKit record.
objectID: The ID of the managed object.
Return Value ¶
true if the user can modify the CloudKit record; otherwise, false.
Discussion ¶
This method returns true if NSPersistentCloudKitContainer.CanModifyManagedObjectsInStore returns true and any of the following conditions are true:
- `objectID` is a temporary object identifier. - The persistent store that contains the managed object isn’t using CloudKit. - The persistent store manages the user’s private database. - The persistent store manages the public database, and the user owns the underlying record or Core Data has yet to save the managed object to iCloud. - The persistent store manages the shared database, and the user has the necessary permissions to update the managed object’s underlying record. For more information, see CKShare.ParticipantPermission.
func (NSPersistentCloudKitContainer) Init ¶
func (p NSPersistentCloudKitContainer) Init() NSPersistentCloudKitContainer
Init initializes the instance.
func (NSPersistentCloudKitContainer) InitializeCloudKitSchemaWithOptionsError ¶
func (p NSPersistentCloudKitContainer) InitializeCloudKitSchemaWithOptionsError(options NSPersistentCloudKitContainerSchemaInitializationOptions) (NSPersistentCloudKitContainer, error)
Creates the CloudKit schema for all stores in the container that manage a CloudKit database.
options: The options to use when creating the CloudKit schema.
Discussion ¶
To create the schema, this method creates a set of representative CKRecord instances for all stores in the container that use Core Data with CloudKit, and uploads them to CloudKit. These records have a representative value for every field Core Data might serialize for the specified managed object model. After successfully uploading the records, the schema is visible in the CloudKit Dashboard and the container deletes the representative records.
type NSPersistentCloudKitContainerClass ¶
type NSPersistentCloudKitContainerClass struct {
// contains filtered or unexported fields
}
func GetNSPersistentCloudKitContainerClass ¶
func GetNSPersistentCloudKitContainerClass() NSPersistentCloudKitContainerClass
GetNSPersistentCloudKitContainerClass returns the class object for NSPersistentCloudKitContainer.
func (NSPersistentCloudKitContainerClass) Alloc ¶
func (nc NSPersistentCloudKitContainerClass) Alloc() NSPersistentCloudKitContainer
Alloc allocates memory for a new instance of the class.
func (NSPersistentCloudKitContainerClass) Class ¶
func (nc NSPersistentCloudKitContainerClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSPersistentCloudKitContainerEvent ¶
type NSPersistentCloudKitContainerEvent struct {
objectivec.Object
}
An object that represents activity in a persistent CloudKit container.
Inspecting Event Properties ¶
- NSPersistentCloudKitContainerEvent.Type: The type of event, either setup, import, or export.
- NSPersistentCloudKitContainerEvent.Identifier: A unique identifier for the event in a container.
- NSPersistentCloudKitContainerEvent.StoreIdentifier: The associated store identifier in the container for the event.
- NSPersistentCloudKitContainerEvent.Succeeded: A Boolean value that indicates whether the operation the event represents is successful.
- NSPersistentCloudKitContainerEvent.StartDate: The start date of the operation that the event represents.
- NSPersistentCloudKitContainerEvent.EndDate: The end date of the operation that the event represents.
- NSPersistentCloudKitContainerEvent.Error: An error that indicates why an operation fails.
See: https://developer.apple.com/documentation/CoreData/NSPersistentCloudKitContainer/Event
func NSPersistentCloudKitContainerEventFromID ¶
func NSPersistentCloudKitContainerEventFromID(id objc.ID) NSPersistentCloudKitContainerEvent
NSPersistentCloudKitContainerEventFromID constructs a NSPersistentCloudKitContainerEvent from an objc.ID.
An object that represents activity in a persistent CloudKit container.
func NewNSPersistentCloudKitContainerEvent ¶
func NewNSPersistentCloudKitContainerEvent() NSPersistentCloudKitContainerEvent
NewNSPersistentCloudKitContainerEvent creates a new NSPersistentCloudKitContainerEvent instance.
func (NSPersistentCloudKitContainerEvent) Autorelease ¶
func (p NSPersistentCloudKitContainerEvent) Autorelease() NSPersistentCloudKitContainerEvent
Autorelease adds the receiver to the current autorelease pool.
func (NSPersistentCloudKitContainerEvent) EndDate ¶
func (p NSPersistentCloudKitContainerEvent) EndDate() foundation.NSDate
The end date of the operation that the event represents.
See: https://developer.apple.com/documentation/CoreData/NSPersistentCloudKitContainer/Event/endDate
func (NSPersistentCloudKitContainerEvent) Error ¶
func (p NSPersistentCloudKitContainerEvent) Error() foundation.NSError
An error that indicates why an operation fails.
See: https://developer.apple.com/documentation/CoreData/NSPersistentCloudKitContainer/Event/error
func (NSPersistentCloudKitContainerEvent) Identifier ¶
func (p NSPersistentCloudKitContainerEvent) Identifier() foundation.NSUUID
A unique identifier for the event in a container.
See: https://developer.apple.com/documentation/CoreData/NSPersistentCloudKitContainer/Event/identifier
func (NSPersistentCloudKitContainerEvent) Init ¶
func (p NSPersistentCloudKitContainerEvent) Init() NSPersistentCloudKitContainerEvent
Init initializes the instance.
func (NSPersistentCloudKitContainerEvent) StartDate ¶
func (p NSPersistentCloudKitContainerEvent) StartDate() foundation.NSDate
The start date of the operation that the event represents.
See: https://developer.apple.com/documentation/CoreData/NSPersistentCloudKitContainer/Event/startDate
func (NSPersistentCloudKitContainerEvent) StoreIdentifier ¶
func (p NSPersistentCloudKitContainerEvent) StoreIdentifier() string
The associated store identifier in the container for the event.
func (NSPersistentCloudKitContainerEvent) Succeeded ¶
func (p NSPersistentCloudKitContainerEvent) Succeeded() bool
A Boolean value that indicates whether the operation the event represents is successful.
See: https://developer.apple.com/documentation/CoreData/NSPersistentCloudKitContainer/Event/succeeded
func (NSPersistentCloudKitContainerEvent) Type ¶
The type of event, either setup, import, or export.
See: https://developer.apple.com/documentation/CoreData/NSPersistentCloudKitContainer/Event/type
type NSPersistentCloudKitContainerEventClass ¶
type NSPersistentCloudKitContainerEventClass struct {
// contains filtered or unexported fields
}
func GetNSPersistentCloudKitContainerEventClass ¶
func GetNSPersistentCloudKitContainerEventClass() NSPersistentCloudKitContainerEventClass
GetNSPersistentCloudKitContainerEventClass returns the class object for NSPersistentCloudKitContainerEvent.
func (NSPersistentCloudKitContainerEventClass) Alloc ¶
func (nc NSPersistentCloudKitContainerEventClass) Alloc() NSPersistentCloudKitContainerEvent
Alloc allocates memory for a new instance of the class.
func (NSPersistentCloudKitContainerEventClass) Class ¶
func (nc NSPersistentCloudKitContainerEventClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSPersistentCloudKitContainerEventRequest ¶
type NSPersistentCloudKitContainerEventRequest struct {
NSPersistentStoreRequest
}
A request to fetch setup, import, or export events in a persistent CloudKit container.
Fetching Events ¶
- NSPersistentCloudKitContainerEventRequest.ResultType: The type of result that the request returns.
- NSPersistentCloudKitContainerEventRequest.SetResultType
See: https://developer.apple.com/documentation/CoreData/NSPersistentCloudKitContainerEventRequest
func NSPersistentCloudKitContainerEventRequestFromID ¶
func NSPersistentCloudKitContainerEventRequestFromID(id objc.ID) NSPersistentCloudKitContainerEventRequest
NSPersistentCloudKitContainerEventRequestFromID constructs a NSPersistentCloudKitContainerEventRequest from an objc.ID.
A request to fetch setup, import, or export events in a persistent CloudKit container.
func NewNSPersistentCloudKitContainerEventRequest ¶
func NewNSPersistentCloudKitContainerEventRequest() NSPersistentCloudKitContainerEventRequest
NewNSPersistentCloudKitContainerEventRequest creates a new NSPersistentCloudKitContainerEventRequest instance.
func (NSPersistentCloudKitContainerEventRequest) Autorelease ¶
func (p NSPersistentCloudKitContainerEventRequest) Autorelease() NSPersistentCloudKitContainerEventRequest
Autorelease adds the receiver to the current autorelease pool.
func (NSPersistentCloudKitContainerEventRequest) ResultType ¶
func (p NSPersistentCloudKitContainerEventRequest) ResultType() NSPersistentCloudKitContainerEventResultType
The type of result that the request returns.
func (NSPersistentCloudKitContainerEventRequest) SetResultType ¶
func (p NSPersistentCloudKitContainerEventRequest) SetResultType(value NSPersistentCloudKitContainerEventResultType)
type NSPersistentCloudKitContainerEventRequestClass ¶
type NSPersistentCloudKitContainerEventRequestClass struct {
// contains filtered or unexported fields
}
func GetNSPersistentCloudKitContainerEventRequestClass ¶
func GetNSPersistentCloudKitContainerEventRequestClass() NSPersistentCloudKitContainerEventRequestClass
GetNSPersistentCloudKitContainerEventRequestClass returns the class object for NSPersistentCloudKitContainerEventRequest.
func (NSPersistentCloudKitContainerEventRequestClass) Alloc ¶
func (nc NSPersistentCloudKitContainerEventRequestClass) Alloc() NSPersistentCloudKitContainerEventRequest
Alloc allocates memory for a new instance of the class.
func (NSPersistentCloudKitContainerEventRequestClass) Class ¶
func (nc NSPersistentCloudKitContainerEventRequestClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (NSPersistentCloudKitContainerEventRequestClass) FetchEventsAfterDate ¶
func (_NSPersistentCloudKitContainerEventRequestClass NSPersistentCloudKitContainerEventRequestClass) FetchEventsAfterDate(date foundation.NSDate) NSPersistentCloudKitContainerEventRequest
Creates a fetch request for events after a specified date from a persistent CloudKit container.
date: The earliest date to return events for.
Return Value ¶
A request object that fetches persistent CloudKit container events by executing in a managed object context.
func (NSPersistentCloudKitContainerEventRequestClass) FetchEventsAfterEvent ¶
func (_NSPersistentCloudKitContainerEventRequestClass NSPersistentCloudKitContainerEventRequestClass) FetchEventsAfterEvent(event INSPersistentCloudKitContainerEvent) NSPersistentCloudKitContainerEventRequest
Creates a fetch request for events that occur after a specified event from a persistent CloudKit container.
event: An event that precedes other events.
Return Value ¶
A request object that fetches persistent CloudKit container events by executing in a managed object context.
func (NSPersistentCloudKitContainerEventRequestClass) FetchEventsMatchingFetchRequest ¶
func (_NSPersistentCloudKitContainerEventRequestClass NSPersistentCloudKitContainerEventRequestClass) FetchEventsMatchingFetchRequest(fetchRequest INSFetchRequest) NSPersistentCloudKitContainerEventRequest
Creates a fetch request for events that match a specified fetch request from a persistent CloudKit container.
fetchRequest: A fetch request to identify matching events.
Return Value ¶
A request object that fetches persistent CloudKit container events by executing in a managed object context.
func (NSPersistentCloudKitContainerEventRequestClass) FetchRequestForEvents ¶
func (_NSPersistentCloudKitContainerEventRequestClass NSPersistentCloudKitContainerEventRequestClass) FetchRequestForEvents() NSFetchRequest
Creates a fetch request for all events in a persistent CloudKit container.
Return Value ¶
A request object that fetches persistent CloudKit container events by executing in a managed object context.
type NSPersistentCloudKitContainerEventResult ¶
type NSPersistentCloudKitContainerEventResult struct {
NSPersistentStoreResult
}
The result of a request to fetch persistent CloudKit container events.
Handling Event Results ¶
- NSPersistentCloudKitContainerEventResult.Result: The result of the persistent CloudKit container event request, which the result type determines.
- NSPersistentCloudKitContainerEventResult.ResultType: The type of result that the CloudKit container event fetch request returns.
See: https://developer.apple.com/documentation/CoreData/NSPersistentCloudKitContainerEventResult
func NSPersistentCloudKitContainerEventResultFromID ¶
func NSPersistentCloudKitContainerEventResultFromID(id objc.ID) NSPersistentCloudKitContainerEventResult
NSPersistentCloudKitContainerEventResultFromID constructs a NSPersistentCloudKitContainerEventResult from an objc.ID.
The result of a request to fetch persistent CloudKit container events.
func NewNSPersistentCloudKitContainerEventResult ¶
func NewNSPersistentCloudKitContainerEventResult() NSPersistentCloudKitContainerEventResult
NewNSPersistentCloudKitContainerEventResult creates a new NSPersistentCloudKitContainerEventResult instance.
func (NSPersistentCloudKitContainerEventResult) Autorelease ¶
func (p NSPersistentCloudKitContainerEventResult) Autorelease() NSPersistentCloudKitContainerEventResult
Autorelease adds the receiver to the current autorelease pool.
func (NSPersistentCloudKitContainerEventResult) Result ¶
func (p NSPersistentCloudKitContainerEventResult) Result() objectivec.IObject
The result of the persistent CloudKit container event request, which the result type determines.
See: https://developer.apple.com/documentation/CoreData/NSPersistentCloudKitContainerEventResult/result
func (NSPersistentCloudKitContainerEventResult) ResultType ¶
func (p NSPersistentCloudKitContainerEventResult) ResultType() NSPersistentCloudKitContainerEventResultType
The type of result that the CloudKit container event fetch request returns.
type NSPersistentCloudKitContainerEventResultClass ¶
type NSPersistentCloudKitContainerEventResultClass struct {
// contains filtered or unexported fields
}
func GetNSPersistentCloudKitContainerEventResultClass ¶
func GetNSPersistentCloudKitContainerEventResultClass() NSPersistentCloudKitContainerEventResultClass
GetNSPersistentCloudKitContainerEventResultClass returns the class object for NSPersistentCloudKitContainerEventResult.
func (NSPersistentCloudKitContainerEventResultClass) Alloc ¶
func (nc NSPersistentCloudKitContainerEventResultClass) Alloc() NSPersistentCloudKitContainerEventResult
Alloc allocates memory for a new instance of the class.
func (NSPersistentCloudKitContainerEventResultClass) Class ¶
func (nc NSPersistentCloudKitContainerEventResultClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSPersistentCloudKitContainerEventResultType ¶
type NSPersistentCloudKitContainerEventResultType int
const ( // NSPersistentCloudKitContainerEventResultTypeCountEvents: The number of CloudKit container events that match the event request. NSPersistentCloudKitContainerEventResultTypeCountEvents NSPersistentCloudKitContainerEventResultType = 1 // NSPersistentCloudKitContainerEventResultTypeEvents: The persistent CloudKit container events that match the event request. NSPersistentCloudKitContainerEventResultTypeEvents NSPersistentCloudKitContainerEventResultType = 0 )
func (NSPersistentCloudKitContainerEventResultType) String ¶
func (e NSPersistentCloudKitContainerEventResultType) String() string
type NSPersistentCloudKitContainerEventType ¶
type NSPersistentCloudKitContainerEventType int
See: https://developer.apple.com/documentation/CoreData/NSPersistentCloudKitContainer/EventType
const ( // NSPersistentCloudKitContainerEventTypeExport: An event the persistent CloudKit container generates when exporting managed objects from a store. NSPersistentCloudKitContainerEventTypeExport NSPersistentCloudKitContainerEventType = 2 // NSPersistentCloudKitContainerEventTypeImport: An event the persistent CloudKit container generates when importing records into a store. NSPersistentCloudKitContainerEventTypeImport NSPersistentCloudKitContainerEventType = 1 // NSPersistentCloudKitContainerEventTypeSetup: An event the persistent CloudKit container generates when setting up a store. NSPersistentCloudKitContainerEventTypeSetup NSPersistentCloudKitContainerEventType = 0 )
func (NSPersistentCloudKitContainerEventType) String ¶
func (e NSPersistentCloudKitContainerEventType) String() string
type NSPersistentCloudKitContainerOptions ¶
type NSPersistentCloudKitContainerOptions struct {
objectivec.Object
}
An object that customizes how a store description aligns with a CloudKit database.
Overview ¶
Use NSPersistentCloudKitContainerOptions to customize the behavior of an NSPersistentCloudKitContainer or to create additional store descriptions that sync to other containers.
For more information about setting up multiple stores, see Setting Up Core Data with CloudKit.
Creating Container Options ¶
- NSPersistentCloudKitContainerOptions.InitWithContainerIdentifier: Initializes container options using the given CloudKit container identifier.
- NSPersistentCloudKitContainerOptions.ContainerIdentifier: The identifier of the CloudKit container associated with a given store description.
- NSPersistentCloudKitContainerOptions.DatabaseScope: The database scope — public, private, or shared — to use for a specified store in a persistent CloudKit container.
- NSPersistentCloudKitContainerOptions.SetDatabaseScope
See: https://developer.apple.com/documentation/CoreData/NSPersistentCloudKitContainerOptions
func NSPersistentCloudKitContainerOptionsFromID ¶
func NSPersistentCloudKitContainerOptionsFromID(id objc.ID) NSPersistentCloudKitContainerOptions
NSPersistentCloudKitContainerOptionsFromID constructs a NSPersistentCloudKitContainerOptions from an objc.ID.
An object that customizes how a store description aligns with a CloudKit database.
func NewNSPersistentCloudKitContainerOptions ¶
func NewNSPersistentCloudKitContainerOptions() NSPersistentCloudKitContainerOptions
NewNSPersistentCloudKitContainerOptions creates a new NSPersistentCloudKitContainerOptions instance.
func NewPersistentCloudKitContainerOptionsWithContainerIdentifier ¶
func NewPersistentCloudKitContainerOptionsWithContainerIdentifier(containerIdentifier string) NSPersistentCloudKitContainerOptions
Initializes container options using the given CloudKit container identifier.
func (NSPersistentCloudKitContainerOptions) Autorelease ¶
func (p NSPersistentCloudKitContainerOptions) Autorelease() NSPersistentCloudKitContainerOptions
Autorelease adds the receiver to the current autorelease pool.
func (NSPersistentCloudKitContainerOptions) ContainerIdentifier ¶
func (p NSPersistentCloudKitContainerOptions) ContainerIdentifier() string
The identifier of the CloudKit container associated with a given store description.
func (NSPersistentCloudKitContainerOptions) DatabaseScope ¶
func (p NSPersistentCloudKitContainerOptions) DatabaseScope() uint
The database scope — public, private, or shared — to use for a specified store in a persistent CloudKit container.
func (NSPersistentCloudKitContainerOptions) InitWithContainerIdentifier ¶
func (p NSPersistentCloudKitContainerOptions) InitWithContainerIdentifier(containerIdentifier string) NSPersistentCloudKitContainerOptions
Initializes container options using the given CloudKit container identifier.
func (NSPersistentCloudKitContainerOptions) SetDatabaseScope ¶
func (p NSPersistentCloudKitContainerOptions) SetDatabaseScope(value uint)
type NSPersistentCloudKitContainerOptionsClass ¶
type NSPersistentCloudKitContainerOptionsClass struct {
// contains filtered or unexported fields
}
func GetNSPersistentCloudKitContainerOptionsClass ¶
func GetNSPersistentCloudKitContainerOptionsClass() NSPersistentCloudKitContainerOptionsClass
GetNSPersistentCloudKitContainerOptionsClass returns the class object for NSPersistentCloudKitContainerOptions.
func (NSPersistentCloudKitContainerOptionsClass) Alloc ¶
Alloc allocates memory for a new instance of the class.
func (NSPersistentCloudKitContainerOptionsClass) Class ¶
func (nc NSPersistentCloudKitContainerOptionsClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSPersistentCloudKitContainerSchemaInitializationOptions ¶
type NSPersistentCloudKitContainerSchemaInitializationOptions uint
const ( // NSPersistentCloudKitContainerSchemaInitializationOptionsDryRun: A flag that indicates the container validates the model and generates the records, but doesn’t upload them to CloudKit. NSPersistentCloudKitContainerSchemaInitializationOptionsDryRun NSPersistentCloudKitContainerSchemaInitializationOptions = 2 // NSPersistentCloudKitContainerSchemaInitializationOptionsNone: Indicates there are no specified schema options. NSPersistentCloudKitContainerSchemaInitializationOptionsNone NSPersistentCloudKitContainerSchemaInitializationOptions = 0 // NSPersistentCloudKitContainerSchemaInitializationOptionsPrintSchema: Prints the generated records to the console. NSPersistentCloudKitContainerSchemaInitializationOptionsPrintSchema NSPersistentCloudKitContainerSchemaInitializationOptions = 4 )
func (NSPersistentCloudKitContainerSchemaInitializationOptions) String ¶
func (e NSPersistentCloudKitContainerSchemaInitializationOptions) String() string
type NSPersistentContainer ¶
type NSPersistentContainer struct {
objectivec.Object
}
A container that encapsulates the Core Data stack in your app.
Overview ¶
NSPersistentContainer simplifies the creation and management of the Core Data stack by handling the creation of the managed object model (NSManagedObjectModel), persistent store coordinator (NSPersistentStoreCoordinator), and the managed object context (NSManagedObjectContext).
Creating a Container ¶
- NSPersistentContainer.InitWithName: Creates a container with the specified name.
- NSPersistentContainer.InitWithNameManagedObjectModel: Create a container with the specified name and managed object model.
Getting the Container’s Configuration ¶
- NSPersistentContainer.ManagedObjectModel: The container’s managed object model.
- NSPersistentContainer.Name: The container’s name.
- NSPersistentContainer.PersistentStoreCoordinator: The container’s persistent store coordinator.
Managing Persistent Stores ¶
- NSPersistentContainer.PersistentStoreDescriptions: The descriptions of the container’s persistent stores.
- NSPersistentContainer.SetPersistentStoreDescriptions
- NSPersistentContainer.LoadPersistentStoresWithCompletionHandler: Loads the persistent stores.
Acquiring Contexts ¶
- NSPersistentContainer.NewBackgroundContext: Returns a new managed object context that executes on a private queue.
- NSPersistentContainer.ViewContext: The main queue’s managed object context.
Performing Background Tasks ¶
- NSPersistentContainer.PerformBackgroundTask: Executes a closure on a private queue using an ephemeral managed object context.
See: https://developer.apple.com/documentation/CoreData/NSPersistentContainer
func NSPersistentContainerFromID ¶
func NSPersistentContainerFromID(id objc.ID) NSPersistentContainer
NSPersistentContainerFromID constructs a NSPersistentContainer from an objc.ID.
A container that encapsulates the Core Data stack in your app.
func NewNSPersistentContainer ¶
func NewNSPersistentContainer() NSPersistentContainer
NewNSPersistentContainer creates a new NSPersistentContainer instance.
func NewPersistentContainerWithName ¶
func NewPersistentContainerWithName(name string) NSPersistentContainer
Creates a container with the specified name.
name: The name of the NSPersistentContainer object.
Return Value ¶
A persistent container initialized with the given name.
Discussion ¶
By default, the provided name value is used to name the persistent store and is used to look up the name of the NSManagedObjectModel object to be used with the NSPersistentContainer object.
See: https://developer.apple.com/documentation/CoreData/NSPersistentContainer/init(name:)
func NewPersistentContainerWithNameManagedObjectModel ¶
func NewPersistentContainerWithNameManagedObjectModel(name string, model INSManagedObjectModel) NSPersistentContainer
Create a container with the specified name and managed object model.
name: The name used by the persistent container.
model: The managed object model to be used by the persistent container.
Return Value ¶
A persistent container initialized with the given name and model.
Discussion ¶
By default, the provided name value of the container is used as the name of the persisent store associated with the container. Passing in the NSManagedObjectModel object overrides the lookup of the model by the provided name value.
func (NSPersistentContainer) Autorelease ¶
func (p NSPersistentContainer) Autorelease() NSPersistentContainer
Autorelease adds the receiver to the current autorelease pool.
func (NSPersistentContainer) Init ¶
func (p NSPersistentContainer) Init() NSPersistentContainer
Init initializes the instance.
func (NSPersistentContainer) InitWithName ¶
func (p NSPersistentContainer) InitWithName(name string) NSPersistentContainer
Creates a container with the specified name.
name: The name of the NSPersistentContainer object.
Return Value ¶
A persistent container initialized with the given name.
Discussion ¶
By default, the provided name value is used to name the persistent store and is used to look up the name of the NSManagedObjectModel object to be used with the NSPersistentContainer object.
See: https://developer.apple.com/documentation/CoreData/NSPersistentContainer/init(name:)
func (NSPersistentContainer) InitWithNameManagedObjectModel ¶
func (p NSPersistentContainer) InitWithNameManagedObjectModel(name string, model INSManagedObjectModel) NSPersistentContainer
Create a container with the specified name and managed object model.
name: The name used by the persistent container.
model: The managed object model to be used by the persistent container.
Return Value ¶
A persistent container initialized with the given name and model.
Discussion ¶
By default, the provided name value of the container is used as the name of the persisent store associated with the container. Passing in the NSManagedObjectModel object overrides the lookup of the model by the provided name value.
func (NSPersistentContainer) LoadPersistentStores ¶
func (p NSPersistentContainer) LoadPersistentStores(ctx context.Context) (*NSPersistentStoreDescription, error)
LoadPersistentStores is a synchronous wrapper around NSPersistentContainer.LoadPersistentStoresWithCompletionHandler. It blocks until the completion handler fires or the context is cancelled.
func (NSPersistentContainer) LoadPersistentStoresWithCompletionHandler ¶
func (p NSPersistentContainer) LoadPersistentStoresWithCompletionHandler(block PersistentStoreDescriptionErrorHandler)
Loads the persistent stores.
block: Once the loading of the persistent stores has completed, this block will be executed on the calling thread.
Discussion ¶
Once the persistent container has been initialized, you need to execute NSPersistentContainer.LoadPersistentStoresWithCompletionHandler to instruct the container to load the persistent stores and complete the creation of the Core Data stack.
Once the completion handler has fired, the stack is fully initialized and is ready for use. The completion handler will be called once for each persistent store that is created.
If there is an error in the loading of the persistent stores, the NSError value will be populated.
func (NSPersistentContainer) ManagedObjectModel ¶
func (p NSPersistentContainer) ManagedObjectModel() INSManagedObjectModel
The container’s managed object model.
Discussion ¶
This property contains a reference to the NSManagedObjectModel object associated with this persistent container.
See: https://developer.apple.com/documentation/CoreData/NSPersistentContainer/managedObjectModel
func (NSPersistentContainer) Name ¶
func (p NSPersistentContainer) Name() string
The container’s name.
Discussion ¶
This property is passed in as part of the initialization of the persistent container. This name is used to locate the NSManagedObjectModel (if the NSManagedObjectModel object is not passed in as part of the initialization) and is used to name the persistent store.
See: https://developer.apple.com/documentation/CoreData/NSPersistentContainer/name
func (NSPersistentContainer) NewBackgroundContext ¶
func (p NSPersistentContainer) NewBackgroundContext() INSManagedObjectContext
Returns a new managed object context that executes on a private queue.
Return Value ¶
A newly created private managed object context.
Discussion ¶
Invoking this method causes the persistent container to create and return a new NSManagedObjectContext with the NSManagedObjectContext.ConcurrencyType set to NSManagedObjectContextConcurrencyType.privateQueueConcurrencyType. This new context will be associated with the NSPersistentStoreCoordinator directly and is set to consume NSManagedObjectContextDidSave broadcasts automatically.
See: https://developer.apple.com/documentation/CoreData/NSPersistentContainer/newBackgroundContext()
func (NSPersistentContainer) PerformBackgroundTask ¶
func (p NSPersistentContainer) PerformBackgroundTask(block ManagedObjectContextHandler)
Executes a closure on a private queue using an ephemeral managed object context.
block: A closure that is executed by the persistent container against a newly created private context. The private context is passed into the block as part of the execution of the block.
Discussion ¶
Each time this method is invoked, the persistent container creates a new NSManagedObjectContext with the NSManagedObjectContext.ConcurrencyType set to NSManagedObjectContextConcurrencyType.privateQueueConcurrencyType. The persistent container then executes the passed in block against that newly created context on the context’s private queue.
func (NSPersistentContainer) PerformBackgroundTaskSync ¶
func (p NSPersistentContainer) PerformBackgroundTaskSync(ctx context.Context) (*NSManagedObjectContext, error)
PerformBackgroundTaskSync is a synchronous wrapper around NSPersistentContainer.PerformBackgroundTask. It blocks until the completion handler fires or the context is cancelled.
func (NSPersistentContainer) PersistentStoreCoordinator ¶
func (p NSPersistentContainer) PersistentStoreCoordinator() INSPersistentStoreCoordinator
The container’s persistent store coordinator.
Discussion ¶
When the persistent container is initialized, it creates a persistent store coordinator as part of that initialization. That persistent store coordinator is referenced in this property.
See: https://developer.apple.com/documentation/CoreData/NSPersistentContainer/persistentStoreCoordinator
func (NSPersistentContainer) PersistentStoreDescriptions ¶
func (p NSPersistentContainer) PersistentStoreDescriptions() []NSPersistentStoreDescription
The descriptions of the container’s persistent stores.
Discussion ¶
If you want to override the type (or types) of persistent store(s) used by the persistent container, you can set this property with an array of NSPersistentStoreDescription objects.
If you will be configuring custom persistent store descriptions, you must set this property before calling NSPersistentContainer.LoadPersistentStoresWithCompletionHandler.
See: https://developer.apple.com/documentation/CoreData/NSPersistentContainer/persistentStoreDescriptions
func (NSPersistentContainer) SetPersistentStoreDescriptions ¶
func (p NSPersistentContainer) SetPersistentStoreDescriptions(value []NSPersistentStoreDescription)
func (NSPersistentContainer) ViewContext ¶
func (p NSPersistentContainer) ViewContext() INSManagedObjectContext
The main queue’s managed object context.
Discussion ¶
This property contains a reference to the NSManagedObjectContext that is created and owned by the persistent container which is associated with the main queue of the application. This context is created automatically as part of the initialization of the persistent container.
This context is associated directly with the NSPersistentStoreCoordinator and is non-generational by default.
See: https://developer.apple.com/documentation/CoreData/NSPersistentContainer/viewContext
type NSPersistentContainerClass ¶
type NSPersistentContainerClass struct {
// contains filtered or unexported fields
}
func GetNSPersistentContainerClass ¶
func GetNSPersistentContainerClass() NSPersistentContainerClass
GetNSPersistentContainerClass returns the class object for NSPersistentContainer.
func (NSPersistentContainerClass) Alloc ¶
func (nc NSPersistentContainerClass) Alloc() NSPersistentContainer
Alloc allocates memory for a new instance of the class.
func (NSPersistentContainerClass) Class ¶
func (nc NSPersistentContainerClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (NSPersistentContainerClass) DefaultDirectoryURL ¶
func (_NSPersistentContainerClass NSPersistentContainerClass) DefaultDirectoryURL() foundation.NSURL
The location of the directory that contains the persistent stores.
func (NSPersistentContainerClass) SetDefaultDirectoryURL ¶
func (_NSPersistentContainerClass NSPersistentContainerClass) SetDefaultDirectoryURL(value foundation.NSURL)
type NSPersistentHistoryChange ¶
type NSPersistentHistoryChange struct {
objectivec.Object
}
A change representing the insertion, update, or deletion of a managed object in the persistent store.
Inspecting Change Details ¶
- NSPersistentHistoryChange.ChangeID: The change’s numeric identifier.
- NSPersistentHistoryChange.ChangeType: The type of change to the managed object in the persistent store.
- NSPersistentHistoryChange.ChangedObjectID: The identifier of the managed object that changed. (swift) Declaration: @property(readonly, copy) NSManagedObjectID *changedObjectID; (objc) Availability: iOS: 11.0 — iPadOS: 11.0 — Mac Catalyst: 13.1 — macOS: 10.13 — tvOS: 11.0 — visionOS: 1.0 — watchOS: 4.0 (objc,swift) }
- NSPersistentHistoryChange.Tombstone: A dictionary of attributes marked for preservation after deletion, and their values when deleted.
- NSPersistentHistoryChange.Transaction: The persistent history transaction containing this change.
- NSPersistentHistoryChange.UpdatedProperties: The set of properties that were updated on the managed object.
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryChange
func NSPersistentHistoryChangeFromID ¶
func NSPersistentHistoryChangeFromID(id objc.ID) NSPersistentHistoryChange
NSPersistentHistoryChangeFromID constructs a NSPersistentHistoryChange from an objc.ID.
A change representing the insertion, update, or deletion of a managed object in the persistent store.
func NewNSPersistentHistoryChange ¶
func NewNSPersistentHistoryChange() NSPersistentHistoryChange
NewNSPersistentHistoryChange creates a new NSPersistentHistoryChange instance.
func (NSPersistentHistoryChange) Autorelease ¶
func (p NSPersistentHistoryChange) Autorelease() NSPersistentHistoryChange
Autorelease adds the receiver to the current autorelease pool.
func (NSPersistentHistoryChange) ChangeID ¶
func (p NSPersistentHistoryChange) ChangeID() int64
The change’s numeric identifier.
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryChange/changeID
func (NSPersistentHistoryChange) ChangeType ¶
func (p NSPersistentHistoryChange) ChangeType() NSPersistentHistoryChangeType
The type of change to the managed object in the persistent store.
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryChange/changeType
func (NSPersistentHistoryChange) ChangedObjectID ¶
func (p NSPersistentHistoryChange) ChangedObjectID() INSManagedObjectID
The identifier of the managed object that changed. (swift) Declaration: @property(readonly, copy) NSManagedObjectID *changedObjectID; (objc) Availability: iOS: 11.0 — iPadOS: 11.0 — Mac Catalyst: 13.1 — macOS: 10.13 — tvOS: 11.0 — visionOS: 1.0 — watchOS: 4.0 (objc,swift) }
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryChange/changedObjectID
func (NSPersistentHistoryChange) Init ¶
func (p NSPersistentHistoryChange) Init() NSPersistentHistoryChange
Init initializes the instance.
func (NSPersistentHistoryChange) Tombstone ¶
func (p NSPersistentHistoryChange) Tombstone() foundation.INSDictionary
A dictionary of attributes marked for preservation after deletion, and their values when deleted.
Discussion ¶
This value is expected on changes of type NSPersistentHistoryChangeType.delete.
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryChange/tombstone
func (NSPersistentHistoryChange) Transaction ¶
func (p NSPersistentHistoryChange) Transaction() INSPersistentHistoryTransaction
The persistent history transaction containing this change.
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryChange/transaction
func (NSPersistentHistoryChange) UpdatedProperties ¶
func (p NSPersistentHistoryChange) UpdatedProperties() foundation.INSSet
The set of properties that were updated on the managed object.
Discussion ¶
This value is expected on changes of type NSPersistentHistoryChangeType.update.
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryChange/updatedProperties
type NSPersistentHistoryChangeClass ¶
type NSPersistentHistoryChangeClass struct {
// contains filtered or unexported fields
}
func GetNSPersistentHistoryChangeClass ¶
func GetNSPersistentHistoryChangeClass() NSPersistentHistoryChangeClass
GetNSPersistentHistoryChangeClass returns the class object for NSPersistentHistoryChange.
func (NSPersistentHistoryChangeClass) Alloc ¶
func (nc NSPersistentHistoryChangeClass) Alloc() NSPersistentHistoryChange
Alloc allocates memory for a new instance of the class.
func (NSPersistentHistoryChangeClass) Class ¶
func (nc NSPersistentHistoryChangeClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (NSPersistentHistoryChangeClass) EntityDescription ¶
func (_NSPersistentHistoryChangeClass NSPersistentHistoryChangeClass) EntityDescription() NSEntityDescription
The entity description of the persistent history change entity.
Discussion ¶
The entity description of a NSPersistentHistoryChange, includes its properties, which can be useful for filtering your persistent history change request.
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryChange/entityDescription
func (NSPersistentHistoryChangeClass) EntityDescriptionWithContext ¶
func (_NSPersistentHistoryChangeClass NSPersistentHistoryChangeClass) EntityDescriptionWithContext(context INSManagedObjectContext) NSEntityDescription
Requests an entity description for the managed object type affected by the change using the provided context.
context: The managed object context for this request.
Return Value ¶
The entity description (NSEntityDescription) of the persistent history transaction entity.
func (NSPersistentHistoryChangeClass) FetchRequest ¶
func (_NSPersistentHistoryChangeClass NSPersistentHistoryChangeClass) FetchRequest() NSFetchRequest
A fetch request that has the persistent history change as the entity.
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryChange/fetchRequest
type NSPersistentHistoryChangeRequest ¶
type NSPersistentHistoryChangeRequest struct {
NSPersistentStoreRequest
}
A request to fetch or purge persistent history.
Configuring the Request ¶
- NSPersistentHistoryChangeRequest.FetchRequest: The specified fetch request, when retrieving history.
- NSPersistentHistoryChangeRequest.SetFetchRequest
- NSPersistentHistoryChangeRequest.ResultType: The type of result that this request returns.
- NSPersistentHistoryChangeRequest.SetResultType
Getting the Token ¶
- NSPersistentHistoryChangeRequest.Token: The specified token, when retrieving history defined by a token.
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryChangeRequest
func NSPersistentHistoryChangeRequestFromID ¶
func NSPersistentHistoryChangeRequestFromID(id objc.ID) NSPersistentHistoryChangeRequest
NSPersistentHistoryChangeRequestFromID constructs a NSPersistentHistoryChangeRequest from an objc.ID.
A request to fetch or purge persistent history.
func NewNSPersistentHistoryChangeRequest ¶
func NewNSPersistentHistoryChangeRequest() NSPersistentHistoryChangeRequest
NewNSPersistentHistoryChangeRequest creates a new NSPersistentHistoryChangeRequest instance.
func (NSPersistentHistoryChangeRequest) Autorelease ¶
func (p NSPersistentHistoryChangeRequest) Autorelease() NSPersistentHistoryChangeRequest
Autorelease adds the receiver to the current autorelease pool.
func (NSPersistentHistoryChangeRequest) FetchRequest ¶
func (p NSPersistentHistoryChangeRequest) FetchRequest() INSFetchRequest
The specified fetch request, when retrieving history.
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryChangeRequest/fetchRequest
func (NSPersistentHistoryChangeRequest) Init ¶
func (p NSPersistentHistoryChangeRequest) Init() NSPersistentHistoryChangeRequest
Init initializes the instance.
func (NSPersistentHistoryChangeRequest) ResultType ¶
func (p NSPersistentHistoryChangeRequest) ResultType() NSPersistentHistoryResultType
The type of result that this request returns.
Discussion ¶
This value defaults to NSPersistentHistoryResultType.transactionsAndChanges.
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryChangeRequest/resultType
func (NSPersistentHistoryChangeRequest) SetFetchRequest ¶
func (p NSPersistentHistoryChangeRequest) SetFetchRequest(value INSFetchRequest)
func (NSPersistentHistoryChangeRequest) SetResultType ¶
func (p NSPersistentHistoryChangeRequest) SetResultType(value NSPersistentHistoryResultType)
func (NSPersistentHistoryChangeRequest) Token ¶
func (p NSPersistentHistoryChangeRequest) Token() INSPersistentHistoryToken
The specified token, when retrieving history defined by a token.
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryChangeRequest/token
type NSPersistentHistoryChangeRequestClass ¶
type NSPersistentHistoryChangeRequestClass struct {
// contains filtered or unexported fields
}
func GetNSPersistentHistoryChangeRequestClass ¶
func GetNSPersistentHistoryChangeRequestClass() NSPersistentHistoryChangeRequestClass
GetNSPersistentHistoryChangeRequestClass returns the class object for NSPersistentHistoryChangeRequest.
func (NSPersistentHistoryChangeRequestClass) Alloc ¶
func (nc NSPersistentHistoryChangeRequestClass) Alloc() NSPersistentHistoryChangeRequest
Alloc allocates memory for a new instance of the class.
func (NSPersistentHistoryChangeRequestClass) Class ¶
func (nc NSPersistentHistoryChangeRequestClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (NSPersistentHistoryChangeRequestClass) DeleteHistoryBeforeDate ¶
func (_NSPersistentHistoryChangeRequestClass NSPersistentHistoryChangeRequestClass) DeleteHistoryBeforeDate(date foundation.NSDate) NSPersistentHistoryChangeRequest
Purges history older than a given date.
date: The date used to define the end of the delete history request.
Return Value ¶
A delete history change request (NSPersistentHistoryChangeRequest) using an end date boundary.
func (NSPersistentHistoryChangeRequestClass) DeleteHistoryBeforeToken ¶
func (_NSPersistentHistoryChangeRequestClass NSPersistentHistoryChangeRequestClass) DeleteHistoryBeforeToken(token INSPersistentHistoryToken) NSPersistentHistoryChangeRequest
Purges history older than that defined by a given token.
token: The bookmark that marks the end of the delete history request.
Return Value ¶
A delete history change request (NSPersistentHistoryChangeRequest) using an end token bookmark boundary.
func (NSPersistentHistoryChangeRequestClass) DeleteHistoryBeforeTransaction ¶
func (_NSPersistentHistoryChangeRequestClass NSPersistentHistoryChangeRequestClass) DeleteHistoryBeforeTransaction(transaction INSPersistentHistoryTransaction) NSPersistentHistoryChangeRequest
Purges history older than a given transaction.
transaction: The transaction that marks the end of the delete history request.
Return Value ¶
A delete history change request (NSPersistentHistoryChangeRequest) using an end transaction boundary.
func (NSPersistentHistoryChangeRequestClass) FetchHistoryAfterDate ¶
func (_NSPersistentHistoryChangeRequestClass NSPersistentHistoryChangeRequestClass) FetchHistoryAfterDate(date foundation.NSDate) NSPersistentHistoryChangeRequest
Retrieves history since a given date.
date: The date used to define the start of the fetch history.
Return Value ¶
A persistent history fetch request (NSPersistentHistoryChangeRequest) with an initial date boundary.
func (NSPersistentHistoryChangeRequestClass) FetchHistoryAfterToken ¶
func (_NSPersistentHistoryChangeRequestClass NSPersistentHistoryChangeRequestClass) FetchHistoryAfterToken(token INSPersistentHistoryToken) NSPersistentHistoryChangeRequest
Retrieves the request history after a given token.
token: The bookmark that defines the start of the request history.
Return Value ¶
A persistent history fetch request (NSPersistentHistoryChangeRequest) with an initial token bookmark boundary.
func (NSPersistentHistoryChangeRequestClass) FetchHistoryAfterTransaction ¶
func (_NSPersistentHistoryChangeRequestClass NSPersistentHistoryChangeRequestClass) FetchHistoryAfterTransaction(transaction INSPersistentHistoryTransaction) NSPersistentHistoryChangeRequest
Retrieves history since a given transaction.
transaction: The transaction that marks the beginning of the history request.
Return Value ¶
A persistent history fetch request (NSPersistentHistoryChangeRequest) with an initial transaction boundary.
func (NSPersistentHistoryChangeRequestClass) FetchHistoryWithFetchRequest ¶
func (_NSPersistentHistoryChangeRequestClass NSPersistentHistoryChangeRequestClass) FetchHistoryWithFetchRequest(fetchRequest INSFetchRequest) NSPersistentHistoryChangeRequest
Retrieves history based on a fetch request.
fetchRequest: The fetch request that defines the history bounds.
Return Value ¶
A persistent history fetch request (NSPersistentHistoryChangeRequest) built using an existing fetch request.
type NSPersistentHistoryChangeType ¶
type NSPersistentHistoryChangeType int
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryChangeType
const ( // NSPersistentHistoryChangeTypeDelete: The deletion of a managed object from the persistent store. NSPersistentHistoryChangeTypeDelete NSPersistentHistoryChangeType = 2 // NSPersistentHistoryChangeTypeInsert: The insertion of a managed object into the persistent store. NSPersistentHistoryChangeTypeInsert NSPersistentHistoryChangeType = 0 // NSPersistentHistoryChangeTypeUpdate: An update to a managed object’s properties in the persistent store. NSPersistentHistoryChangeTypeUpdate NSPersistentHistoryChangeType = 1 )
func (NSPersistentHistoryChangeType) String ¶
func (e NSPersistentHistoryChangeType) String() string
type NSPersistentHistoryResult ¶
type NSPersistentHistoryResult struct {
NSPersistentStoreResult
}
The result of a request to fetch persistent history.
Inspecting History Results ¶
- NSPersistentHistoryResult.Result: The result of the history request determined by the persistent history result type.
- NSPersistentHistoryResult.ResultType: The type of result that the persistent history change request returns.
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryResult
func NSPersistentHistoryResultFromID ¶
func NSPersistentHistoryResultFromID(id objc.ID) NSPersistentHistoryResult
NSPersistentHistoryResultFromID constructs a NSPersistentHistoryResult from an objc.ID.
The result of a request to fetch persistent history.
func NewNSPersistentHistoryResult ¶
func NewNSPersistentHistoryResult() NSPersistentHistoryResult
NewNSPersistentHistoryResult creates a new NSPersistentHistoryResult instance.
func (NSPersistentHistoryResult) Autorelease ¶
func (p NSPersistentHistoryResult) Autorelease() NSPersistentHistoryResult
Autorelease adds the receiver to the current autorelease pool.
func (NSPersistentHistoryResult) Init ¶
func (p NSPersistentHistoryResult) Init() NSPersistentHistoryResult
Init initializes the instance.
func (NSPersistentHistoryResult) Result ¶
func (p NSPersistentHistoryResult) Result() objectivec.IObject
The result of the history request determined by the persistent history result type.
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryResult/result
func (NSPersistentHistoryResult) ResultType ¶
func (p NSPersistentHistoryResult) ResultType() NSPersistentHistoryResultType
The type of result that the persistent history change request returns.
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryResult/resultType
type NSPersistentHistoryResultClass ¶
type NSPersistentHistoryResultClass struct {
// contains filtered or unexported fields
}
func GetNSPersistentHistoryResultClass ¶
func GetNSPersistentHistoryResultClass() NSPersistentHistoryResultClass
GetNSPersistentHistoryResultClass returns the class object for NSPersistentHistoryResult.
func (NSPersistentHistoryResultClass) Alloc ¶
func (nc NSPersistentHistoryResultClass) Alloc() NSPersistentHistoryResult
Alloc allocates memory for a new instance of the class.
func (NSPersistentHistoryResultClass) Class ¶
func (nc NSPersistentHistoryResultClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSPersistentHistoryResultType ¶
type NSPersistentHistoryResultType int
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryResultType
const ( // NSPersistentHistoryResultTypeChangesOnly: The persistent history changes since the requested date, token, or transaction. NSPersistentHistoryResultTypeChangesOnly NSPersistentHistoryResultType = 0x4 // NSPersistentHistoryResultTypeCount: The number of persistent history changes since the requested date, token, or transaction. NSPersistentHistoryResultTypeCount NSPersistentHistoryResultType = 0x2 // NSPersistentHistoryResultTypeObjectIDs: The identifiers of managed objects changed since the requested date, token, or transaction. NSPersistentHistoryResultTypeObjectIDs NSPersistentHistoryResultType = 0x1 // NSPersistentHistoryResultTypeStatusOnly: The status of the persistent history change request. NSPersistentHistoryResultTypeStatusOnly NSPersistentHistoryResultType = 0 // NSPersistentHistoryResultTypeTransactionsAndChanges: The persistent history transactions and changes since the requested date, token, or transaction. NSPersistentHistoryResultTypeTransactionsAndChanges NSPersistentHistoryResultType = 0x5 // NSPersistentHistoryResultTypeTransactionsOnly: The persistent history transactions since the requested date, token, or transaction. NSPersistentHistoryResultTypeTransactionsOnly NSPersistentHistoryResultType = 0x3 )
func (NSPersistentHistoryResultType) String ¶
func (e NSPersistentHistoryResultType) String() string
type NSPersistentHistoryToken ¶
type NSPersistentHistoryToken struct {
objectivec.Object
}
A bookmark for keeping track the most recent history that you’ve processed.
Overview ¶
You can save a token to disk and fetch history when your app loads based on that token. See Keep track of the most recent history in Consuming relevant store changes.
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryToken
func NSPersistentHistoryTokenFromID ¶
func NSPersistentHistoryTokenFromID(id objc.ID) NSPersistentHistoryToken
NSPersistentHistoryTokenFromID constructs a NSPersistentHistoryToken from an objc.ID.
A bookmark for keeping track the most recent history that you’ve processed.
func NewNSPersistentHistoryToken ¶
func NewNSPersistentHistoryToken() NSPersistentHistoryToken
NewNSPersistentHistoryToken creates a new NSPersistentHistoryToken instance.
func (NSPersistentHistoryToken) Autorelease ¶
func (p NSPersistentHistoryToken) Autorelease() NSPersistentHistoryToken
Autorelease adds the receiver to the current autorelease pool.
func (NSPersistentHistoryToken) EncodeWithCoder ¶
func (p NSPersistentHistoryToken) EncodeWithCoder(coder foundation.INSCoder)
func (NSPersistentHistoryToken) Init ¶
func (p NSPersistentHistoryToken) Init() NSPersistentHistoryToken
Init initializes the instance.
type NSPersistentHistoryTokenClass ¶
type NSPersistentHistoryTokenClass struct {
// contains filtered or unexported fields
}
func GetNSPersistentHistoryTokenClass ¶
func GetNSPersistentHistoryTokenClass() NSPersistentHistoryTokenClass
GetNSPersistentHistoryTokenClass returns the class object for NSPersistentHistoryToken.
func (NSPersistentHistoryTokenClass) Alloc ¶
func (nc NSPersistentHistoryTokenClass) Alloc() NSPersistentHistoryToken
Alloc allocates memory for a new instance of the class.
func (NSPersistentHistoryTokenClass) Class ¶
func (nc NSPersistentHistoryTokenClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSPersistentHistoryTransaction ¶
type NSPersistentHistoryTransaction struct {
objectivec.Object
}
A set of changes in the persistent history based on a context save or batch operation.
Requesting Notifications ¶
- NSPersistentHistoryTransaction.ObjectIDNotification: Obtains a notification for use in merging the transaction’s changes into a managed object context.
Inspecting Transaction Details ¶
- NSPersistentHistoryTransaction.Author: A granular description of the context that made the persistent history change, if available.
- NSPersistentHistoryTransaction.BundleID: The originating bundle’s identifier.
- NSPersistentHistoryTransaction.Changes: The array of persistent history changes.
- NSPersistentHistoryTransaction.ContextName: The originating context’s name.
- NSPersistentHistoryTransaction.ProcessID: The originating process’s identifier.
- NSPersistentHistoryTransaction.StoreID: The originating store’s identifier.
- NSPersistentHistoryTransaction.Timestamp: The date of the persistent history change.
- NSPersistentHistoryTransaction.Token: The token that represents this transaction in the persistent history.
- NSPersistentHistoryTransaction.TransactionNumber: The transaction’s numeric identifier.
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryTransaction
func NSPersistentHistoryTransactionFromID ¶
func NSPersistentHistoryTransactionFromID(id objc.ID) NSPersistentHistoryTransaction
NSPersistentHistoryTransactionFromID constructs a NSPersistentHistoryTransaction from an objc.ID.
A set of changes in the persistent history based on a context save or batch operation.
func NewNSPersistentHistoryTransaction ¶
func NewNSPersistentHistoryTransaction() NSPersistentHistoryTransaction
NewNSPersistentHistoryTransaction creates a new NSPersistentHistoryTransaction instance.
func (NSPersistentHistoryTransaction) Author ¶
func (p NSPersistentHistoryTransaction) Author() string
A granular description of the context that made the persistent history change, if available.
Discussion ¶
This property has a value if the managed object context set a NSManagedObjectContext.TransactionAuthor before the save.
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryTransaction/author
func (NSPersistentHistoryTransaction) Autorelease ¶
func (p NSPersistentHistoryTransaction) Autorelease() NSPersistentHistoryTransaction
Autorelease adds the receiver to the current autorelease pool.
func (NSPersistentHistoryTransaction) BundleID ¶
func (p NSPersistentHistoryTransaction) BundleID() string
The originating bundle’s identifier.
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryTransaction/bundleID
func (NSPersistentHistoryTransaction) Changes ¶
func (p NSPersistentHistoryTransaction) Changes() []NSPersistentHistoryChange
The array of persistent history changes.
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryTransaction/changes
func (NSPersistentHistoryTransaction) ContextName ¶
func (p NSPersistentHistoryTransaction) ContextName() string
The originating context’s name.
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryTransaction/contextName
func (NSPersistentHistoryTransaction) Init ¶
func (p NSPersistentHistoryTransaction) Init() NSPersistentHistoryTransaction
Init initializes the instance.
func (NSPersistentHistoryTransaction) ObjectIDNotification ¶
func (p NSPersistentHistoryTransaction) ObjectIDNotification() foundation.NSNotification
Obtains a notification for use in merging the transaction’s changes into a managed object context.
Return Value ¶
An [NSManagedObjectContextDidSaveObjectIDsNotification] notification.
Discussion ¶
To merge the relevant changes into your view context, first obtain a notification by calling `objectIDNotification()` on the transaction. Then, pass the notification to NSManagedObjectContext.MergeChangesFromContextDidSaveNotification.
func (NSPersistentHistoryTransaction) ProcessID ¶
func (p NSPersistentHistoryTransaction) ProcessID() string
The originating process’s identifier.
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryTransaction/processID
func (NSPersistentHistoryTransaction) StoreID ¶
func (p NSPersistentHistoryTransaction) StoreID() string
The originating store’s identifier.
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryTransaction/storeID
func (NSPersistentHistoryTransaction) Timestamp ¶
func (p NSPersistentHistoryTransaction) Timestamp() foundation.NSDate
The date of the persistent history change.
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryTransaction/timestamp
func (NSPersistentHistoryTransaction) Token ¶
func (p NSPersistentHistoryTransaction) Token() INSPersistentHistoryToken
The token that represents this transaction in the persistent history.
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryTransaction/token
func (NSPersistentHistoryTransaction) TransactionNumber ¶
func (p NSPersistentHistoryTransaction) TransactionNumber() int64
The transaction’s numeric identifier.
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryTransaction/transactionNumber
type NSPersistentHistoryTransactionClass ¶
type NSPersistentHistoryTransactionClass struct {
// contains filtered or unexported fields
}
func GetNSPersistentHistoryTransactionClass ¶
func GetNSPersistentHistoryTransactionClass() NSPersistentHistoryTransactionClass
GetNSPersistentHistoryTransactionClass returns the class object for NSPersistentHistoryTransaction.
func (NSPersistentHistoryTransactionClass) Alloc ¶
func (nc NSPersistentHistoryTransactionClass) Alloc() NSPersistentHistoryTransaction
Alloc allocates memory for a new instance of the class.
func (NSPersistentHistoryTransactionClass) Class ¶
func (nc NSPersistentHistoryTransactionClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (NSPersistentHistoryTransactionClass) EntityDescription ¶
func (_NSPersistentHistoryTransactionClass NSPersistentHistoryTransactionClass) EntityDescription() NSEntityDescription
The entity description of the persistent history transaction entity.
Discussion ¶
The entity description of NSPersistentHistoryTransaction lists the properties of the persistent history change. This can be useful for filtering your request.
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryTransaction/entityDescription
func (NSPersistentHistoryTransactionClass) EntityDescriptionWithContext ¶
func (_NSPersistentHistoryTransactionClass NSPersistentHistoryTransactionClass) EntityDescriptionWithContext(context INSManagedObjectContext) NSEntityDescription
Requests an entity description using the provided context for the managed object type affected by the transaction.
context: The managed object context for this request.
Return Value ¶
The entity description (NSEntityDescription) of the persistent history transaction entity.
func (NSPersistentHistoryTransactionClass) FetchRequest ¶
func (_NSPersistentHistoryTransactionClass NSPersistentHistoryTransactionClass) FetchRequest() NSFetchRequest
A fetch request that has the persistent history transaction as the entity.
See: https://developer.apple.com/documentation/CoreData/NSPersistentHistoryTransaction/fetchRequest
type NSPersistentStore ¶
type NSPersistentStore struct {
objectivec.Object
}
The abstract base class for all Core Data persistent stores.
Overview ¶
Core Data provides four store types—SQLite, Binary, XML, and In-Memory (the XML store is not available on iOS); these are described in Persistent Store Features. Core Data also provides subclasses of NSPersistentStore that you can use to define your own store types: NSAtomicStore and NSIncrementalStore. The Binary and XML stores are examples of atomic stores that inherit functionality from NSAtomicStore.
Subclassing Notes ¶
You should not subclass NSPersistentStore directly. Core Data only supports subclassing of NSAtomicStore and NSIncrementalStore.
The designated initializer is NSPersistentStore.InitWithPersistentStoreCoordinatorConfigurationNameURLOptions. When you implement the initializer, you must ensure you load metadata during initialization and set it using NSPersistentStore.Metadata.
You must override these methods:
- NSPersistentStore.Type - NSPersistentStore.Metadata - NSPersistentStoreClass.MetadataForPersistentStoreWithURLError - NSPersistentStoreClass.SetMetadataForPersistentStoreWithURLError
Creating a Persistent Store ¶
- NSPersistentStore.InitWithPersistentStoreCoordinatorConfigurationNameURLOptions: Returns a store initialized with the given arguments.
Getting Store Configuration ¶
- NSPersistentStore.ConfigurationName: The name of the managed object model configuration that creates the persistent store.
- NSPersistentStore.Options: The options that Core Data uses to create the store.
- NSPersistentStore.PersistentStoreCoordinator: The persistent store coordinator that loads the persistent store.
- NSPersistentStore.Type: The type string of the persistent store.
Managing Store Attributes ¶
- NSPersistentStore.Identifier: The unique identifier for the persistent store.
- NSPersistentStore.SetIdentifier
- NSPersistentStore.IsReadOnly: A Boolean value that indicates whether the persistent store is read-only.
- NSPersistentStore.SetReadOnly
- NSPersistentStore.URL: The URL for the persistent store.
- NSPersistentStore.SetURL
Managing Store Metadata ¶
- NSPersistentStore.LoadMetadata: Instructs the persistent store to load its metadata.
- NSPersistentStore.Metadata: The metadata for the persistent store.
- NSPersistentStore.SetMetadata
Responding to the Store Life Cycle ¶
- NSPersistentStore.DidAddToPersistentStoreCoordinator: Invoked after the persistent store has been added to the persistent store coordinator.
- NSPersistentStore.WillRemoveFromPersistentStoreCoordinator: Invoked before the persistent store is removed from the persistent store coordinator.
Integrating with Spotlight ¶
- NSPersistentStore.CoreSpotlightExporter: The spotlight exporter associated with this persistent store.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStore
func NSPersistentStoreFromID ¶
func NSPersistentStoreFromID(id objc.ID) NSPersistentStore
NSPersistentStoreFromID constructs a NSPersistentStore from an objc.ID.
The abstract base class for all Core Data persistent stores.
func NewNSPersistentStore ¶
func NewNSPersistentStore() NSPersistentStore
NewNSPersistentStore creates a new NSPersistentStore instance.
func NewPersistentStoreWithPersistentStoreCoordinatorConfigurationNameURLOptions ¶
func NewPersistentStoreWithPersistentStoreCoordinatorConfigurationNameURLOptions(root INSPersistentStoreCoordinator, name string, url foundation.NSURL, options foundation.INSDictionary) NSPersistentStore
Returns a store initialized with the given arguments.
root: A persistent store coordinator.
name: The name of the managed object model configuration to use. Pass `nil` if you do not want to specify a configuration.
url: The URL of the store to load.
options: A dictionary containing configuration options. See NSPersistentStoreCoordinator for a list of key names for options in this dictionary.
Return Value ¶
A new store object, associated with `coordinator`, that represents a persistent store at url using the options in `options` and—if it is not `nil`—the managed object model configuration `configurationName`.
Discussion ¶
You must ensure that you load metadata during initialization and set it using NSPersistentStore.Metadata.
Special Considerations ¶
This is the designated initializer for persistent stores.
func (NSPersistentStore) Autorelease ¶
func (p NSPersistentStore) Autorelease() NSPersistentStore
Autorelease adds the receiver to the current autorelease pool.
func (NSPersistentStore) ConfigurationName ¶
func (p NSPersistentStore) ConfigurationName() string
The name of the managed object model configuration that creates the persistent store.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStore/configurationName
func (NSPersistentStore) CoreSpotlightExporter ¶
func (p NSPersistentStore) CoreSpotlightExporter() INSCoreDataCoreSpotlightDelegate
The spotlight exporter associated with this persistent store.
Discussion ¶
Spotlight support isn’t available in a compatible iPad or iPhone app running in visionOS.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStore/coreSpotlightExporter
func (NSPersistentStore) DidAddToPersistentStoreCoordinator ¶
func (p NSPersistentStore) DidAddToPersistentStoreCoordinator(coordinator INSPersistentStoreCoordinator)
Invoked after the persistent store has been added to the persistent store coordinator.
coordinator: The persistent store coordinator to which the receiver was added.
Discussion ¶
The default implementation does nothing. You can override this method in a subclass in order to perform any kind of setup necessary before the load method is invoked.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStore/didAdd(to:)
func (NSPersistentStore) Identifier ¶
func (p NSPersistentStore) Identifier() string
The unique identifier for the persistent store.
Discussion ¶
The identifier is used as part of the managed object IDs for each object in the store.
Special Considerations ¶
NSPersistentStore provides a default implementation to provide a globally unique identifier for the store instance.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStore/identifier
func (NSPersistentStore) Init ¶
func (p NSPersistentStore) Init() NSPersistentStore
Init initializes the instance.
func (NSPersistentStore) InitWithPersistentStoreCoordinatorConfigurationNameURLOptions ¶
func (p NSPersistentStore) InitWithPersistentStoreCoordinatorConfigurationNameURLOptions(root INSPersistentStoreCoordinator, name string, url foundation.NSURL, options foundation.INSDictionary) NSPersistentStore
Returns a store initialized with the given arguments.
root: A persistent store coordinator.
name: The name of the managed object model configuration to use. Pass `nil` if you do not want to specify a configuration.
url: The URL of the store to load.
options: A dictionary containing configuration options. See NSPersistentStoreCoordinator for a list of key names for options in this dictionary.
Return Value ¶
A new store object, associated with `coordinator`, that represents a persistent store at url using the options in `options` and—if it is not `nil`—the managed object model configuration `configurationName`.
Discussion ¶
You must ensure that you load metadata during initialization and set it using NSPersistentStore.Metadata.
Special Considerations ¶
This is the designated initializer for persistent stores.
func (NSPersistentStore) IsReadOnly ¶
func (p NSPersistentStore) IsReadOnly() bool
A Boolean value that indicates whether the persistent store is read-only.
Discussion ¶
true if the receiver is read-only, otherwise false.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStore/isReadOnly
func (NSPersistentStore) LoadMetadata ¶
func (p NSPersistentStore) LoadMetadata() (bool, error)
Instructs the persistent store to load its metadata.
Discussion ¶
There is no way to return an error if the store is invalid.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStore/loadMetadata()
func (NSPersistentStore) Metadata ¶
func (p NSPersistentStore) Metadata() foundation.INSDictionary
The metadata for the persistent store.
Discussion ¶
The dictionary must include the store type (NSStoreTypeKey) and UUID (NSStoreUUIDKey).
Special Considerations ¶
Subclasses must override this property to provide storage and persistence for the store metadata.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStore/metadata
func (NSPersistentStore) Options ¶
func (p NSPersistentStore) Options() foundation.INSDictionary
The options that Core Data uses to create the store.
Discussion ¶
See NSPersistentStoreCoordinator for a list of key names for options in this dictionary.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStore/options
func (NSPersistentStore) PersistentStoreCoordinator ¶
func (p NSPersistentStore) PersistentStoreCoordinator() INSPersistentStoreCoordinator
The persistent store coordinator that loads the persistent store.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStore/persistentStoreCoordinator
func (NSPersistentStore) SetIdentifier ¶
func (p NSPersistentStore) SetIdentifier(value string)
func (NSPersistentStore) SetMetadata ¶
func (p NSPersistentStore) SetMetadata(value foundation.INSDictionary)
func (NSPersistentStore) SetReadOnly ¶
func (p NSPersistentStore) SetReadOnly(value bool)
func (NSPersistentStore) SetURL ¶
func (p NSPersistentStore) SetURL(value foundation.NSURL)
func (NSPersistentStore) Type ¶
func (p NSPersistentStore) Type() string
The type string of the persistent store.
Discussion ¶
This string is used when specifying the type of store to add to a persistent store coordinator.
Special Considerations ¶
Subclasses must override this method to provide a unique type.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStore/type
func (NSPersistentStore) URL ¶
func (p NSPersistentStore) URL() foundation.NSURL
The URL for the persistent store.
Discussion ¶
To alter the location of a store, send the persistent store coordinator a NSPersistentStoreCoordinator.SetURLForPersistentStore message.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStore/url
func (NSPersistentStore) WillRemoveFromPersistentStoreCoordinator ¶
func (p NSPersistentStore) WillRemoveFromPersistentStoreCoordinator(coordinator INSPersistentStoreCoordinator)
Invoked before the persistent store is removed from the persistent store coordinator.
coordinator: The persistent store coordinator from which the receiver was removed.
Discussion ¶
The default implementation does nothing. You can override this method in a subclass in order to perform any clean-up before the store is removed from the coordinator (and deallocated).
See: https://developer.apple.com/documentation/CoreData/NSPersistentStore/willRemove(from:)
type NSPersistentStoreAsynchronousFetchResultCompletionBlock ¶
type NSPersistentStoreAsynchronousFetchResultCompletionBlock = func(result NSAsynchronousFetchResult)
NSPersistentStoreAsynchronousFetchResultCompletionBlock is a completion block that an asynchronous fetch request calls with a result.
type NSPersistentStoreAsynchronousResult ¶
type NSPersistentStoreAsynchronousResult struct {
NSPersistentStoreResult
}
A concrete class used to represent the results of an asynchronous request.
Inspecting the Result ¶
- NSPersistentStoreAsynchronousResult.ManagedObjectContext: The managed object context for the result.
- NSPersistentStoreAsynchronousResult.OperationError: An error that contains details if the asynchronous fetch request fails.
- NSPersistentStoreAsynchronousResult.Progress: An object that reports progress for the asynchronous fetch request.
Canceling the Result ¶
- NSPersistentStoreAsynchronousResult.Cancel: Cancels the asynchronous fetch request.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreAsynchronousResult
func NSPersistentStoreAsynchronousResultFromID ¶
func NSPersistentStoreAsynchronousResultFromID(id objc.ID) NSPersistentStoreAsynchronousResult
NSPersistentStoreAsynchronousResultFromID constructs a NSPersistentStoreAsynchronousResult from an objc.ID.
A concrete class used to represent the results of an asynchronous request.
func NewNSPersistentStoreAsynchronousResult ¶
func NewNSPersistentStoreAsynchronousResult() NSPersistentStoreAsynchronousResult
NewNSPersistentStoreAsynchronousResult creates a new NSPersistentStoreAsynchronousResult instance.
func (NSPersistentStoreAsynchronousResult) Autorelease ¶
func (p NSPersistentStoreAsynchronousResult) Autorelease() NSPersistentStoreAsynchronousResult
Autorelease adds the receiver to the current autorelease pool.
func (NSPersistentStoreAsynchronousResult) Cancel ¶
func (p NSPersistentStoreAsynchronousResult) Cancel()
Cancels the asynchronous fetch request.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreAsynchronousResult/cancel()
func (NSPersistentStoreAsynchronousResult) ManagedObjectContext ¶
func (p NSPersistentStoreAsynchronousResult) ManagedObjectContext() INSManagedObjectContext
The managed object context for the result.
func (NSPersistentStoreAsynchronousResult) OperationError ¶
func (p NSPersistentStoreAsynchronousResult) OperationError() foundation.NSError
An error that contains details if the asynchronous fetch request fails.
func (NSPersistentStoreAsynchronousResult) Progress ¶
func (p NSPersistentStoreAsynchronousResult) Progress() foundation.Progress
An object that reports progress for the asynchronous fetch request.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreAsynchronousResult/progress
type NSPersistentStoreAsynchronousResultClass ¶
type NSPersistentStoreAsynchronousResultClass struct {
// contains filtered or unexported fields
}
func GetNSPersistentStoreAsynchronousResultClass ¶
func GetNSPersistentStoreAsynchronousResultClass() NSPersistentStoreAsynchronousResultClass
GetNSPersistentStoreAsynchronousResultClass returns the class object for NSPersistentStoreAsynchronousResult.
func (NSPersistentStoreAsynchronousResultClass) Alloc ¶
func (nc NSPersistentStoreAsynchronousResultClass) Alloc() NSPersistentStoreAsynchronousResult
Alloc allocates memory for a new instance of the class.
func (NSPersistentStoreAsynchronousResultClass) Class ¶
func (nc NSPersistentStoreAsynchronousResultClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSPersistentStoreClass ¶
type NSPersistentStoreClass struct {
// contains filtered or unexported fields
}
func GetNSPersistentStoreClass ¶
func GetNSPersistentStoreClass() NSPersistentStoreClass
GetNSPersistentStoreClass returns the class object for NSPersistentStore.
func (NSPersistentStoreClass) Alloc ¶
func (nc NSPersistentStoreClass) Alloc() NSPersistentStore
Alloc allocates memory for a new instance of the class.
func (NSPersistentStoreClass) Class ¶
func (nc NSPersistentStoreClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (NSPersistentStoreClass) MetadataForPersistentStoreWithURLError ¶
func (_NSPersistentStoreClass NSPersistentStoreClass) MetadataForPersistentStoreWithURLError(url foundation.NSURL) (foundation.INSDictionary, error)
Returns the metadata from the persistent store at the given URL.
url: The location of the store.
Return Value ¶
The metadata from the persistent store at `url`. Returns `nil` if there is an error.
Discussion ¶
Subclasses must override this method.
func (NSPersistentStoreClass) MigrationManagerClass ¶
func (_NSPersistentStoreClass NSPersistentStoreClass) MigrationManagerClass() objectivec.Class
Returns the migration manager class for this store class.
Return Value ¶
The NSMigrationManager class for this store class
Discussion ¶
In a subclass of NSPersistentStore, you can override this to provide a custom migration manager subclass (for example, to take advantage of store-specific functionality to improve migration performance).
See: https://developer.apple.com/documentation/CoreData/NSPersistentStore/migrationManagerClass()
func (NSPersistentStoreClass) SetMetadataForPersistentStoreWithURLError ¶
func (_NSPersistentStoreClass NSPersistentStoreClass) SetMetadataForPersistentStoreWithURLError(metadata foundation.INSDictionary, url foundation.NSURL) (bool, error)
Sets the metadata for the store at a given URL.
metadata: The metadata for the store at `url`.
url: The location of the store.
Discussion ¶
Subclasses must override this method to set metadata appropriately.
type NSPersistentStoreCoordinator ¶
type NSPersistentStoreCoordinator struct {
objectivec.Object
}
An object that enables an app’s contexts and the underlying persistent stores to work together.
Overview ¶
A managed object context uses a coordinator to facilitate the persistence of its entities in the coordinator’s registered stores. A context can’t function without a coordinator because it relies on the coordinator’s access to the managed object model. The coordinator presents its registered stores as an aggregate, allowing a context to operate on the union of those stores instead of on each individually. A coordinator performs its work on a private queue and executes that work serially. You can use multiple coordinators if the work requires separate queues.
Use a coordinator to add or remove persistent stores, change the type or location on-disk of those stores, query the metadata of a specific store, defer a store’s migrations, determine whether two objects originate from the same store, and so on.
Creating a persistent store coordinator ¶
- NSPersistentStoreCoordinator.InitWithManagedObjectModel: Creates a persistent store coordinator with the specified managed object model.
Managing configuration ¶
- NSPersistentStoreCoordinator.Name: The coordinator’s name.
- NSPersistentStoreCoordinator.SetName
- NSPersistentStoreCoordinator.ManagedObjectModel: The coordinator’s managed object model.
- NSPersistentStoreCoordinator.PersistentStores: The coordinator’s persistent stores.
Adding or removing a store ¶
- NSPersistentStoreCoordinator.AddPersistentStoreWithTypeConfigurationURLOptionsError: Adds a specific type of persistent store at the provided location.
- NSPersistentStoreCoordinator.AddPersistentStoreWithDescriptionCompletionHandler: Adds a persistent store using the provided description.
- NSPersistentStoreCoordinator.RemovePersistentStoreError: Removes the specified persistent store from the coordinator.
Modifying a store ¶
- NSPersistentStoreCoordinator.DestroyPersistentStoreAtURLWithTypeOptionsError: Deletes a specific type of persistent store at the provided location.
- NSPersistentStoreCoordinator.MigratePersistentStoreToURLOptionsWithTypeError: Changes the location and, if necessary, the store type of the specified persistent store.
- NSPersistentStoreCoordinator.ReplacePersistentStoreAtURLDestinationOptionsWithPersistentStoreFromURLSourceOptionsStoreTypeError: Replaces one persistent store with another.
Managing a store’s location ¶
- NSPersistentStoreCoordinator.SetURLForPersistentStore: Changes the location of the specified persistent store.
- NSPersistentStoreCoordinator.PersistentStoreForURL: Returns the persistent store for the specified file URL.
- NSPersistentStoreCoordinator.URLForPersistentStore: Returns the location of the provided persistent store.
Managing a store’s metadata ¶
- NSPersistentStoreCoordinator.MetadataForPersistentStore: Returns the metadata of the specified persistent store.
- NSPersistentStoreCoordinator.SetMetadataForPersistentStore: Updates the metadata for the specified persistent store.
Deferring a store’s migrations ¶
- NSPersistentStoreCoordinator.FinishDeferredLightweightMigrationTask: Executes a single pending task of a deferred lightweight migration.
- NSPersistentStoreCoordinator.FinishDeferredLightweightMigration: Executes all remaining tasks of a deferred lightweight migration.
Performing tasks ¶
- NSPersistentStoreCoordinator.PerformBlock: Executes the provided closure asynchronously on the coordinator’s queue.
- NSPersistentStoreCoordinator.PerformBlockAndWait: Executes the provided closure on the coordinator’s queue and waits for it to finish.
- NSPersistentStoreCoordinator.ExecuteRequestWithContextError: Executes the specified request on each of the coordinator’s persistent stores.
Maintaining a record of changes ¶
- NSPersistentStoreCoordinator.CurrentPersistentHistoryTokenFromStores: Returns a single persistent history token representing all of the specified stores.
Getting individual object identifiers ¶
- NSPersistentStoreCoordinator.ManagedObjectIDForURIRepresentation: Returns the object identifier for the specified URI representation.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreCoordinator
func NSPersistentStoreCoordinatorFromID ¶
func NSPersistentStoreCoordinatorFromID(id objc.ID) NSPersistentStoreCoordinator
NSPersistentStoreCoordinatorFromID constructs a NSPersistentStoreCoordinator from an objc.ID.
An object that enables an app’s contexts and the underlying persistent stores to work together.
func NewNSPersistentStoreCoordinator ¶
func NewNSPersistentStoreCoordinator() NSPersistentStoreCoordinator
NewNSPersistentStoreCoordinator creates a new NSPersistentStoreCoordinator instance.
func NewPersistentStoreCoordinatorWithManagedObjectModel ¶
func NewPersistentStoreCoordinatorWithManagedObjectModel(model INSManagedObjectModel) NSPersistentStoreCoordinator
Creates a persistent store coordinator with the specified managed object model.
model: A managed object model.
Return Value ¶
The receiver, initialized with `model`.
func (NSPersistentStoreCoordinator) AddPersistentStoreWithDescription ¶
func (p NSPersistentStoreCoordinator) AddPersistentStoreWithDescription(ctx context.Context, storeDescription INSPersistentStoreDescription) (*NSPersistentStoreDescription, error)
AddPersistentStoreWithDescription is a synchronous wrapper around NSPersistentStoreCoordinator.AddPersistentStoreWithDescriptionCompletionHandler. It blocks until the completion handler fires or the context is cancelled.
func (NSPersistentStoreCoordinator) AddPersistentStoreWithDescriptionCompletionHandler ¶
func (p NSPersistentStoreCoordinator) AddPersistentStoreWithDescriptionCompletionHandler(storeDescription INSPersistentStoreDescription, block PersistentStoreDescriptionErrorHandler)
Adds a persistent store using the provided description.
storeDescription: A description object used to create and load a persistent store.
block: The completion handler block that’s invoked after the store is added.
func (NSPersistentStoreCoordinator) AddPersistentStoreWithTypeConfigurationURLOptionsError ¶
func (p NSPersistentStoreCoordinator) AddPersistentStoreWithTypeConfigurationURLOptionsError(storeType string, configuration string, storeURL foundation.NSURL, options foundation.INSDictionary) (INSPersistentStore, error)
Adds a specific type of persistent store at the provided location.
storeType: A string constant (such as [NSSQLiteStoreType]) that specifies the store type—see Persistent Store Types for possible values.
configuration: The name of a configuration in the receiver’s managed object model that will be used by the new store. The configuration can be `nil`, in which case no other configurations are allowed.
storeURL: The file location of the persistent store.
options: A dictionary containing key-value pairs that specify whether the store should be read-only, and whether (for an XML store) the XML file should be validated against the DTD before it is read. For key definitions, see Store options and Migration options. This value may be `nil`.
Return Value ¶
The newly created store or, if an error occurs, `nil`.
func (NSPersistentStoreCoordinator) Autorelease ¶
func (p NSPersistentStoreCoordinator) Autorelease() NSPersistentStoreCoordinator
Autorelease adds the receiver to the current autorelease pool.
func (NSPersistentStoreCoordinator) CurrentPersistentHistoryTokenFromStores ¶
func (p NSPersistentStoreCoordinator) CurrentPersistentHistoryTokenFromStores(stores foundation.INSArray) INSPersistentHistoryToken
Returns a single persistent history token representing all of the specified stores.
stores: The persistent stores of interest.
Return Value ¶
A persistent history token, or `nil` if the coordinator can’t create one.
Discussion ¶
If you specify `nil` or provide an empty array, the coordinator attempts to create a token for all of its registered stores.
func (NSPersistentStoreCoordinator) DestroyPersistentStoreAtURLWithTypeOptionsError ¶
func (p NSPersistentStoreCoordinator) DestroyPersistentStoreAtURLWithTypeOptionsError(url foundation.NSURL, storeType string, options foundation.INSDictionary) (bool, error)
Deletes a specific type of persistent store at the provided location.
url: The store’s location.
storeType: The store type. For possible values, see NSPersistentStore.StoreType.
options: A dictionary containing key-value pairs that specify store behavior and characteristics. For more information, see Store options.
func (NSPersistentStoreCoordinator) ExecuteRequestWithContextError ¶
func (p NSPersistentStoreCoordinator) ExecuteRequestWithContextError(request INSPersistentStoreRequest, context INSManagedObjectContext) (objectivec.IObject, error)
Executes the specified request on each of the coordinator’s persistent stores.
request: A fetch or save request.
context: The context against which `request` should be executed.
Return Value ¶
An array containing managed objects, managed object IDs, or dictionaries as appropriate for a fetch request; an empty array if `request` is a save request, or `nil` if an error occurred.
Discussion ¶
User defined requests return arrays of arrays, where a nested array is the result returned from a single store.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreCoordinator/execute(_:with:)
func (NSPersistentStoreCoordinator) FinishDeferredLightweightMigration ¶
func (p NSPersistentStoreCoordinator) FinishDeferredLightweightMigration() (bool, error)
Executes all remaining tasks of a deferred lightweight migration.
Discussion ¶
func (NSPersistentStoreCoordinator) FinishDeferredLightweightMigrationTask ¶
func (p NSPersistentStoreCoordinator) FinishDeferredLightweightMigrationTask() (bool, error)
Executes a single pending task of a deferred lightweight migration.
Discussion ¶
func (NSPersistentStoreCoordinator) Init ¶
func (p NSPersistentStoreCoordinator) Init() NSPersistentStoreCoordinator
Init initializes the instance.
func (NSPersistentStoreCoordinator) InitWithManagedObjectModel ¶
func (p NSPersistentStoreCoordinator) InitWithManagedObjectModel(model INSManagedObjectModel) NSPersistentStoreCoordinator
Creates a persistent store coordinator with the specified managed object model.
model: A managed object model.
Return Value ¶
The receiver, initialized with `model`.
func (NSPersistentStoreCoordinator) ManagedObjectIDForURIRepresentation ¶
func (p NSPersistentStoreCoordinator) ManagedObjectIDForURIRepresentation(url foundation.NSURL) INSManagedObjectID
Returns the object identifier for the specified URI representation.
url: An URL object containing a URI that specify a managed object.
Return Value ¶
An object ID for the object specified by `url`.
Discussion ¶
The URI representation contains a UUID of the store the ID is coming from, and the coordinator can match it against the stores added to it.
func (NSPersistentStoreCoordinator) ManagedObjectModel ¶
func (p NSPersistentStoreCoordinator) ManagedObjectModel() INSManagedObjectModel
The coordinator’s managed object model.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreCoordinator/managedObjectModel
func (NSPersistentStoreCoordinator) MetadataForPersistentStore ¶
func (p NSPersistentStoreCoordinator) MetadataForPersistentStore(store INSPersistentStore) foundation.INSDictionary
Returns the metadata of the specified persistent store.
store: A persistent store.
Return Value ¶
A dictionary that contains the metadata currently stored or to-be-stored in `store`.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreCoordinator/metadata(for:)
func (NSPersistentStoreCoordinator) MigratePersistentStoreToURLOptionsWithTypeError ¶
func (p NSPersistentStoreCoordinator) MigratePersistentStoreToURLOptionsWithTypeError(store INSPersistentStore, URL foundation.NSURL, options foundation.INSDictionary, storeType string) (INSPersistentStore, error)
Changes the location and, if necessary, the store type of the specified persistent store.
store: A persistent store.
URL: An URL object that specifies the location for the new store.
options: A dictionary containing key-value pairs that specify whether the store should be read-only, and whether (for an XML store) the XML file should be validated against the DTD before it is read. For key definitions, see Store options.
storeType: A string constant (such as [NSSQLiteStoreType]) that specifies the type of the new store—see Persistent Store Types.
Return Value ¶
If the migration is successful, the new store, otherwise `nil`.
Discussion ¶
This method is typically used for “Save As” operations. Performance may vary depending on the type of old and new store. For more details of the action of this method, see Persistent Store Features in Core Data Programming Guide.
func (NSPersistentStoreCoordinator) Name ¶
func (p NSPersistentStoreCoordinator) Name() string
The coordinator’s name.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreCoordinator/name
func (NSPersistentStoreCoordinator) PerformBlock ¶
func (p NSPersistentStoreCoordinator) PerformBlock(block VoidHandler)
Executes the provided closure asynchronously on the coordinator’s queue.
block: The closure to execute.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreCoordinator/perform(_:)-7jqb
func (NSPersistentStoreCoordinator) PerformBlockAndWait ¶
func (p NSPersistentStoreCoordinator) PerformBlockAndWait(block VoidHandler)
Executes the provided closure on the coordinator’s queue and waits for it to finish.
block: The closure to execute.
func (NSPersistentStoreCoordinator) PerformBlockAndWaitSync ¶
func (p NSPersistentStoreCoordinator) PerformBlockAndWaitSync(ctx context.Context) error
PerformBlockAndWaitSync is a synchronous wrapper around NSPersistentStoreCoordinator.PerformBlockAndWait. It blocks until the completion handler fires or the context is cancelled.
func (NSPersistentStoreCoordinator) PerformBlockSync ¶
func (p NSPersistentStoreCoordinator) PerformBlockSync(ctx context.Context) error
PerformBlockSync is a synchronous wrapper around NSPersistentStoreCoordinator.PerformBlock. It blocks until the completion handler fires or the context is cancelled.
func (NSPersistentStoreCoordinator) PersistentStoreForURL ¶
func (p NSPersistentStoreCoordinator) PersistentStoreForURL(URL foundation.NSURL) INSPersistentStore
Returns the persistent store for the specified file URL.
URL: An URL object that specifies the location of a persistent store.
Return Value ¶
The persistent store at the location specified by [URL].
func (NSPersistentStoreCoordinator) PersistentStores ¶
func (p NSPersistentStoreCoordinator) PersistentStores() []NSPersistentStore
The coordinator’s persistent stores.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreCoordinator/persistentStores
func (NSPersistentStoreCoordinator) RemovePersistentStoreError ¶
func (p NSPersistentStoreCoordinator) RemovePersistentStoreError(store INSPersistentStore) (bool, error)
Removes the specified persistent store from the coordinator.
store: A persistent store.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreCoordinator/remove(_:)
func (NSPersistentStoreCoordinator) ReplacePersistentStoreAtURLDestinationOptionsWithPersistentStoreFromURLSourceOptionsStoreTypeError ¶
func (p NSPersistentStoreCoordinator) ReplacePersistentStoreAtURLDestinationOptionsWithPersistentStoreFromURLSourceOptionsStoreTypeError(destinationURL foundation.NSURL, destinationOptions foundation.INSDictionary, sourceURL foundation.NSURL, sourceOptions foundation.INSDictionary, storeType string) (bool, error)
Replaces one persistent store with another.
destinationURL: The location of the store to replace.
destinationOptions: A dictionary containing key-value pairs that specify the behavior and characteristics of the store to replace. For more information, see Store options.
sourceURL: The location of the store to use as the replacement.
sourceOptions: A dictionary containing key-value pairs that specify the behavior and characteristics of the replacement store. For more information, see Store options.
storeType: The store type of the replacement store. For possible values, see NSPersistentStore.StoreType.
func (NSPersistentStoreCoordinator) SetMetadataForPersistentStore ¶
func (p NSPersistentStoreCoordinator) SetMetadataForPersistentStore(metadata foundation.INSDictionary, store INSPersistentStore)
Updates the metadata for the specified persistent store.
metadata: A dictionary containing metadata for the store.
store: A persistent store.
Discussion ¶
The store type and UUID ([NSStoreTypeKey] and [NSStoreUUIDKey]) are always added automatically, however [NSStoreUUIDKey] is only added if it is not set manually as part of the dictionary argument.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreCoordinator/setMetadata(_:for:)
func (NSPersistentStoreCoordinator) SetName ¶
func (p NSPersistentStoreCoordinator) SetName(value string)
func (NSPersistentStoreCoordinator) SetURLForPersistentStore ¶
func (p NSPersistentStoreCoordinator) SetURLForPersistentStore(url foundation.NSURL, store INSPersistentStore) bool
Changes the location of the specified persistent store.
url: The new location for `store`.
store: A persistent store associated with the receiver.
Return Value ¶
true if the store was relocated, otherwise false.
Discussion ¶
For atomic stores, this method alters the location to which the next save operation will write the file; for non-atomic stores, invoking this method will relinquish the existing connection and create a new one at the specified URL. (For non-atomic stores, a store must already exist at the destination URL; a new store will not be created.)
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreCoordinator/setURL(_:for:)
func (NSPersistentStoreCoordinator) URLForPersistentStore ¶
func (p NSPersistentStoreCoordinator) URLForPersistentStore(store INSPersistentStore) foundation.NSURL
Returns the location of the provided persistent store.
store: A persistent store.
Return Value ¶
The URL for `store`.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreCoordinator/url(for:)
type NSPersistentStoreCoordinatorClass ¶
type NSPersistentStoreCoordinatorClass struct {
// contains filtered or unexported fields
}
func GetNSPersistentStoreCoordinatorClass ¶
func GetNSPersistentStoreCoordinatorClass() NSPersistentStoreCoordinatorClass
GetNSPersistentStoreCoordinatorClass returns the class object for NSPersistentStoreCoordinator.
func (NSPersistentStoreCoordinatorClass) Alloc ¶
func (nc NSPersistentStoreCoordinatorClass) Alloc() NSPersistentStoreCoordinator
Alloc allocates memory for a new instance of the class.
func (NSPersistentStoreCoordinatorClass) CachedModelForPersistentStoreAtURLOptionsError ¶
func (_NSPersistentStoreCoordinatorClass NSPersistentStoreCoordinatorClass) CachedModelForPersistentStoreAtURLOptionsError(url foundation.NSURL, options foundation.INSDictionary) (NSManagedObjectModel, error)
func (NSPersistentStoreCoordinatorClass) Class ¶
func (nc NSPersistentStoreCoordinatorClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (NSPersistentStoreCoordinatorClass) MetadataForPersistentStoreOfTypeURLOptionsError ¶
func (_NSPersistentStoreCoordinatorClass NSPersistentStoreCoordinatorClass) MetadataForPersistentStoreOfTypeURLOptionsError(storeType string, url foundation.NSURL, options foundation.INSDictionary) (foundation.INSDictionary, error)
Returns the metadata of a specific type of persistent store at the provided location.
storeType: The type of the store. If `nil`, Core Data automatically attempts to determine the store class to use.
url: The file URL of the store.
options: A dictionary that contains options for the store.
Return Value ¶
A dictionary that contains, at a minimum, values for the NSStoreTypeKey and NSStoreUUIDKey keys.
func (NSPersistentStoreCoordinatorClass) RegisterStoreClassForStoreType ¶
func (_NSPersistentStoreCoordinatorClass NSPersistentStoreCoordinatorClass) RegisterStoreClassForStoreType(storeClass objectivec.Class, storeType string)
Registers a persistent store subclass using the specified store type identifier.
storeClass: The NSPersistentStore subclass to use for the store of type `storeType`.
storeType: A unique string that identifies a store type.
Discussion ¶
You must invoke this method before a custom subclass of NSPersistentStore can be loaded into a persistent store coordinator.
You can pass `nil` for `storeClass` to unregister the store type.
func (NSPersistentStoreCoordinatorClass) RegisteredStoreTypes ¶
func (_NSPersistentStoreCoordinatorClass NSPersistentStoreCoordinatorClass) RegisteredStoreTypes() foundation.INSDictionary
The coordinator’s registered store types.
Return Value ¶
A dictionary of the registered store types—the keys are the store type strings, and the values are the NSPersistentStore subclasses.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreCoordinator/registeredStoreTypes
func (NSPersistentStoreCoordinatorClass) SetMetadataForPersistentStoreOfTypeURLOptionsError ¶
func (_NSPersistentStoreCoordinatorClass NSPersistentStoreCoordinatorClass) SetMetadataForPersistentStoreOfTypeURLOptionsError(metadata foundation.INSDictionary, storeType string, url foundation.NSURL, options foundation.INSDictionary) (bool, error)
Updates the metadata of a specific type of persistent store at the provided location.
metadata: A dictionary that contains the metadata to store.
storeType: The type of store. If `nil`, Core Data automatically attempts to determine the store class to use.
url: The file URL of the store.
options: A dictionary that contains options for the store.
type NSPersistentStoreDescription ¶
type NSPersistentStoreDescription struct {
objectivec.Object
}
A description object used to create and load a persistent store.
Creating a Persistent Store Description ¶
- NSPersistentStoreDescription.InitWithURL: Initializes the receiver with a URL for the store.
Configuring a Persistent Store Description ¶
- NSPersistentStoreDescription.URL: The URL that the store will use for its location.
- NSPersistentStoreDescription.SetURL
- NSPersistentStoreDescription.Configuration: The name of the configuration used by this store.
- NSPersistentStoreDescription.SetConfiguration
- NSPersistentStoreDescription.Timeout: The connection timeout for the associated store.
- NSPersistentStoreDescription.SetTimeout
- NSPersistentStoreDescription.Type: The type of store this description represents.
- NSPersistentStoreDescription.SetType
- NSPersistentStoreDescription.IsReadOnly: A flag that indicates whether this store will be read-only.
- NSPersistentStoreDescription.SetReadOnly
- NSPersistentStoreDescription.ShouldAddStoreAsynchronously: A flag that determines whether the store is added asynchronously.
- NSPersistentStoreDescription.SetShouldAddStoreAsynchronously
- NSPersistentStoreDescription.ShouldInferMappingModelAutomatically: A flag indicating whether a mapping model should be created automatically.
- NSPersistentStoreDescription.SetShouldInferMappingModelAutomatically
- NSPersistentStoreDescription.ShouldMigrateStoreAutomatically: A flag indicating whether the associated persistent store should be migrated automatically.
- NSPersistentStoreDescription.SetShouldMigrateStoreAutomatically
- NSPersistentStoreDescription.SetOptionForKey: Sets an option on the store.
- NSPersistentStoreDescription.SetValueForPragmaNamed: Allows you to set pragmas for the SQLite store.
Accessing the Configuration Options ¶
- NSPersistentStoreDescription.Options: A dictionary representation of the options set on the associated persistent store.
- NSPersistentStoreDescription.SqlitePragmas: The SQLite pragmas set for the associated persistent store. (read-only)
Syncing to CloudKit ¶
- NSPersistentStoreDescription.CloudKitContainerOptions: Options that customize how this store description aligns with a CloudKit database.
- NSPersistentStoreDescription.SetCloudKitContainerOptions
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreDescription
func NSPersistentStoreDescriptionFromID ¶
func NSPersistentStoreDescriptionFromID(id objc.ID) NSPersistentStoreDescription
NSPersistentStoreDescriptionFromID constructs a NSPersistentStoreDescription from an objc.ID.
A description object used to create and load a persistent store.
func NewNSPersistentStoreDescription ¶
func NewNSPersistentStoreDescription() NSPersistentStoreDescription
NewNSPersistentStoreDescription creates a new NSPersistentStoreDescription instance.
func NewPersistentStoreDescriptionWithURL ¶
func NewPersistentStoreDescriptionWithURL(url foundation.NSURL) NSPersistentStoreDescription
Initializes the receiver with a URL for the store.
url: Location for the store.
Return Value ¶
Initialized NSPersistentStoreDescription configured with the given URL.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreDescription/init(url:)
func (NSPersistentStoreDescription) Autorelease ¶
func (p NSPersistentStoreDescription) Autorelease() NSPersistentStoreDescription
Autorelease adds the receiver to the current autorelease pool.
func (NSPersistentStoreDescription) CloudKitContainerOptions ¶
func (p NSPersistentStoreDescription) CloudKitContainerOptions() INSPersistentCloudKitContainerOptions
Options that customize how this store description aligns with a CloudKit database.
func (NSPersistentStoreDescription) Configuration ¶
func (p NSPersistentStoreDescription) Configuration() string
The name of the configuration used by this store.
Discussion ¶
This displays the name of a configuration in the receiver’s managed object model that will be used by the new store. The configuration can be `nil`, in which case no other configurations are allowed.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreDescription/configuration
func (NSPersistentStoreDescription) Init ¶
func (p NSPersistentStoreDescription) Init() NSPersistentStoreDescription
Init initializes the instance.
func (NSPersistentStoreDescription) InitWithURL ¶
func (p NSPersistentStoreDescription) InitWithURL(url foundation.NSURL) NSPersistentStoreDescription
Initializes the receiver with a URL for the store.
url: Location for the store.
Return Value ¶
Initialized NSPersistentStoreDescription configured with the given URL.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreDescription/init(url:)
func (NSPersistentStoreDescription) IsReadOnly ¶
func (p NSPersistentStoreDescription) IsReadOnly() bool
A flag that indicates whether this store will be read-only.
Discussion ¶
This is a convenience method for setting the NSReadOnlyPersistentStoreOption on the associated store.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreDescription/isReadOnly
func (NSPersistentStoreDescription) Options ¶
func (p NSPersistentStoreDescription) Options() foundation.INSDictionary
A dictionary representation of the options set on the associated persistent store.
Discussion ¶
A dictionary containing key-value pairs that specify numerous settings for the persistent store. For key definitions, see NSPersistentStoreCoordinator.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreDescription/options
func (NSPersistentStoreDescription) SetCloudKitContainerOptions ¶
func (p NSPersistentStoreDescription) SetCloudKitContainerOptions(value INSPersistentCloudKitContainerOptions)
func (NSPersistentStoreDescription) SetConfiguration ¶
func (p NSPersistentStoreDescription) SetConfiguration(value string)
func (NSPersistentStoreDescription) SetOptionForKey ¶
func (p NSPersistentStoreDescription) SetOptionForKey(option objectivec.NSObject, key string)
Sets an option on the store.
option: The value to be set for an option on the store.
key: The key of the value to be set for an option on the store.
Discussion ¶
If a value was previously set for the given option, that value is replaced with the given value. Note that the keys are case-sensitive. For a list of the available options, see NSPersistentStoreCoordinator.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreDescription/setOption(_:forKey:)
func (NSPersistentStoreDescription) SetReadOnly ¶
func (p NSPersistentStoreDescription) SetReadOnly(value bool)
func (NSPersistentStoreDescription) SetShouldAddStoreAsynchronously ¶
func (p NSPersistentStoreDescription) SetShouldAddStoreAsynchronously(value bool)
func (NSPersistentStoreDescription) SetShouldInferMappingModelAutomatically ¶
func (p NSPersistentStoreDescription) SetShouldInferMappingModelAutomatically(value bool)
func (NSPersistentStoreDescription) SetShouldMigrateStoreAutomatically ¶
func (p NSPersistentStoreDescription) SetShouldMigrateStoreAutomatically(value bool)
func (NSPersistentStoreDescription) SetTimeout ¶
func (p NSPersistentStoreDescription) SetTimeout(value foundation.NSTimeInterval)
func (NSPersistentStoreDescription) SetType ¶
func (p NSPersistentStoreDescription) SetType(value string)
func (NSPersistentStoreDescription) SetURL ¶
func (p NSPersistentStoreDescription) SetURL(value foundation.NSURL)
func (NSPersistentStoreDescription) SetValueForPragmaNamed ¶
func (p NSPersistentStoreDescription) SetValueForPragmaNamed(value objectivec.NSObject, name string)
Allows you to set pragmas for the SQLite store.
value: The value of the pragma to be set.
name: The name of the pragma to be set.
Discussion ¶
Pragma options are for SQLite stores only. All pragma values must be specified as NSStringobjects. The `fullfsync` and `synchronous` pragmas control the tradeoff between write performance (write to disk speed and cache utilization) and durability (data loss/corruption sensitivity to power interruption). For more information on pragma settings, see http://sqlite.org/pragma.html.
func (NSPersistentStoreDescription) ShouldAddStoreAsynchronously ¶
func (p NSPersistentStoreDescription) ShouldAddStoreAsynchronously() bool
A flag that determines whether the store is added asynchronously.
Discussion ¶
By default, the store is added to the NSPersistentStoreCoordinator synchronously on the calling thread. If this flag is set to true, the store is added asynchronously on a background queue. The default for this flag is false.
func (NSPersistentStoreDescription) ShouldInferMappingModelAutomatically ¶
func (p NSPersistentStoreDescription) ShouldInferMappingModelAutomatically() bool
A flag indicating whether a mapping model should be created automatically.
Discussion ¶
If this flag is set to true and the value of the NSPersistentStoreDescription.ShouldMigrateStoreAutomatically is true, the coordinator attempts to infer a mapping model if none can be found. The default for this flag is true.
func (NSPersistentStoreDescription) ShouldMigrateStoreAutomatically ¶
func (p NSPersistentStoreDescription) ShouldMigrateStoreAutomatically() bool
A flag indicating whether the associated persistent store should be migrated automatically.
Discussion ¶
If this is set to false and the store is out of sync, attempting to load the store produces an error. If this is set to true and the store is out of sync, attempting to load the store causes Core Data to attempt a migration. This flag is set to true by default.
func (NSPersistentStoreDescription) SqlitePragmas ¶
func (p NSPersistentStoreDescription) SqlitePragmas() foundation.INSDictionary
The SQLite pragmas set for the associated persistent store. (read-only)
Discussion ¶
This property contains all of the pragmas set on the associated persistent store. This property is only relevant when the NSPersistentStoreDescription.Type is set to NSSQLiteStoreType.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreDescription/sqlitePragmas
func (NSPersistentStoreDescription) Timeout ¶
func (p NSPersistentStoreDescription) Timeout() foundation.NSTimeInterval
The connection timeout for the associated store.
Discussion ¶
This is a convenience method for setting the NSPersistentStoreTimeoutOption on the associated store.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreDescription/timeout
func (NSPersistentStoreDescription) Type ¶
func (p NSPersistentStoreDescription) Type() string
The type of store this description represents.
Discussion ¶
A string constant (such as [NSSQLiteStoreType]) that specifies the type of the new store—see NSPersistentStoreCoordinator.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreDescription/type
func (NSPersistentStoreDescription) URL ¶
func (p NSPersistentStoreDescription) URL() foundation.NSURL
The URL that the store will use for its location.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreDescription/url
type NSPersistentStoreDescriptionClass ¶
type NSPersistentStoreDescriptionClass struct {
// contains filtered or unexported fields
}
func GetNSPersistentStoreDescriptionClass ¶
func GetNSPersistentStoreDescriptionClass() NSPersistentStoreDescriptionClass
GetNSPersistentStoreDescriptionClass returns the class object for NSPersistentStoreDescription.
func (NSPersistentStoreDescriptionClass) Alloc ¶
func (nc NSPersistentStoreDescriptionClass) Alloc() NSPersistentStoreDescription
Alloc allocates memory for a new instance of the class.
func (NSPersistentStoreDescriptionClass) Class ¶
func (nc NSPersistentStoreDescriptionClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSPersistentStoreRequest ¶
type NSPersistentStoreRequest struct {
objectivec.Object
}
Criteria used to retrieve data from or save data to a persistent store.
Configuring a Request ¶
- NSPersistentStoreRequest.AffectedStores: The stores the request should be sent to.
- NSPersistentStoreRequest.SetAffectedStores
- NSPersistentStoreRequest.RequestType: The type of the fetch request.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreRequest
func NSPersistentStoreRequestFromID ¶
func NSPersistentStoreRequestFromID(id objc.ID) NSPersistentStoreRequest
NSPersistentStoreRequestFromID constructs a NSPersistentStoreRequest from an objc.ID.
Criteria used to retrieve data from or save data to a persistent store.
func NewNSPersistentStoreRequest ¶
func NewNSPersistentStoreRequest() NSPersistentStoreRequest
NewNSPersistentStoreRequest creates a new NSPersistentStoreRequest instance.
func (NSPersistentStoreRequest) AffectedStores ¶
func (p NSPersistentStoreRequest) AffectedStores() []NSPersistentStore
The stores the request should be sent to.
Discussion ¶
The array contains instances of NSPersistentStore.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreRequest/affectedStores
func (NSPersistentStoreRequest) Autorelease ¶
func (p NSPersistentStoreRequest) Autorelease() NSPersistentStoreRequest
Autorelease adds the receiver to the current autorelease pool.
func (NSPersistentStoreRequest) Init ¶
func (p NSPersistentStoreRequest) Init() NSPersistentStoreRequest
Init initializes the instance.
func (NSPersistentStoreRequest) RequestType ¶
func (p NSPersistentStoreRequest) RequestType() NSPersistentStoreRequestType
The type of the fetch request.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreRequest/requestType
func (NSPersistentStoreRequest) SetAffectedStores ¶
func (p NSPersistentStoreRequest) SetAffectedStores(value []NSPersistentStore)
type NSPersistentStoreRequestClass ¶
type NSPersistentStoreRequestClass struct {
// contains filtered or unexported fields
}
func GetNSPersistentStoreRequestClass ¶
func GetNSPersistentStoreRequestClass() NSPersistentStoreRequestClass
GetNSPersistentStoreRequestClass returns the class object for NSPersistentStoreRequest.
func (NSPersistentStoreRequestClass) Alloc ¶
func (nc NSPersistentStoreRequestClass) Alloc() NSPersistentStoreRequest
Alloc allocates memory for a new instance of the class.
func (NSPersistentStoreRequestClass) Class ¶
func (nc NSPersistentStoreRequestClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSPersistentStoreRequestType ¶
type NSPersistentStoreRequestType uint
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreRequestType
const ( // NSBatchDeleteRequestType: A request that deletes data for multiple managed objects from a persistent store. NSBatchDeleteRequestType NSPersistentStoreRequestType = 7 // NSBatchInsertRequestType: A request that inserts data into a persistent store using a batch of managed objects or dictionaries. NSBatchInsertRequestType NSPersistentStoreRequestType = 5 // NSBatchUpdateRequestType: A request that updates data for multiple managed objects in a persistent store. NSBatchUpdateRequestType NSPersistentStoreRequestType = 6 // NSFetchRequestType: Specifies that the request returns managed objects. NSFetchRequestType NSPersistentStoreRequestType = 1 // NSSaveRequestType: Specifies that the request saves managed objects. NSSaveRequestType NSPersistentStoreRequestType = 2 )
func (NSPersistentStoreRequestType) String ¶
func (e NSPersistentStoreRequestType) String() string
type NSPersistentStoreResult ¶
type NSPersistentStoreResult struct {
objectivec.Object
}
The abstract base class for results returned from a persistent store coordinator.
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreResult
func NSPersistentStoreResultFromID ¶
func NSPersistentStoreResultFromID(id objc.ID) NSPersistentStoreResult
NSPersistentStoreResultFromID constructs a NSPersistentStoreResult from an objc.ID.
The abstract base class for results returned from a persistent store coordinator.
func NewNSPersistentStoreResult ¶
func NewNSPersistentStoreResult() NSPersistentStoreResult
NewNSPersistentStoreResult creates a new NSPersistentStoreResult instance.
func (NSPersistentStoreResult) Autorelease ¶
func (p NSPersistentStoreResult) Autorelease() NSPersistentStoreResult
Autorelease adds the receiver to the current autorelease pool.
func (NSPersistentStoreResult) Init ¶
func (p NSPersistentStoreResult) Init() NSPersistentStoreResult
Init initializes the instance.
type NSPersistentStoreResultClass ¶
type NSPersistentStoreResultClass struct {
// contains filtered or unexported fields
}
func GetNSPersistentStoreResultClass ¶
func GetNSPersistentStoreResultClass() NSPersistentStoreResultClass
GetNSPersistentStoreResultClass returns the class object for NSPersistentStoreResult.
func (NSPersistentStoreResultClass) Alloc ¶
func (nc NSPersistentStoreResultClass) Alloc() NSPersistentStoreResult
Alloc allocates memory for a new instance of the class.
func (NSPersistentStoreResultClass) Class ¶
func (nc NSPersistentStoreResultClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSPersistentStoreUbiquitousTransitionType ¶
type NSPersistentStoreUbiquitousTransitionType uint
See: https://developer.apple.com/documentation/CoreData/NSPersistentStoreUbiquitousTransitionType
const ( // NSPersistentStoreUbiquitousTransitionTypeAccountAdded: This value indicates that a new iCloud account is available, and the persistent store in use will or did transition to the new account. NSPersistentStoreUbiquitousTransitionTypeAccountAdded NSPersistentStoreUbiquitousTransitionType = 1 // NSPersistentStoreUbiquitousTransitionTypeAccountRemoved: This value indicates that no iCloud account is available, and the persistent store in use will or did transition to the “local” store. NSPersistentStoreUbiquitousTransitionTypeAccountRemoved NSPersistentStoreUbiquitousTransitionType = 2 // NSPersistentStoreUbiquitousTransitionTypeContentRemoved: This value indicates that the user has wiped the contents of the iCloud account, usually using Delete All from Documents & Data in Settings. NSPersistentStoreUbiquitousTransitionTypeContentRemoved NSPersistentStoreUbiquitousTransitionType = 3 // NSPersistentStoreUbiquitousTransitionTypeInitialImportCompleted: This value indicates that the Core Data integration has finished building a store file that is consistent with the contents of the iCloud account, and is ready to replace the fallback store with that file. NSPersistentStoreUbiquitousTransitionTypeInitialImportCompleted NSPersistentStoreUbiquitousTransitionType = 4 )
func (NSPersistentStoreUbiquitousTransitionType) String ¶
func (e NSPersistentStoreUbiquitousTransitionType) String() string
type NSPropertyDescription ¶
type NSPropertyDescription struct {
objectivec.Object
}
A description of a single property belonging to an entity.
Overview ¶
A property describes a single value within an object managed by the Core Data Framework. There are different types of property, each represented by a subclass which encapsulates the specific property behavior—see NSAttributeDescription, NSRelationshipDescription, and NSFetchedPropertyDescription.
Note that a property name cannot be the same as any no-parameter method name of [NSObject] or NSManagedObject. For example, you cannot give a property the name “description”. There are hundreds of methods on [NSObject] which may conflict with property names—and this list can grow without warning from frameworks or other libraries. You should avoid very general words (like “font”, and “color”) and words or phrases which overlap with Cocoa paradigms (such as “isEditing” and “objectSpecifier”).
Properties—relationships as well as attributes—may be transient. A managed object context knows about transient properties and tracks changes made to them. Transient properties are ignored by the persistent store, and not just during saves: you cannot fetch using a predicate based on transients (although you can use transient properties to filter in memory yourself).
Editing Property Descriptions ¶
Property descriptions are editable until they are used by an object graph manager (such as a persistent store coordinator). This allows you to create or modify them dynamically. However, once a description is used (when the managed object model to which it belongs is associated with a persistent store coordinator), it must not (indeed cannot) be changed. This is enforced at runtime: any attempt to mutate a model or any of its sub-objects after the model is associated with a persistent store coordinator causes an exception to be thrown. If you need to modify a model that is in use, create a copy, modify the copy, and then discard the objects with the old model.
Accessing Features of a Property ¶
- NSPropertyDescription.Entity: The entity description of the receiver.
- NSPropertyDescription.IsOptional: A Boolean value that indicates whether the receiver is optional.
- NSPropertyDescription.SetOptional
- NSPropertyDescription.IsTransient: A Boolean value that indicates whether the receiver is transient.
- NSPropertyDescription.SetTransient
- NSPropertyDescription.Name: The name of the receiver.
- NSPropertyDescription.SetName
- NSPropertyDescription.UserInfo: The user info dictionary of the receiver.
- NSPropertyDescription.SetUserInfo
Supporting Validation ¶
- NSPropertyDescription.ValidationPredicates: The validation predicates of the receiver.
- NSPropertyDescription.ValidationWarnings: The error strings associated with the receiver’s validation predicates.
- NSPropertyDescription.SetValidationPredicatesWithValidationWarnings: Sets the validation predicates and warnings of the receiver.
Supporting Versioning ¶
- NSPropertyDescription.VersionHash: The version hash for the receiver.
- NSPropertyDescription.VersionHashModifier: The version hash modifier for the receiver.
- NSPropertyDescription.SetVersionHashModifier
- NSPropertyDescription.RenamingIdentifier: The renaming identifier for the receiver.
- NSPropertyDescription.SetRenamingIdentifier
Specifying Spotlight Support ¶
- NSPropertyDescription.IsIndexedBySpotlight: A Boolean value that indicates whether Core Data adds the property’s value to the Core Spotlight index.
- NSPropertyDescription.SetIndexedBySpotlight
See: https://developer.apple.com/documentation/CoreData/NSPropertyDescription
func NSPropertyDescriptionFromID ¶
func NSPropertyDescriptionFromID(id objc.ID) NSPropertyDescription
NSPropertyDescriptionFromID constructs a NSPropertyDescription from an objc.ID.
A description of a single property belonging to an entity.
func NewNSPropertyDescription ¶
func NewNSPropertyDescription() NSPropertyDescription
NewNSPropertyDescription creates a new NSPropertyDescription instance.
func (NSPropertyDescription) Autorelease ¶
func (p NSPropertyDescription) Autorelease() NSPropertyDescription
Autorelease adds the receiver to the current autorelease pool.
func (NSPropertyDescription) EncodeWithCoder ¶
func (p NSPropertyDescription) EncodeWithCoder(coder foundation.INSCoder)
func (NSPropertyDescription) Entity ¶
func (p NSPropertyDescription) Entity() INSEntityDescription
The entity description of the receiver.
See: https://developer.apple.com/documentation/CoreData/NSPropertyDescription/entity
func (NSPropertyDescription) Init ¶
func (p NSPropertyDescription) Init() NSPropertyDescription
Init initializes the instance.
func (NSPropertyDescription) IsIndexedBySpotlight ¶
func (p NSPropertyDescription) IsIndexedBySpotlight() bool
A Boolean value that indicates whether Core Data adds the property’s value to the Core Spotlight index.
Discussion ¶
You can also set this property using the Index in Spotlight attribute in the Attributes inspector of the Core Data model editor.
See: https://developer.apple.com/documentation/CoreData/NSPropertyDescription/isIndexedBySpotlight
func (NSPropertyDescription) IsOptional ¶
func (p NSPropertyDescription) IsOptional() bool
A Boolean value that indicates whether the receiver is optional.
Discussion ¶
true if the receiver is optional, otherwise false. The optionality flag specifies whether a property’s value can be `nil` before an object can be saved to a persistent store.
Special Considerations ¶
Setting this property raises an exception if the receiver’s model has been used by an object graph manager.
See: https://developer.apple.com/documentation/CoreData/NSPropertyDescription/isOptional
func (NSPropertyDescription) IsTransient ¶
func (p NSPropertyDescription) IsTransient() bool
A Boolean value that indicates whether the receiver is transient.
Discussion ¶
true if the receiver is transient, otherwise false. The transient flag specifies whether or not a property’s value is ignored when an object is saved to a persistent store. Transient properties are not saved to the persistent store, but are still managed for undo, redo, validation, and so on.
Special Considerations ¶
Setting this property raises an exception if the receiver’s model has been used by an object graph manager.
See: https://developer.apple.com/documentation/CoreData/NSPropertyDescription/isTransient
func (NSPropertyDescription) Name ¶
func (p NSPropertyDescription) Name() string
The name of the receiver.
Discussion ¶
A property name cannot be the same as any no-parameter method name of [NSObject] or NSManagedObject. Since there are hundreds of methods on [NSObject] which may conflict with property names, you should avoid very general words (like “font”, and “color”) and words or phrases that overlap with Cocoa paradigms (such as “isEditing” and “objectSpecifier”).
Special Considerations ¶
Setting the name raises an exception if the receiver’s model has been used by an object graph manager.
See: https://developer.apple.com/documentation/CoreData/NSPropertyDescription/name
func (NSPropertyDescription) RenamingIdentifier ¶
func (p NSPropertyDescription) RenamingIdentifier() string
The renaming identifier for the receiver.
Discussion ¶
This is used to resolve naming conflicts between models. When creating an entity mapping between entities in two managed object models, a source entity property and a destination entity property that share the same identifier indicate that a property mapping should be configured to migrate from the source to the destination. If unset, the identifier will return the property’s name.
See: https://developer.apple.com/documentation/CoreData/NSPropertyDescription/renamingIdentifier
func (NSPropertyDescription) SetIndexedBySpotlight ¶
func (p NSPropertyDescription) SetIndexedBySpotlight(value bool)
func (NSPropertyDescription) SetName ¶
func (p NSPropertyDescription) SetName(value string)
func (NSPropertyDescription) SetOptional ¶
func (p NSPropertyDescription) SetOptional(value bool)
func (NSPropertyDescription) SetRenamingIdentifier ¶
func (p NSPropertyDescription) SetRenamingIdentifier(value string)
func (NSPropertyDescription) SetTransient ¶
func (p NSPropertyDescription) SetTransient(value bool)
func (NSPropertyDescription) SetUserInfo ¶
func (p NSPropertyDescription) SetUserInfo(value foundation.INSDictionary)
func (NSPropertyDescription) SetValidationPredicatesWithValidationWarnings ¶
func (p NSPropertyDescription) SetValidationPredicatesWithValidationWarnings(validationPredicates []foundation.NSPredicate, validationWarnings []string)
Sets the validation predicates and warnings of the receiver.
validationPredicates: An array containing the validation predicates for the receiver.
validationWarnings: An array containing the validation warnings for the receiver.
Discussion ¶
The `validationPredicates` and `validationWarnings` arrays should contain the same number of elements, and corresponding elements should appear at the same index in each array.
Instead of implementing individual validation methods, you can use this method to provide a list of predicates that are evaluated against the managed objects and a list of corresponding error messages (which can be localized).
Special Considerations ¶
This method raises an exception if the receiver’s model has been used by an object graph manager.
func (NSPropertyDescription) SetVersionHashModifier ¶
func (p NSPropertyDescription) SetVersionHashModifier(value string)
func (NSPropertyDescription) UserInfo ¶
func (p NSPropertyDescription) UserInfo() foundation.INSDictionary
The user info dictionary of the receiver.
Discussion ¶
Setting the user info raises an exception if the receiver’s model has been used by an object graph manager.
See: https://developer.apple.com/documentation/CoreData/NSPropertyDescription/userInfo
func (NSPropertyDescription) ValidationPredicates ¶
func (p NSPropertyDescription) ValidationPredicates() []foundation.NSPredicate
The validation predicates of the receiver.
See: https://developer.apple.com/documentation/CoreData/NSPropertyDescription/validationPredicates
func (NSPropertyDescription) ValidationWarnings ¶
func (p NSPropertyDescription) ValidationWarnings() foundation.INSArray
The error strings associated with the receiver’s validation predicates.
See: https://developer.apple.com/documentation/CoreData/NSPropertyDescription/validationWarnings
func (NSPropertyDescription) VersionHash ¶
func (p NSPropertyDescription) VersionHash() foundation.NSData
The version hash for the receiver.
Discussion ¶
The version hash is used to uniquely identify a property based on its configuration. The version hash uses only values which affect the persistence of data and the user-defined NSPropertyDescription.VersionHashModifier value. (The values which affect persistence are the name of the property, and the flags for `isOptional`, `isTransient`, and `isReadOnly`.) This value is stored as part of the version information in the metadata for stores, as well as a definition of a property involved in an NSPropertyMapping object.
See: https://developer.apple.com/documentation/CoreData/NSPropertyDescription/versionHash
func (NSPropertyDescription) VersionHashModifier ¶
func (p NSPropertyDescription) VersionHashModifier() string
The version hash modifier for the receiver.
Discussion ¶
This value is included in the version hash for the property. You use it to mark or denote a property as being a different “version” than another even if all of the values which affect persistence are equal. (Such a difference is important in cases where the attributes of a property are unchanged but the format or content of its data are changed.)
See: https://developer.apple.com/documentation/CoreData/NSPropertyDescription/versionHashModifier
type NSPropertyDescriptionClass ¶
type NSPropertyDescriptionClass struct {
// contains filtered or unexported fields
}
func GetNSPropertyDescriptionClass ¶
func GetNSPropertyDescriptionClass() NSPropertyDescriptionClass
GetNSPropertyDescriptionClass returns the class object for NSPropertyDescription.
func (NSPropertyDescriptionClass) Alloc ¶
func (nc NSPropertyDescriptionClass) Alloc() NSPropertyDescription
Alloc allocates memory for a new instance of the class.
func (NSPropertyDescriptionClass) Class ¶
func (nc NSPropertyDescriptionClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSPropertyMapping ¶
type NSPropertyMapping struct {
objectivec.Object
}
A mapping instance that specifies in a model how to map from a property in a source entity to a property in a destination entity.
Managing Mapping Attributes ¶
- NSPropertyMapping.Name: The name of the property in the destination entity for the property mapping.
- NSPropertyMapping.SetName
- NSPropertyMapping.ValueExpression: The value expression for the property mapping.
- NSPropertyMapping.SetValueExpression
- NSPropertyMapping.UserInfo: The user info for the property mapping.
- NSPropertyMapping.SetUserInfo
See: https://developer.apple.com/documentation/CoreData/NSPropertyMapping
func NSPropertyMappingFromID ¶
func NSPropertyMappingFromID(id objc.ID) NSPropertyMapping
NSPropertyMappingFromID constructs a NSPropertyMapping from an objc.ID.
A mapping instance that specifies in a model how to map from a property in a source entity to a property in a destination entity.
func NewNSPropertyMapping ¶
func NewNSPropertyMapping() NSPropertyMapping
NewNSPropertyMapping creates a new NSPropertyMapping instance.
func (NSPropertyMapping) Autorelease ¶
func (p NSPropertyMapping) Autorelease() NSPropertyMapping
Autorelease adds the receiver to the current autorelease pool.
func (NSPropertyMapping) Init ¶
func (p NSPropertyMapping) Init() NSPropertyMapping
Init initializes the instance.
func (NSPropertyMapping) Name ¶
func (p NSPropertyMapping) Name() string
The name of the property in the destination entity for the property mapping.
See: https://developer.apple.com/documentation/CoreData/NSPropertyMapping/name
func (NSPropertyMapping) SetName ¶
func (p NSPropertyMapping) SetName(value string)
func (NSPropertyMapping) SetUserInfo ¶
func (p NSPropertyMapping) SetUserInfo(value foundation.INSDictionary)
func (NSPropertyMapping) SetValueExpression ¶
func (p NSPropertyMapping) SetValueExpression(value foundation.NSExpression)
func (NSPropertyMapping) UserInfo ¶
func (p NSPropertyMapping) UserInfo() foundation.INSDictionary
The user info for the property mapping.
See: https://developer.apple.com/documentation/CoreData/NSPropertyMapping/userInfo
func (NSPropertyMapping) ValueExpression ¶
func (p NSPropertyMapping) ValueExpression() foundation.NSExpression
The value expression for the property mapping.
Discussion ¶
The expression is used to create the value for the destination property.
See: https://developer.apple.com/documentation/CoreData/NSPropertyMapping/valueExpression
type NSPropertyMappingClass ¶
type NSPropertyMappingClass struct {
// contains filtered or unexported fields
}
func GetNSPropertyMappingClass ¶
func GetNSPropertyMappingClass() NSPropertyMappingClass
GetNSPropertyMappingClass returns the class object for NSPropertyMapping.
func (NSPropertyMappingClass) Alloc ¶
func (nc NSPropertyMappingClass) Alloc() NSPropertyMapping
Alloc allocates memory for a new instance of the class.
func (NSPropertyMappingClass) Class ¶
func (nc NSPropertyMappingClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSQueryGenerationToken ¶
type NSQueryGenerationToken struct {
objectivec.Object
}
A token that indicates which generation of the persistent store is being accessed.
Overview ¶
When a managed object context is pinned to a specific generation of the app data, a query generation token will be associated with that context.
See: https://developer.apple.com/documentation/CoreData/NSQueryGenerationToken
func NSQueryGenerationTokenFromID ¶
func NSQueryGenerationTokenFromID(id objc.ID) NSQueryGenerationToken
NSQueryGenerationTokenFromID constructs a NSQueryGenerationToken from an objc.ID.
A token that indicates which generation of the persistent store is being accessed.
func NewNSQueryGenerationToken ¶
func NewNSQueryGenerationToken() NSQueryGenerationToken
NewNSQueryGenerationToken creates a new NSQueryGenerationToken instance.
func (NSQueryGenerationToken) Autorelease ¶
func (q NSQueryGenerationToken) Autorelease() NSQueryGenerationToken
Autorelease adds the receiver to the current autorelease pool.
func (NSQueryGenerationToken) EncodeWithCoder ¶
func (q NSQueryGenerationToken) EncodeWithCoder(coder foundation.INSCoder)
func (NSQueryGenerationToken) Init ¶
func (q NSQueryGenerationToken) Init() NSQueryGenerationToken
Init initializes the instance.
type NSQueryGenerationTokenClass ¶
type NSQueryGenerationTokenClass struct {
// contains filtered or unexported fields
}
func GetNSQueryGenerationTokenClass ¶
func GetNSQueryGenerationTokenClass() NSQueryGenerationTokenClass
GetNSQueryGenerationTokenClass returns the class object for NSQueryGenerationToken.
func (NSQueryGenerationTokenClass) Alloc ¶
func (nc NSQueryGenerationTokenClass) Alloc() NSQueryGenerationToken
Alloc allocates memory for a new instance of the class.
func (NSQueryGenerationTokenClass) Class ¶
func (nc NSQueryGenerationTokenClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (NSQueryGenerationTokenClass) CurrentQueryGenerationToken ¶
func (_NSQueryGenerationTokenClass NSQueryGenerationTokenClass) CurrentQueryGenerationToken() NSQueryGenerationToken
A token that informs a context to use the current generation.
See: https://developer.apple.com/documentation/CoreData/NSQueryGenerationToken/current
type NSRelationshipDescription ¶
type NSRelationshipDescription struct {
NSPropertyDescription
}
A description of a relationship between two entities.
Overview ¶
NSRelationshipDescription provides additional attributes that are specific to modeling a relationship between two entities. For the common attributes of all property types, see NSPropertyDescription.
For example, use this class to define a relationship’s cardinality — the number of managed objects the relationship can reference.
- For a to-one relationship, set NSRelationshipDescription.MaxCount to `1`. - For a to-many relationship, set NSRelationshipDescription.MaxCount to a number greater than `1` to impose an upper limit; otherwise, use `0` to allow an unlimited number of referenced objects.
At runtime, you can modify a relationship description until you associate its owning managed object model with a persistent store coordinator. If you attempt to modify the model after you associate it, Core Data throws an exception. To modify a model that’s in use, create and modify a copy and then discard any objects that belong to the original model.
Configuring the Destination ¶
- NSRelationshipDescription.InverseRelationship: The relationship that represents the inverse of the current relationship.
- NSRelationshipDescription.SetInverseRelationship
- NSRelationshipDescription.DestinationEntity: The type of object the relationship contains.
- NSRelationshipDescription.SetDestinationEntity
- NSRelationshipDescription.IsOrdered: A Boolean value that determines whether the relationship preserves the order of the referenced managed objects.
- NSRelationshipDescription.SetOrdered
Configuring Cardinality ¶
- NSRelationshipDescription.IsToMany: Returns a Boolean value that indicates whether the relationship can contain many managed objects.
- NSRelationshipDescription.MinCount: The minimum number of managed objects the relationship can reference.
- NSRelationshipDescription.SetMinCount
- NSRelationshipDescription.MaxCount: The maximum number of managed objects the relationship can reference.
- NSRelationshipDescription.SetMaxCount
Configuring Delete Behavior ¶
- NSRelationshipDescription.DeleteRule: The rule to apply when you delete the relationship’s owning managed object.
- NSRelationshipDescription.SetDeleteRule
See: https://developer.apple.com/documentation/CoreData/NSRelationshipDescription
func NSRelationshipDescriptionFromID ¶
func NSRelationshipDescriptionFromID(id objc.ID) NSRelationshipDescription
NSRelationshipDescriptionFromID constructs a NSRelationshipDescription from an objc.ID.
A description of a relationship between two entities.
func NewNSRelationshipDescription ¶
func NewNSRelationshipDescription() NSRelationshipDescription
NewNSRelationshipDescription creates a new NSRelationshipDescription instance.
func (NSRelationshipDescription) Autorelease ¶
func (r NSRelationshipDescription) Autorelease() NSRelationshipDescription
Autorelease adds the receiver to the current autorelease pool.
func (NSRelationshipDescription) DeleteRule ¶
func (r NSRelationshipDescription) DeleteRule() NSDeleteRule
The rule to apply when you delete the relationship’s owning managed object.
Discussion ¶
The default value is NSDeleteRule.nullifyDeleteRule. For possible values, see NSDeleteRule.
See: https://developer.apple.com/documentation/CoreData/NSRelationshipDescription/deleteRule
func (NSRelationshipDescription) DestinationEntity ¶
func (r NSRelationshipDescription) DestinationEntity() INSEntityDescription
The type of object the relationship contains.
See: https://developer.apple.com/documentation/CoreData/NSRelationshipDescription/destinationEntity
func (NSRelationshipDescription) Init ¶
func (r NSRelationshipDescription) Init() NSRelationshipDescription
Init initializes the instance.
func (NSRelationshipDescription) InverseRelationship ¶
func (r NSRelationshipDescription) InverseRelationship() INSRelationshipDescription
The relationship that represents the inverse of the current relationship.
Discussion ¶
The inverse relationship is the description of the current relationship from the destination entity’s perspective. For example, the inverse of a department’s relationship to an employee (a to-many relationship) is the employees’ relationship to the department (a to-one relationship).
See: https://developer.apple.com/documentation/CoreData/NSRelationshipDescription/inverseRelationship
func (NSRelationshipDescription) IsOrdered ¶
func (r NSRelationshipDescription) IsOrdered() bool
A Boolean value that determines whether the relationship preserves the order of the referenced managed objects.
Discussion ¶
The default value is false.
See: https://developer.apple.com/documentation/CoreData/NSRelationshipDescription/isOrdered
func (NSRelationshipDescription) IsToMany ¶
func (r NSRelationshipDescription) IsToMany() bool
Returns a Boolean value that indicates whether the relationship can contain many managed objects.
Discussion ¶
If NSRelationshipDescription.MaxCount is equal to `1`, implying a to-one relationship, this property returns false; otherwise, it returns true.
See: https://developer.apple.com/documentation/CoreData/NSRelationshipDescription/isToMany
func (NSRelationshipDescription) MaxCount ¶
func (r NSRelationshipDescription) MaxCount() uint
The maximum number of managed objects the relationship can reference.
Discussion ¶
If you declare a relationship attribute as optional when defining your entities, the framework only enforces NSRelationshipDescription.MinCount and NSRelationshipDescription.MaxCount when that attribute is not `nil`.
The default value is `0`.
See: https://developer.apple.com/documentation/CoreData/NSRelationshipDescription/maxCount
func (NSRelationshipDescription) MinCount ¶
func (r NSRelationshipDescription) MinCount() uint
The minimum number of managed objects the relationship can reference.
Discussion ¶
If you declare a relationship attribute as optional when defining your entities, the framework only enforces NSRelationshipDescription.MinCount and NSRelationshipDescription.MaxCount when that attribute is not `nil`.
The default value is `0`.
See: https://developer.apple.com/documentation/CoreData/NSRelationshipDescription/minCount
func (NSRelationshipDescription) SetDeleteRule ¶
func (r NSRelationshipDescription) SetDeleteRule(value NSDeleteRule)
func (NSRelationshipDescription) SetDestinationEntity ¶
func (r NSRelationshipDescription) SetDestinationEntity(value INSEntityDescription)
func (NSRelationshipDescription) SetInverseRelationship ¶
func (r NSRelationshipDescription) SetInverseRelationship(value INSRelationshipDescription)
func (NSRelationshipDescription) SetMaxCount ¶
func (r NSRelationshipDescription) SetMaxCount(value uint)
func (NSRelationshipDescription) SetMinCount ¶
func (r NSRelationshipDescription) SetMinCount(value uint)
func (NSRelationshipDescription) SetOrdered ¶
func (r NSRelationshipDescription) SetOrdered(value bool)
type NSRelationshipDescriptionClass ¶
type NSRelationshipDescriptionClass struct {
// contains filtered or unexported fields
}
func GetNSRelationshipDescriptionClass ¶
func GetNSRelationshipDescriptionClass() NSRelationshipDescriptionClass
GetNSRelationshipDescriptionClass returns the class object for NSRelationshipDescription.
func (NSRelationshipDescriptionClass) Alloc ¶
func (nc NSRelationshipDescriptionClass) Alloc() NSRelationshipDescription
Alloc allocates memory for a new instance of the class.
func (NSRelationshipDescriptionClass) Class ¶
func (nc NSRelationshipDescriptionClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSSaveChangesRequest ¶
type NSSaveChangesRequest struct {
NSPersistentStoreRequest
}
An encapsulation of a collection of changes to be made by an object store in response to a save operation on a managed object context.
Initializing a Request ¶
- NSSaveChangesRequest.InitWithInsertedObjectsUpdatedObjectsDeletedObjectsLockedObjects: Initializes a save changes request with collections of given changes.
Getting Information about a Request ¶
- NSSaveChangesRequest.InsertedObjects: The objects that were inserted into the calling context.
- NSSaveChangesRequest.UpdatedObjects: The objects that were modified in the calling context.
- NSSaveChangesRequest.DeletedObjects: The objects that were deleted in the calling context.
- NSSaveChangesRequest.LockedObjects: The objects that were flagged for optimistic locking on the calling context.
See: https://developer.apple.com/documentation/CoreData/NSSaveChangesRequest
func NSSaveChangesRequestFromID ¶
func NSSaveChangesRequestFromID(id objc.ID) NSSaveChangesRequest
NSSaveChangesRequestFromID constructs a NSSaveChangesRequest from an objc.ID.
An encapsulation of a collection of changes to be made by an object store in response to a save operation on a managed object context.
func NewNSSaveChangesRequest ¶
func NewNSSaveChangesRequest() NSSaveChangesRequest
NewNSSaveChangesRequest creates a new NSSaveChangesRequest instance.
func NewSaveChangesRequestWithInsertedObjectsUpdatedObjectsDeletedObjectsLockedObjects ¶
func NewSaveChangesRequestWithInsertedObjectsUpdatedObjectsDeletedObjectsLockedObjects(insertedObjects foundation.INSSet, updatedObjects foundation.INSSet, deletedObjects foundation.INSSet, lockedObjects foundation.INSSet) NSSaveChangesRequest
Initializes a save changes request with collections of given changes.
insertedObjects: Objects that were inserted into the calling context.
updatedObjects: Objects that were updated in the calling context.
deletedObjects: Objects that were deleted in the calling context.
lockedObjects: Objects that were flagged for optimistic locking on the calling context.
Return Value ¶
A save changes request initialized with the given changes.
func (NSSaveChangesRequest) Autorelease ¶
func (s NSSaveChangesRequest) Autorelease() NSSaveChangesRequest
Autorelease adds the receiver to the current autorelease pool.
func (NSSaveChangesRequest) DeletedObjects ¶
func (s NSSaveChangesRequest) DeletedObjects() foundation.INSSet
The objects that were deleted in the calling context.
See: https://developer.apple.com/documentation/CoreData/NSSaveChangesRequest/deletedObjects
func (NSSaveChangesRequest) Init ¶
func (s NSSaveChangesRequest) Init() NSSaveChangesRequest
Init initializes the instance.
func (NSSaveChangesRequest) InitWithInsertedObjectsUpdatedObjectsDeletedObjectsLockedObjects ¶
func (s NSSaveChangesRequest) InitWithInsertedObjectsUpdatedObjectsDeletedObjectsLockedObjects(insertedObjects foundation.INSSet, updatedObjects foundation.INSSet, deletedObjects foundation.INSSet, lockedObjects foundation.INSSet) NSSaveChangesRequest
Initializes a save changes request with collections of given changes.
insertedObjects: Objects that were inserted into the calling context.
updatedObjects: Objects that were updated in the calling context.
deletedObjects: Objects that were deleted in the calling context.
lockedObjects: Objects that were flagged for optimistic locking on the calling context.
Return Value ¶
A save changes request initialized with the given changes.
func (NSSaveChangesRequest) InsertedObjects ¶
func (s NSSaveChangesRequest) InsertedObjects() foundation.INSSet
The objects that were inserted into the calling context.
See: https://developer.apple.com/documentation/CoreData/NSSaveChangesRequest/insertedObjects
func (NSSaveChangesRequest) LockedObjects ¶
func (s NSSaveChangesRequest) LockedObjects() foundation.INSSet
The objects that were flagged for optimistic locking on the calling context.
Discussion ¶
Objects are flagged for optimistic locking with NSManagedObjectContext.DetectConflictsForObject.
See: https://developer.apple.com/documentation/CoreData/NSSaveChangesRequest/lockedObjects
func (NSSaveChangesRequest) UpdatedObjects ¶
func (s NSSaveChangesRequest) UpdatedObjects() foundation.INSSet
The objects that were modified in the calling context.
See: https://developer.apple.com/documentation/CoreData/NSSaveChangesRequest/updatedObjects
type NSSaveChangesRequestClass ¶
type NSSaveChangesRequestClass struct {
// contains filtered or unexported fields
}
func GetNSSaveChangesRequestClass ¶
func GetNSSaveChangesRequestClass() NSSaveChangesRequestClass
GetNSSaveChangesRequestClass returns the class object for NSSaveChangesRequest.
func (NSSaveChangesRequestClass) Alloc ¶
func (nc NSSaveChangesRequestClass) Alloc() NSSaveChangesRequest
Alloc allocates memory for a new instance of the class.
func (NSSaveChangesRequestClass) Class ¶
func (nc NSSaveChangesRequestClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type NSSnapshotEventType ¶
type NSSnapshotEventType uint
See: https://developer.apple.com/documentation/CoreData/NSSnapshotEventType
const ( // NSSnapshotEventMergePolicy: Specifies a change due to conflict resolution during a save operation. NSSnapshotEventMergePolicy NSSnapshotEventType = 64 // NSSnapshotEventRefresh: Specifies a change due to the managed object being refreshed. NSSnapshotEventRefresh NSSnapshotEventType = 32 // NSSnapshotEventRollback: Specifies a change due to the managed object context being rolled back. NSSnapshotEventRollback NSSnapshotEventType = 16 // NSSnapshotEventUndoDeletion: Specifies a change due to undo from deletion. NSSnapshotEventUndoDeletion NSSnapshotEventType = 4 // NSSnapshotEventUndoInsertion: Specifies a change due to undo from insertion. NSSnapshotEventUndoInsertion NSSnapshotEventType = 2 // NSSnapshotEventUndoUpdate: Specifies a change due to a property-level undo. NSSnapshotEventUndoUpdate NSSnapshotEventType = 8 )
func (NSSnapshotEventType) String ¶
func (e NSSnapshotEventType) String() string
type NSStagedMigrationManager ¶
type NSStagedMigrationManager struct {
objectivec.Object
}
An object that handles the migration event loop and provides access to the migrating persistent store.
Overview ¶
A staged migration manager contains the individual stages of a migration and applies those stages, in the order you specify, when that migration runs. The manager handles the migration’s event loop, and provides access to the migrating store through its NSStagedMigrationManager.Container property. Stages can be custom, which enables you to perform tasks immediately before and after a stage runs, or lightweight, which supplements custom stages with those that Core Data can invoke automatically because they’re already compatible with lightweight migrations.
Use NSPersistentStoreStagedMigrationManagerOptionKey to include an instance of NSStagedMigrationManager in your persistent store’s options dictionary, as the following example shows:
Accessing the persistent container ¶
- NSStagedMigrationManager.Container: The container that provides access to the migrating persistent store.
Accessing the stages ¶
- NSStagedMigrationManager.Stages: The migration stages.
See: https://developer.apple.com/documentation/CoreData/NSStagedMigrationManager
func NSStagedMigrationManagerFromID ¶
func NSStagedMigrationManagerFromID(id objc.ID) NSStagedMigrationManager
NSStagedMigrationManagerFromID constructs a NSStagedMigrationManager from an objc.ID.
An object that handles the migration event loop and provides access to the migrating persistent store.
func NewNSStagedMigrationManager ¶
func NewNSStagedMigrationManager() NSStagedMigrationManager
NewNSStagedMigrationManager creates a new NSStagedMigrationManager instance.
func (NSStagedMigrationManager) Autorelease ¶
func (s NSStagedMigrationManager) Autorelease() NSStagedMigrationManager
Autorelease adds the receiver to the current autorelease pool.
func (NSStagedMigrationManager) Container ¶
func (s NSStagedMigrationManager) Container() INSPersistentContainer
The container that provides access to the migrating persistent store.
See: https://developer.apple.com/documentation/CoreData/NSStagedMigrationManager/container
func (NSStagedMigrationManager) Init ¶
func (s NSStagedMigrationManager) Init() NSStagedMigrationManager
Init initializes the instance.
func (NSStagedMigrationManager) Stages ¶
func (s NSStagedMigrationManager) Stages() []NSMigrationStage
The migration stages.
Discussion ¶
Core Data sets this property to the `stages` parameter you specify when creating the migration manager.
See: https://developer.apple.com/documentation/CoreData/NSStagedMigrationManager/stages
type NSStagedMigrationManagerClass ¶
type NSStagedMigrationManagerClass struct {
// contains filtered or unexported fields
}
func GetNSStagedMigrationManagerClass ¶
func GetNSStagedMigrationManagerClass() NSStagedMigrationManagerClass
GetNSStagedMigrationManagerClass returns the class object for NSStagedMigrationManager.
func (NSStagedMigrationManagerClass) Alloc ¶
func (nc NSStagedMigrationManagerClass) Alloc() NSStagedMigrationManager
Alloc allocates memory for a new instance of the class.
func (NSStagedMigrationManagerClass) Class ¶
func (nc NSStagedMigrationManagerClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type PersistentStoreDescriptionErrorHandler ¶
type PersistentStoreDescriptionErrorHandler = func(*NSPersistentStoreDescription, error)
PersistentStoreDescriptionErrorHandler handles The completion handler block that’s invoked after the store is added. The error can be type-asserted to *foundation.NSError for Domain, Code, and UserInfo.
Used by:
type ResultType ¶
type ResultType = _undefined
type VoidHandler ¶
type VoidHandler = func()
VoidHandler handles The closure to perform.
Used by:
- NSCoreDataCoreSpotlightDelegate.SearchableIndexReindexAllSearchableItemsWithAcknowledgementHandler
- NSCoreDataCoreSpotlightDelegate.SearchableIndexReindexSearchableItemsWithIdentifiersAcknowledgementHandler
- NSManagedObjectContext.PerformBlockAndWait
- NSManagedObjectContext.PerformBlock
- NSPersistentStoreCoordinator.PerformBlockAndWait
- NSPersistentStoreCoordinator.PerformBlock
Source Files
¶
- blocks.gen.go
- delegate_class_counter.gen.go
- doc.gen.go
- enums.gen.go
- fetch_request_result_protocol.gen.go
- fetched_results_controller_delegate_protocol.gen.go
- fetched_results_section_info_protocol.gen.go
- functions.gen.go
- generate.go
- global_vars.gen.go
- ns_asynchronous_fetch_request.gen.go
- ns_asynchronous_fetch_result.gen.go
- ns_atomic_store.gen.go
- ns_atomic_store_cache_node.gen.go
- ns_attribute_description.gen.go
- ns_batch_delete_request.gen.go
- ns_batch_delete_result.gen.go
- ns_batch_insert_request.gen.go
- ns_batch_insert_result.gen.go
- ns_batch_update_request.gen.go
- ns_batch_update_result.gen.go
- ns_composite_attribute_description.gen.go
- ns_constraint_conflict.gen.go
- ns_core_data_core_spotlight_delegate.gen.go
- ns_custom_migration_stage.gen.go
- ns_derived_attribute_description.gen.go
- ns_entity_description.gen.go
- ns_entity_mapping.gen.go
- ns_entity_migration_policy.gen.go
- ns_expression_description.gen.go
- ns_fetch_index_description.gen.go
- ns_fetch_index_element_description.gen.go
- ns_fetch_request.gen.go
- ns_fetch_request_expression.gen.go
- ns_fetched_property_description.gen.go
- ns_fetched_results_controller.gen.go
- ns_incremental_store.gen.go
- ns_incremental_store_node.gen.go
- ns_lightweight_migration_stage.gen.go
- ns_managed_object.gen.go
- ns_managed_object_context.gen.go
- ns_managed_object_id.gen.go
- ns_managed_object_model.gen.go
- ns_managed_object_model_reference.gen.go
- ns_mapping_model.gen.go
- ns_merge_conflict.gen.go
- ns_merge_policy.gen.go
- ns_migration_manager.gen.go
- ns_migration_stage.gen.go
- ns_persistent_cloud_kit_container.gen.go
- ns_persistent_cloud_kit_container_event.gen.go
- ns_persistent_cloud_kit_container_event_request.gen.go
- ns_persistent_cloud_kit_container_event_result.gen.go
- ns_persistent_cloud_kit_container_options.gen.go
- ns_persistent_container.gen.go
- ns_persistent_history_change.gen.go
- ns_persistent_history_change_request.gen.go
- ns_persistent_history_result.gen.go
- ns_persistent_history_token.gen.go
- ns_persistent_history_transaction.gen.go
- ns_persistent_store.gen.go
- ns_persistent_store_asynchronous_result.gen.go
- ns_persistent_store_coordinator.gen.go
- ns_persistent_store_description.gen.go
- ns_persistent_store_request.gen.go
- ns_persistent_store_result.gen.go
- ns_property_description.gen.go
- ns_property_mapping.gen.go
- ns_query_generation_token.gen.go
- ns_relationship_description.gen.go
- ns_save_changes_request.gen.go
- ns_staged_migration_manager.gen.go
- typedefs.gen.go
- types.gen.go
- undefined_types.gen.go