motion-yapper 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +20 -0
- data/.travis.yml +6 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +63 -0
- data/README.md +16 -0
- data/Rakefile +20 -0
- data/app/app_delegate.rb +5 -0
- data/lib/yapper.rb +30 -0
- data/lib/yapper/attachment.rb +48 -0
- data/lib/yapper/bson.rb +20 -0
- data/lib/yapper/config.rb +18 -0
- data/lib/yapper/db.rb +151 -0
- data/lib/yapper/document.rb +54 -0
- data/lib/yapper/document/attachment.rb +26 -0
- data/lib/yapper/document/callbacks.rb +86 -0
- data/lib/yapper/document/persistance.rb +171 -0
- data/lib/yapper/document/relation.rb +84 -0
- data/lib/yapper/document/selection.rb +100 -0
- data/lib/yapper/extensions.rb +80 -0
- data/lib/yapper/log.rb +5 -0
- data/lib/yapper/sync.rb +134 -0
- data/lib/yapper/sync/data.rb +12 -0
- data/lib/yapper/sync/event.rb +194 -0
- data/lib/yapper/sync/queue.rb +164 -0
- data/lib/yapper/timestamps.rb +16 -0
- data/lib/yapper/version.rb +3 -0
- data/lib/yapper/yapper.rb +2 -0
- data/spec/helpers/time_helper.rb +3 -0
- data/spec/integration/all_spec.rb +40 -0
- data/spec/integration/callback_spec.rb +87 -0
- data/spec/integration/db_spec.rb +40 -0
- data/spec/integration/find_spec.rb +51 -0
- data/spec/integration/persistance_spec.rb +118 -0
- data/spec/integration/relation_spec.rb +174 -0
- data/spec/integration/sync_spec.rb +42 -0
- data/spec/integration/timestamps_spec.rb +34 -0
- data/spec/integration/types_spec.rb +23 -0
- data/spec/integration/when_spec.rb +29 -0
- data/spec/integration/where_spec.rb +132 -0
- data/vendor/Podfile.lock +24 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPClient.h +641 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPClient.m +1396 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.h +133 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.m +327 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFImageRequestOperation.h +113 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFImageRequestOperation.m +321 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFJSONRequestOperation.h +71 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFJSONRequestOperation.m +150 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFNetworkActivityIndicatorManager.h +75 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFNetworkActivityIndicatorManager.m +157 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFNetworking.h +43 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFPropertyListRequestOperation.h +68 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFPropertyListRequestOperation.m +143 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.h +370 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.m +848 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFXMLRequestOperation.h +89 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFXMLRequestOperation.m +167 -0
- data/vendor/Pods/AFNetworking/AFNetworking/UIImageView+AFNetworking.h +78 -0
- data/vendor/Pods/AFNetworking/AFNetworking/UIImageView+AFNetworking.m +191 -0
- data/vendor/Pods/AFNetworking/LICENSE +19 -0
- data/vendor/Pods/AFNetworking/README.md +208 -0
- data/vendor/Pods/BuildHeaders/AFNetworking/AFHTTPClient.h +641 -0
- data/vendor/Pods/BuildHeaders/AFNetworking/AFHTTPRequestOperation.h +133 -0
- data/vendor/Pods/BuildHeaders/AFNetworking/AFImageRequestOperation.h +113 -0
- data/vendor/Pods/BuildHeaders/AFNetworking/AFJSONRequestOperation.h +71 -0
- data/vendor/Pods/BuildHeaders/AFNetworking/AFNetworkActivityIndicatorManager.h +75 -0
- data/vendor/Pods/BuildHeaders/AFNetworking/AFNetworking.h +43 -0
- data/vendor/Pods/BuildHeaders/AFNetworking/AFPropertyListRequestOperation.h +68 -0
- data/vendor/Pods/BuildHeaders/AFNetworking/AFURLConnectionOperation.h +370 -0
- data/vendor/Pods/BuildHeaders/AFNetworking/AFXMLRequestOperation.h +89 -0
- data/vendor/Pods/BuildHeaders/AFNetworking/UIImageView+AFNetworking.h +78 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/ContextFilterLogFormatter.h +65 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDASLLogger.h +41 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDAbstractDatabaseLogger.h +102 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDFileLogger.h +334 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDLog.h +601 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDTTYLogger.h +167 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DispatchQueueLogFormatter.h +116 -0
- data/vendor/Pods/BuildHeaders/NSData+MD5Digest/NSData+MD5Digest.h +18 -0
- data/vendor/Pods/BuildHeaders/Reachability/Reachability.h +109 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapCache.h +90 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapCollectionKey.h +20 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabase.h +547 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseConnection.h +447 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseConnectionState.h +29 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseDefaults.h +37 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtension.h +15 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtensionConnection.h +11 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtensionPrivate.h +440 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtensionTransaction.h +11 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredView.h +108 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewConnection.h +12 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewPrivate.h +19 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewTransaction.h +39 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearch.h +89 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchConnection.h +32 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchPrivate.h +69 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchSnippetOptions.h +79 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchTransaction.h +68 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseLogging.h +158 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseManager.h +17 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabasePrivate.h +424 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseQuery.h +42 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndex.h +100 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexConnection.h +33 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexPrivate.h +73 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexSetup.h +33 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexTransaction.h +58 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseStatement.h +13 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseString.h +121 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseTransaction.h +541 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseView.h +186 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewChange.h +272 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewChangePrivate.h +94 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewConnection.h +115 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewMappings.h +825 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewMappingsPrivate.h +72 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewOptions.h +56 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewPage.h +36 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewPageMetadata.h +27 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewPrivate.h +153 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewRangeOptions.h +330 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewRangeOptionsPrivate.h +17 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewTransaction.h +447 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapMemoryTable.h +74 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapNull.h +17 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapSet.h +41 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapTouch.h +15 -0
- data/vendor/Pods/CocoaLumberjack/LICENSE.txt +18 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDASLLogger.h +41 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDASLLogger.m +99 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.h +102 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.m +727 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDFileLogger.h +334 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDFileLogger.m +1353 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog.h +601 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog.m +1083 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDTTYLogger.h +167 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDTTYLogger.m +1479 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/ContextFilterLogFormatter.h +65 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/ContextFilterLogFormatter.m +191 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DispatchQueueLogFormatter.h +116 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DispatchQueueLogFormatter.m +251 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/README.txt +7 -0
- data/vendor/Pods/CocoaLumberjack/README.markdown +37 -0
- data/vendor/Pods/Headers/AFNetworking/AFHTTPClient.h +641 -0
- data/vendor/Pods/Headers/AFNetworking/AFHTTPRequestOperation.h +133 -0
- data/vendor/Pods/Headers/AFNetworking/AFImageRequestOperation.h +113 -0
- data/vendor/Pods/Headers/AFNetworking/AFJSONRequestOperation.h +71 -0
- data/vendor/Pods/Headers/AFNetworking/AFNetworkActivityIndicatorManager.h +75 -0
- data/vendor/Pods/Headers/AFNetworking/AFNetworking.h +43 -0
- data/vendor/Pods/Headers/AFNetworking/AFPropertyListRequestOperation.h +68 -0
- data/vendor/Pods/Headers/AFNetworking/AFURLConnectionOperation.h +370 -0
- data/vendor/Pods/Headers/AFNetworking/AFXMLRequestOperation.h +89 -0
- data/vendor/Pods/Headers/AFNetworking/UIImageView+AFNetworking.h +78 -0
- data/vendor/Pods/Headers/CocoaLumberjack/ContextFilterLogFormatter.h +65 -0
- data/vendor/Pods/Headers/CocoaLumberjack/DDASLLogger.h +41 -0
- data/vendor/Pods/Headers/CocoaLumberjack/DDAbstractDatabaseLogger.h +102 -0
- data/vendor/Pods/Headers/CocoaLumberjack/DDFileLogger.h +334 -0
- data/vendor/Pods/Headers/CocoaLumberjack/DDLog.h +601 -0
- data/vendor/Pods/Headers/CocoaLumberjack/DDTTYLogger.h +167 -0
- data/vendor/Pods/Headers/CocoaLumberjack/DispatchQueueLogFormatter.h +116 -0
- data/vendor/Pods/Headers/NSData+MD5Digest/NSData+MD5Digest.h +18 -0
- data/vendor/Pods/Headers/Reachability/Reachability.h +109 -0
- data/vendor/Pods/Headers/YapDatabase/YapCache.h +90 -0
- data/vendor/Pods/Headers/YapDatabase/YapCollectionKey.h +20 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabase.h +547 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseConnection.h +447 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseConnectionState.h +29 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseDefaults.h +37 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseExtension.h +15 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseExtensionConnection.h +11 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseExtensionPrivate.h +440 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseExtensionTransaction.h +11 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredView.h +108 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewConnection.h +12 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewPrivate.h +19 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewTransaction.h +39 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearch.h +89 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearchConnection.h +32 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearchPrivate.h +69 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearchSnippetOptions.h +79 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearchTransaction.h +68 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseLogging.h +158 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseManager.h +17 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabasePrivate.h +424 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseQuery.h +42 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndex.h +100 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndexConnection.h +33 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndexPrivate.h +73 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndexSetup.h +33 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndexTransaction.h +58 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseStatement.h +13 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseString.h +121 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseTransaction.h +541 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseView.h +186 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewChange.h +272 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewChangePrivate.h +94 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewConnection.h +115 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewMappings.h +825 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewMappingsPrivate.h +72 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewOptions.h +56 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPage.h +36 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPageMetadata.h +27 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPrivate.h +153 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewRangeOptions.h +330 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewRangeOptionsPrivate.h +17 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewTransaction.h +447 -0
- data/vendor/Pods/Headers/YapDatabase/YapMemoryTable.h +74 -0
- data/vendor/Pods/Headers/YapDatabase/YapNull.h +17 -0
- data/vendor/Pods/Headers/YapDatabase/YapSet.h +41 -0
- data/vendor/Pods/Headers/YapDatabase/YapTouch.h +15 -0
- data/vendor/Pods/Headers/____Pods-AFNetworking-prefix.h +17 -0
- data/vendor/Pods/Headers/____Pods-CocoaLumberjack-prefix.h +5 -0
- data/vendor/Pods/Headers/____Pods-NSData+MD5Digest-prefix.h +5 -0
- data/vendor/Pods/Headers/____Pods-Reachability-prefix.h +5 -0
- data/vendor/Pods/Headers/____Pods-YapDatabase-prefix.h +5 -0
- data/vendor/Pods/Headers/____Pods-environment.h +38 -0
- data/vendor/Pods/Manifest.lock +24 -0
- data/vendor/Pods/NSData+MD5Digest/NSData+MD5Digest/NSData+MD5Digest.h +18 -0
- data/vendor/Pods/NSData+MD5Digest/NSData+MD5Digest/NSData+MD5Digest.m +39 -0
- data/vendor/Pods/NSData+MD5Digest/README.md +11 -0
- data/vendor/Pods/Pods-AFNetworking-Private.xcconfig +5 -0
- data/vendor/Pods/Pods-AFNetworking-dummy.m +5 -0
- data/vendor/Pods/Pods-AFNetworking-prefix.pch +17 -0
- data/vendor/Pods/Pods-AFNetworking.xcconfig +1 -0
- data/vendor/Pods/Pods-Acknowledgements.markdown +96 -0
- data/vendor/Pods/Pods-Acknowledgements.plist +142 -0
- data/vendor/Pods/Pods-CocoaLumberjack-Private.xcconfig +5 -0
- data/vendor/Pods/Pods-CocoaLumberjack-dummy.m +5 -0
- data/vendor/Pods/Pods-CocoaLumberjack-prefix.pch +5 -0
- data/vendor/Pods/Pods-CocoaLumberjack.xcconfig +0 -0
- data/vendor/Pods/Pods-NSData+MD5Digest-Private.xcconfig +5 -0
- data/vendor/Pods/Pods-NSData+MD5Digest-dummy.m +5 -0
- data/vendor/Pods/Pods-NSData+MD5Digest-prefix.pch +5 -0
- data/vendor/Pods/Pods-NSData+MD5Digest.xcconfig +0 -0
- data/vendor/Pods/Pods-Reachability-Private.xcconfig +5 -0
- data/vendor/Pods/Pods-Reachability-dummy.m +5 -0
- data/vendor/Pods/Pods-Reachability-prefix.pch +5 -0
- data/vendor/Pods/Pods-Reachability.xcconfig +1 -0
- data/vendor/Pods/Pods-YapDatabase-Private.xcconfig +5 -0
- data/vendor/Pods/Pods-YapDatabase-dummy.m +5 -0
- data/vendor/Pods/Pods-YapDatabase-prefix.pch +5 -0
- data/vendor/Pods/Pods-YapDatabase.xcconfig +1 -0
- data/vendor/Pods/Pods-dummy.m +5 -0
- data/vendor/Pods/Pods-environment.h +38 -0
- data/vendor/Pods/Pods-resources.sh +68 -0
- data/vendor/Pods/Pods.bridgesupport +5096 -0
- data/vendor/Pods/Pods.xcconfig +5 -0
- data/vendor/Pods/Pods.xcodeproj/project.pbxproj +5536 -0
- data/vendor/Pods/Reachability/LICENCE.txt +24 -0
- data/vendor/Pods/Reachability/README.md +65 -0
- data/vendor/Pods/Reachability/Reachability.h +109 -0
- data/vendor/Pods/Reachability/Reachability.m +527 -0
- data/vendor/Pods/YapDatabase/LICENSE.txt +18 -0
- data/vendor/Pods/YapDatabase/README.md +30 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/Internal/YapDatabaseFilteredViewPrivate.h +19 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredView.h +108 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredView.m +175 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewConnection.h +12 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewConnection.m +41 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTransaction.h +39 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTransaction.m +966 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/Internal/YapDatabaseFullTextSearchPrivate.h +69 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearch.h +89 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearch.m +146 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchConnection.h +32 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchConnection.m +298 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchSnippetOptions.h +79 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchSnippetOptions.m +95 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchTransaction.h +68 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchTransaction.m +1352 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/Internal/YapDatabaseExtensionPrivate.h +440 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtension.h +15 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtension.m +58 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionConnection.h +11 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionConnection.m +46 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionTransaction.h +11 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionTransaction.m +180 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/Internal/YapDatabaseSecondaryIndexPrivate.h +73 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndex.h +100 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndex.m +149 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexConnection.h +33 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexConnection.m +330 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexSetup.h +33 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexSetup.m +184 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexTransaction.h +58 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexTransaction.m +1166 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewChangePrivate.h +94 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewMappingsPrivate.h +72 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPage.h +36 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPage.mm +296 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPageMetadata.h +27 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPageMetadata.m +28 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPrivate.h +153 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewRangeOptionsPrivate.h +17 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewChange.h +272 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewChange.m +2494 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewMappings.h +825 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewMappings.m +1567 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewRangeOptions.h +330 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewRangeOptions.m +141 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseView.h +186 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseView.m +191 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewConnection.h +115 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewConnection.m +897 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewOptions.h +56 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewOptions.m +27 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTransaction.h +447 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTransaction.m +4505 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapCache.h +90 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapCache.m +453 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseConnectionState.h +29 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseConnectionState.m +48 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseDefaults.h +37 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseDefaults.m +83 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseLogging.h +158 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseLogging.m +73 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseManager.h +17 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseManager.m +56 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabasePrivate.h +424 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseStatement.h +13 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseStatement.m +26 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseString.h +121 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapMemoryTable.h +74 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapMemoryTable.m +603 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapNull.h +17 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapNull.m +31 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapTouch.h +15 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapTouch.m +31 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapCollectionKey.h +20 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapCollectionKey.m +194 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapDatabaseQuery.h +42 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapDatabaseQuery.m +96 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapSet.h +41 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapSet.m +82 -0
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabase.h +547 -0
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabase.m +2022 -0
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseConnection.h +447 -0
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseConnection.m +3874 -0
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseTransaction.h +541 -0
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseTransaction.m +5282 -0
- data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.bridgesupport +16 -0
- data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.h +13 -0
- data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.m +20 -0
- data/yapper.gemspec +24 -0
- metadata +458 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
|
|
3
|
+
#import "YapDatabaseExtension.h"
|
|
4
|
+
#import "YapDatabaseViewOptions.h"
|
|
5
|
+
#import "YapDatabaseViewConnection.h"
|
|
6
|
+
#import "YapDatabaseViewTransaction.h"
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Welcome to YapDatabase!
|
|
10
|
+
*
|
|
11
|
+
* https://github.com/yaptv/YapDatabase
|
|
12
|
+
*
|
|
13
|
+
* The project wiki has a wealth of documentation if you have any questions.
|
|
14
|
+
* https://github.com/yaptv/YapDatabase/wiki
|
|
15
|
+
*
|
|
16
|
+
* YapDatabaseView is an extension designed to work with YapDatabase.
|
|
17
|
+
* It gives you a persistent sorted "view" of a configurable subset of your data.
|
|
18
|
+
*
|
|
19
|
+
* For the full documentation on Views, please see the related wiki article:
|
|
20
|
+
* https://github.com/yaptv/YapDatabase/wiki/Views
|
|
21
|
+
*
|
|
22
|
+
* Just in case you don't have Internet access,
|
|
23
|
+
* see the quick overview in YapDatabaseView.h.
|
|
24
|
+
**/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The grouping block handles both filtering and grouping.
|
|
28
|
+
*
|
|
29
|
+
* When you add or update rows in the databse the grouping block is invoked.
|
|
30
|
+
* Your grouping block can inspect the row and determine if it should be a part of the view.
|
|
31
|
+
* If not, your grouping block simply returns 'nil' and the object is excluded from the view (removing it if needed).
|
|
32
|
+
* Otherwise your grouping block returns a group, which can be any string you want.
|
|
33
|
+
* Once the view knows what group the row belongs to,
|
|
34
|
+
* it will then determine the position of the row within the group (using the sorting block).
|
|
35
|
+
*
|
|
36
|
+
* You should choose a block type that takes the minimum number of required parameters.
|
|
37
|
+
* The view can make various optimizations based on required parameters of the block.
|
|
38
|
+
**/
|
|
39
|
+
typedef id YapDatabaseViewGroupingBlock; // One of the YapDatabaseViewGroupingX types below.
|
|
40
|
+
|
|
41
|
+
typedef NSString* (^YapDatabaseViewGroupingWithKeyBlock)(NSString *collection, NSString *key);
|
|
42
|
+
typedef NSString* (^YapDatabaseViewGroupingWithObjectBlock)(NSString *collection, NSString *key, id object);
|
|
43
|
+
typedef NSString* (^YapDatabaseViewGroupingWithMetadataBlock)(NSString *collection, NSString *key, id metadata);
|
|
44
|
+
typedef NSString* (^YapDatabaseViewGroupingWithRowBlock)(NSString *collection, NSString *key, id object, id metadata);
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The sorting block handles sorting of objects within their group.
|
|
48
|
+
*
|
|
49
|
+
* After the view invokes the grouping block to determine what group a database row belongs to (if any),
|
|
50
|
+
* the view then needs to determine what index within that group the row should be.
|
|
51
|
+
* In order to do this, it needs to compare the new/updated row with existing rows in the same view group.
|
|
52
|
+
* This is what the sorting block is used for.
|
|
53
|
+
* So the sorting block will be invoked automatically during this process until the view has come to a conclusion.
|
|
54
|
+
*
|
|
55
|
+
* You should choose a block type that takes the minimum number of required parameters.
|
|
56
|
+
* The view can make various optimizations based on required parameters of the block.
|
|
57
|
+
*
|
|
58
|
+
* For example, if sorting is based on the object, and the metadata of a row is updated,
|
|
59
|
+
* then the view can deduce that the index hasn't changed (if the group hans't), and can skip this step.
|
|
60
|
+
*
|
|
61
|
+
* Performance Note:
|
|
62
|
+
*
|
|
63
|
+
* The view uses various optimizations (based on common patterns)
|
|
64
|
+
* to reduce the number of times it needs to invoke the sorting block.
|
|
65
|
+
*
|
|
66
|
+
* - Pattern : row is updated, but its index in the view doesn't change.
|
|
67
|
+
* Optimization : if an updated row doesn't change groups, the view will first compare it with
|
|
68
|
+
* objects to the left and right.
|
|
69
|
+
*
|
|
70
|
+
* - Pattern : rows are added to the beginning or end or a view
|
|
71
|
+
* Optimization : if the last change put an object at the beginning of the view, then it will test this quickly.
|
|
72
|
+
* if the last change put an object at the end of the view, then it will test this quickly.
|
|
73
|
+
*
|
|
74
|
+
* These optimizations offer huge performance benefits to many common cases.
|
|
75
|
+
* For example, adding objects to a view that are sorted by timestamp of when they arrived.
|
|
76
|
+
*
|
|
77
|
+
* The optimizations are not always performed.
|
|
78
|
+
* That is, if the row is added to a group it didn't previously belong,
|
|
79
|
+
* or if the last change didn't place an item at the beginning or end of the view.
|
|
80
|
+
*
|
|
81
|
+
* If optimizations fail, or are skipped, then the view uses a binary search algorithm.
|
|
82
|
+
*
|
|
83
|
+
* Although this may be considered "internal information",
|
|
84
|
+
* I feel it is important to explain for the following reason:
|
|
85
|
+
*
|
|
86
|
+
* Another common pattern is to fetch a number of objects in a batch, and then insert them into the database.
|
|
87
|
+
* Now imagine a situation in which the view is sorting posts based on timestamp,
|
|
88
|
+
* and you just fetched the most recent 10 posts. You can enumerate these 10 posts in forwards or backwards
|
|
89
|
+
* while adding them to the database. One direction will hit the optimization every time. The other will cause
|
|
90
|
+
* the view to perform a binary search every time. These little one-liner optimzations are easy.
|
|
91
|
+
**/
|
|
92
|
+
typedef id YapDatabaseViewSortingBlock; // One of the YapDatabaseViewSortingX types below.
|
|
93
|
+
|
|
94
|
+
typedef NSComparisonResult (^YapDatabaseViewSortingWithKeyBlock) \
|
|
95
|
+
(NSString *group, NSString *collection1, NSString *key1, \
|
|
96
|
+
NSString *collection2, NSString *key2);
|
|
97
|
+
typedef NSComparisonResult (^YapDatabaseViewSortingWithObjectBlock) \
|
|
98
|
+
(NSString *group, NSString *collection1, NSString *key1, id object1, \
|
|
99
|
+
NSString *collection2, NSString *key2, id object2);
|
|
100
|
+
typedef NSComparisonResult (^YapDatabaseViewSortingWithMetadataBlock) \
|
|
101
|
+
(NSString *group, NSString *collection1, NSString *key1, id metadata, \
|
|
102
|
+
NSString *collection2, NSString *key2, id metadata2);
|
|
103
|
+
typedef NSComparisonResult (^YapDatabaseViewSortingWithRowBlock) \
|
|
104
|
+
(NSString *group, NSString *collection1, NSString *key1, id object1, id metadata1, \
|
|
105
|
+
NSString *collection2, NSString *key2, id object2, id metadata2);
|
|
106
|
+
|
|
107
|
+
#ifndef YapDatabaseViewBlockTypeDefined
|
|
108
|
+
#define YapDatabaseViewBlockTypeDefined 1
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* I wish there was a way to inspect a given block and see what kind of parameters it takes.
|
|
112
|
+
* Sadly this does not appear to be possible (at least not in any kind of standard legal way).
|
|
113
|
+
*
|
|
114
|
+
* Thus, unfortunately (for now), you will have to specify what kind of block you're passing.
|
|
115
|
+
**/
|
|
116
|
+
typedef enum {
|
|
117
|
+
YapDatabaseViewBlockTypeWithKey = 1,
|
|
118
|
+
YapDatabaseViewBlockTypeWithObject = 2,
|
|
119
|
+
YapDatabaseViewBlockTypeWithMetadata = 3,
|
|
120
|
+
YapDatabaseViewBlockTypeWithRow = 4
|
|
121
|
+
} YapDatabaseViewBlockType;
|
|
122
|
+
|
|
123
|
+
#endif
|
|
124
|
+
|
|
125
|
+
@interface YapDatabaseView : YapDatabaseExtension
|
|
126
|
+
|
|
127
|
+
/* Inherited from YapDatabaseExtension
|
|
128
|
+
|
|
129
|
+
@property (nonatomic, strong, readonly) NSString *registeredName;
|
|
130
|
+
|
|
131
|
+
*/
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* See the wiki for an example of how to initialize a view:
|
|
135
|
+
* https://github.com/yaptv/YapDatabase/wiki/Views#wiki-initializing_a_view
|
|
136
|
+
*
|
|
137
|
+
* @param version
|
|
138
|
+
*
|
|
139
|
+
* If, after creating a view, you need to change either the groupingBlock or sortingBlock,
|
|
140
|
+
* then simply use the version parameter. If you pass a version that is different from the last
|
|
141
|
+
* initialization of the view, then the view will automatically flush its tables, and re-populate itself.
|
|
142
|
+
*
|
|
143
|
+
* @param options
|
|
144
|
+
*
|
|
145
|
+
* The options allow you to specify things like creating an in-memory-only view (non persistent).
|
|
146
|
+
**/
|
|
147
|
+
|
|
148
|
+
- (id)initWithGroupingBlock:(YapDatabaseViewGroupingBlock)groupingBlock
|
|
149
|
+
groupingBlockType:(YapDatabaseViewBlockType)groupingBlockType
|
|
150
|
+
sortingBlock:(YapDatabaseViewSortingBlock)sortingBlock
|
|
151
|
+
sortingBlockType:(YapDatabaseViewBlockType)sortingBlockType;
|
|
152
|
+
|
|
153
|
+
- (id)initWithGroupingBlock:(YapDatabaseViewGroupingBlock)groupingBlock
|
|
154
|
+
groupingBlockType:(YapDatabaseViewBlockType)groupingBlockType
|
|
155
|
+
sortingBlock:(YapDatabaseViewSortingBlock)sortingBlock
|
|
156
|
+
sortingBlockType:(YapDatabaseViewBlockType)sortingBlockType
|
|
157
|
+
version:(int)version;
|
|
158
|
+
|
|
159
|
+
- (id)initWithGroupingBlock:(YapDatabaseViewGroupingBlock)groupingBlock
|
|
160
|
+
groupingBlockType:(YapDatabaseViewBlockType)groupingBlockType
|
|
161
|
+
sortingBlock:(YapDatabaseViewSortingBlock)sortingBlock
|
|
162
|
+
sortingBlockType:(YapDatabaseViewBlockType)sortingBlockType
|
|
163
|
+
version:(int)version
|
|
164
|
+
options:(YapDatabaseViewOptions *)options;
|
|
165
|
+
|
|
166
|
+
@property (nonatomic, strong, readonly) YapDatabaseViewGroupingBlock groupingBlock;
|
|
167
|
+
@property (nonatomic, strong, readonly) YapDatabaseViewSortingBlock sortingBlock;
|
|
168
|
+
|
|
169
|
+
@property (nonatomic, assign, readonly) YapDatabaseViewBlockType groupingBlockType;
|
|
170
|
+
@property (nonatomic, assign, readonly) YapDatabaseViewBlockType sortingBlockType;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* The version assists you in updating your blocks.
|
|
174
|
+
*
|
|
175
|
+
* If you need to change the groupingBlock or sortingBlock,
|
|
176
|
+
* then simply pass an incremented version during the init method,
|
|
177
|
+
* and the view will automatically update itself.
|
|
178
|
+
**/
|
|
179
|
+
@property (nonatomic, assign, readonly) int version;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* The options allow you to specify things like creating an in-memory-only view (non persistent).
|
|
183
|
+
**/
|
|
184
|
+
@property (nonatomic, copy, readonly) YapDatabaseViewOptions *options;
|
|
185
|
+
|
|
186
|
+
@end
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
|
|
3
|
+
typedef enum {
|
|
4
|
+
YapDatabaseViewChangeInsert = 1,
|
|
5
|
+
YapDatabaseViewChangeDelete = 2,
|
|
6
|
+
YapDatabaseViewChangeMove = 3,
|
|
7
|
+
YapDatabaseViewChangeUpdate = 4,
|
|
8
|
+
|
|
9
|
+
} YapDatabaseViewChangeType;
|
|
10
|
+
|
|
11
|
+
typedef enum {
|
|
12
|
+
YapDatabaseViewChangedObject = 1 << 0, // 0001
|
|
13
|
+
YapDatabaseViewChangedMetadata = 1 << 1, // 0010
|
|
14
|
+
YapDatabaseViewChangedDependency = 1 << 2, // 0100
|
|
15
|
+
|
|
16
|
+
} YapDatabaseViewChangesBitMask;
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* YapDatabaseViewChange is designed to help facilitate animations to tableViews and collectionsViews.
|
|
21
|
+
*
|
|
22
|
+
* In addition to the documentation available in the header files,
|
|
23
|
+
* you may also wish to read the wiki articles online,
|
|
24
|
+
* which are designed to give you an overview of the various technologies available.
|
|
25
|
+
*
|
|
26
|
+
* General information about setting up and using Views:
|
|
27
|
+
* https://github.com/yaptv/YapDatabase/wiki/Views
|
|
28
|
+
*
|
|
29
|
+
* General information about technologies which integrate with Views:
|
|
30
|
+
* https://github.com/yaptv/YapDatabase/wiki/LongLivedReadTransactions
|
|
31
|
+
* https://github.com/yaptv/YapDatabase/wiki/YapDatabaseModifiedNotification
|
|
32
|
+
**/
|
|
33
|
+
|
|
34
|
+
@interface YapDatabaseViewSectionChange : NSObject <NSCopying>
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The type will be either:
|
|
38
|
+
* - YapDatabaseViewChangeInsert or
|
|
39
|
+
* - YapDatabaseViewChangeDelete
|
|
40
|
+
*
|
|
41
|
+
* @see YapDatabaseViewChangeType
|
|
42
|
+
**/
|
|
43
|
+
@property (nonatomic, readonly) YapDatabaseViewChangeType type;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The section index.
|
|
47
|
+
*
|
|
48
|
+
* If the type is YapDatabaseViewChangeDelete, then this represents the originalIndex of the section (pre-animation).
|
|
49
|
+
* If the type is YapDatabaseViewChangeInsert, then this represents the finalIndex of the section (post-animation).
|
|
50
|
+
**/
|
|
51
|
+
@property (nonatomic, readonly) NSUInteger index;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The corresponding group for the section.
|
|
55
|
+
**/
|
|
56
|
+
@property (nonatomic, readonly) NSString *group;
|
|
57
|
+
|
|
58
|
+
@end
|
|
59
|
+
|
|
60
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
61
|
+
#pragma mark -
|
|
62
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
63
|
+
|
|
64
|
+
@interface YapDatabaseViewRowChange : NSObject <NSCopying>
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The type will be one of:
|
|
68
|
+
* - YapDatabaseViewChangeInsert
|
|
69
|
+
* - YapDatabaseViewChangeDelete
|
|
70
|
+
* - YapDatabaseViewChangeMove
|
|
71
|
+
* - YapDatabaseViewChangeUpdate
|
|
72
|
+
*
|
|
73
|
+
* @see YapDatabaseViewChangeType
|
|
74
|
+
**/
|
|
75
|
+
@property (nonatomic, readonly) YapDatabaseViewChangeType type;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The changes property is a bitmask representing what changed for the corresponding row in the database.
|
|
79
|
+
*
|
|
80
|
+
* There are 3 types represented in the bit mask:
|
|
81
|
+
* - YapDatabaseViewChangedObject
|
|
82
|
+
* - YapDatabaseViewChangedMetadata
|
|
83
|
+
* - YapDatabaseViewChangedDependency
|
|
84
|
+
*
|
|
85
|
+
* YapDatabaseViewChangedObject means the object was changed via setObject:forKey:inCollection:.
|
|
86
|
+
*
|
|
87
|
+
* YapDatabaseViewChangedMetadata means the metadata was changed.
|
|
88
|
+
* This might have happend implicitly if the user invoked setObject:forKey:inCollection: (implicitly setting
|
|
89
|
+
* the meatadata to nil). Or explicitly if the user invoked setObject:forKey:inCollection:withMetadata: or
|
|
90
|
+
* setMetadata:forKey:inCollection:.
|
|
91
|
+
*
|
|
92
|
+
* YapDatabaseViewChangedDependency means the row was flagged due to a cell drawing dependency configuration.
|
|
93
|
+
* See YapDatabaseViewMappings: setCellDrawingDependencyForNeighboringCellWithOffset:forGroup:
|
|
94
|
+
*
|
|
95
|
+
* Keep in mind that this is a bitmask. So, for example, all bits might be set if
|
|
96
|
+
* a row was updated, and was also flagged due to an inter-cell drawing dependency.
|
|
97
|
+
*
|
|
98
|
+
* This may be useful for various optimizations. For example:
|
|
99
|
+
* The drawing of your cell depends only on the object.
|
|
100
|
+
* However, your objects are rather large, and you're using metadata to store small subsets of the object
|
|
101
|
+
* that often need to be fetched. In addition, you're keeping other information in metadata such as refresh dates
|
|
102
|
+
* for pulling updates from the server. The grouping and sorting block are optimized and use only the metadata.
|
|
103
|
+
* However this means that the metadata may change (due to a refresh date update),
|
|
104
|
+
* when in fact the object itself didn't change.
|
|
105
|
+
* So you could optimize a bit here by skipping some cell updates.
|
|
106
|
+
*
|
|
107
|
+
* if (change.type == YapDatabaseViewChangeUpdate)
|
|
108
|
+
* {
|
|
109
|
+
* if (change.modifiedColumns & YapDatabaseViewChangedObject) {
|
|
110
|
+
* // object changed, update cell
|
|
111
|
+
* }
|
|
112
|
+
* else {
|
|
113
|
+
* // only the metadata changed, so we can skip updating the cell
|
|
114
|
+
* }
|
|
115
|
+
* }
|
|
116
|
+
*
|
|
117
|
+
*
|
|
118
|
+
* @see YapDatabaseViewChangesBitMask
|
|
119
|
+
**/
|
|
120
|
+
@property (nonatomic, readonly) int changes;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* The indexPath & newIndexPath are available after
|
|
124
|
+
* you've invoked getSectionChanges:rowChanges:forNotifications:withMappings:.
|
|
125
|
+
*
|
|
126
|
+
* @see YapDatabaseConnection getSectionChanges:rowChanges:forNotifications:withMappings:
|
|
127
|
+
*
|
|
128
|
+
* These properties are designed to help facilitate animations to tableViews and collectionsViews.
|
|
129
|
+
*
|
|
130
|
+
* Recall that a view has no concept of sections.
|
|
131
|
+
* That is, a view has groups not sections.
|
|
132
|
+
* A group is a string, and a section is just a number.
|
|
133
|
+
*
|
|
134
|
+
* Using groups allows a view to be more dynamic.
|
|
135
|
+
* Your view may contain dozens of groups,
|
|
136
|
+
* but a particular tableView within your app may only display a subset of the groups.
|
|
137
|
+
*
|
|
138
|
+
* For example, you may have a view for displaying products in a grocery store.
|
|
139
|
+
* Each product is grouped by department (e.g. produce, deli, bakery), and sorted sorted by name.
|
|
140
|
+
* Using this view you can easily bring up a table view which displays only
|
|
141
|
+
* a few departments such as: liquor, wine, beer.
|
|
142
|
+
*
|
|
143
|
+
* In this example:
|
|
144
|
+
* - Section 0 = liquor
|
|
145
|
+
* - Section 1 = wine
|
|
146
|
+
* - Section 2 = beer
|
|
147
|
+
*
|
|
148
|
+
* NSArray *groups = @{ @"liquor":@(0), @"wine":@(1), @"beer":@(2) };
|
|
149
|
+
* YapDatabaseMappings *mappings = [YapDatabaseViewMappings mappingsWithGroups:groups view:@"order"];
|
|
150
|
+
*
|
|
151
|
+
* The mappings are then used to "map" between the 'groups in the view' and 'items in the table'.
|
|
152
|
+
*
|
|
153
|
+
* Mappings can provide a lot of additional functionality as well.
|
|
154
|
+
* For example, you can configure the mappings to only display a particular range within a group.
|
|
155
|
+
* This is similar to a LIMIT & OFFSET in SQL.
|
|
156
|
+
* This is the tip of the iceberg. See YapDatabaseViewMappings.h for more info.
|
|
157
|
+
*
|
|
158
|
+
* In order to animate changes to your tableView or collectionView, you eventually do something like this:
|
|
159
|
+
*
|
|
160
|
+
* NSArray *sectionChanges = nil;
|
|
161
|
+
* NSArray *rowChanges = nil;
|
|
162
|
+
* [databaseConnection getSectionChanges:§ionChanges
|
|
163
|
+
* rowChanges:&rowChanges
|
|
164
|
+
* forNotifications:notifications
|
|
165
|
+
* withMappings:mappings];
|
|
166
|
+
*
|
|
167
|
+
* This gives you a list of changes as they affect your tableView / collectionView.
|
|
168
|
+
*
|
|
169
|
+
* The indexPath and newIndexPath properties are modeled after:
|
|
170
|
+
* NSFetchedResultsControllerDelegate controller:didChangeObject:atIndexPath:forChangeType:newIndexPath:
|
|
171
|
+
*
|
|
172
|
+
* - indexPath represents the ORIGINAL indexPath for the row.
|
|
173
|
+
* It is non-nil for the following types : Delete, Move, Update.
|
|
174
|
+
* (And nil for insert since there was no original indexPath.)
|
|
175
|
+
*
|
|
176
|
+
* - newIndexPath represents the FINAL indexPath for the row.
|
|
177
|
+
* It is non-nil for the following types : Insert, Move.
|
|
178
|
+
* (And nil for delete since there is no final indexPath.)
|
|
179
|
+
* (And nil for update since that's how NSFetchedResultsController works,
|
|
180
|
+
* and thus how existing code might expect it to work.)
|
|
181
|
+
*
|
|
182
|
+
* Once you have the sectionChanges & rowChanges, you can animate your tableView very simply like so:
|
|
183
|
+
*
|
|
184
|
+
* PS - For a FULL CODE EXAMPLE, see the wiki:
|
|
185
|
+
* https://github.com/yaptv/YapDatabase/wiki/Views#wiki-animating_updates_in_tableviews_collectionviews
|
|
186
|
+
*
|
|
187
|
+
* if ([sectionChanges count] == 0 & [rowChanges count] == 0)
|
|
188
|
+
* {
|
|
189
|
+
* // Nothing has changed that affects our tableView
|
|
190
|
+
* return;
|
|
191
|
+
* }
|
|
192
|
+
*
|
|
193
|
+
* // Familiar with NSFetchedResultsController?
|
|
194
|
+
* // Then this should look pretty familiar
|
|
195
|
+
*
|
|
196
|
+
* [self.tableView beginUpdates];
|
|
197
|
+
*
|
|
198
|
+
* for (YapDatabaseViewSectionChange *sectionChange in sectionChanges)
|
|
199
|
+
* {
|
|
200
|
+
* switch (sectionChange.type)
|
|
201
|
+
* {
|
|
202
|
+
* case YapDatabaseViewChangeDelete :
|
|
203
|
+
* {
|
|
204
|
+
* [self.tableView deleteSections:[NSIndexSet indexSetWithIndex:sectionChange.index]
|
|
205
|
+
* withRowAnimation:UITableViewRowAnimationAutomatic];
|
|
206
|
+
* break;
|
|
207
|
+
* }
|
|
208
|
+
* case YapDatabaseViewChangeInsert :
|
|
209
|
+
* {
|
|
210
|
+
* [self.tableView insertSections:[NSIndexSet indexSetWithIndex:sectionChange.index]
|
|
211
|
+
* withRowAnimation:UITableViewRowAnimationAutomatic];
|
|
212
|
+
* break;
|
|
213
|
+
* }
|
|
214
|
+
* }
|
|
215
|
+
* }
|
|
216
|
+
*
|
|
217
|
+
* for (YapDatabaseViewRowChange *rowChange in rowChanges)
|
|
218
|
+
* {
|
|
219
|
+
* switch (rowChange.type)
|
|
220
|
+
* {
|
|
221
|
+
* case YapDatabaseViewChangeDelete :
|
|
222
|
+
* {
|
|
223
|
+
* [self.tableView deleteRowsAtIndexPaths:@[ rowChange.indexPath ]
|
|
224
|
+
* withRowAnimation:UITableViewRowAnimationAutomatic];
|
|
225
|
+
* break;
|
|
226
|
+
* }
|
|
227
|
+
* case YapDatabaseViewChangeInsert :
|
|
228
|
+
* {
|
|
229
|
+
* [self.tableView insertRowsAtIndexPaths:@[ rowChange.newIndexPath ]
|
|
230
|
+
* withRowAnimation:UITableViewRowAnimationAutomatic];
|
|
231
|
+
* break;
|
|
232
|
+
* }
|
|
233
|
+
* case YapDatabaseViewChangeMove :
|
|
234
|
+
* {
|
|
235
|
+
* [self.tableView deleteRowsAtIndexPaths:@[ rowChange.indexPath ]
|
|
236
|
+
* withRowAnimation:UITableViewRowAnimationAutomatic];
|
|
237
|
+
* [self.tableView insertRowsAtIndexPaths:@[ rowChange.newIndexPath ]
|
|
238
|
+
* withRowAnimation:UITableViewRowAnimationAutomatic];
|
|
239
|
+
* break;
|
|
240
|
+
* }
|
|
241
|
+
* case YapDatabaseViewChangeUpdate :
|
|
242
|
+
* {
|
|
243
|
+
* [self.tableView reloadRowsAtIndexPaths:@[ rowChange.indexPath ]
|
|
244
|
+
* withRowAnimation:UITableViewRowAnimationNone];
|
|
245
|
+
* break;
|
|
246
|
+
* }
|
|
247
|
+
* }
|
|
248
|
+
* }
|
|
249
|
+
*
|
|
250
|
+
* [self.tableView endUpdates];
|
|
251
|
+
**/
|
|
252
|
+
@property (nonatomic, readonly) NSIndexPath *indexPath;
|
|
253
|
+
@property (nonatomic, readonly) NSIndexPath *newIndexPath;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* The "original" values represent the location of the changed item
|
|
257
|
+
* at the BEGINNING of the read-write transaction(s).
|
|
258
|
+
*
|
|
259
|
+
* The "final" values represent the location of the changed item
|
|
260
|
+
* at the END of the read-write transaction(s).
|
|
261
|
+
**/
|
|
262
|
+
|
|
263
|
+
@property (nonatomic, readonly) NSUInteger originalIndex;
|
|
264
|
+
@property (nonatomic, readonly) NSUInteger finalIndex;
|
|
265
|
+
|
|
266
|
+
@property (nonatomic, readonly) NSUInteger originalSection;
|
|
267
|
+
@property (nonatomic, readonly) NSUInteger finalSection;
|
|
268
|
+
|
|
269
|
+
@property (nonatomic, readonly) NSString *originalGroup;
|
|
270
|
+
@property (nonatomic, readonly) NSString *finalGroup;
|
|
271
|
+
|
|
272
|
+
@end
|