mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-03-26 19:31:29 +01:00
objc keypath utilities
This commit is contained in:
@@ -42,6 +42,14 @@
|
|||||||
XCTAssertEqual(CSLocalStorageOptionsAllowSynchronousLightweightMigration, 4);
|
XCTAssertEqual(CSLocalStorageOptionsAllowSynchronousLightweightMigration, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)test_ThatKeyPaths_AreCorrect {
|
||||||
|
|
||||||
|
XCTAssertEqualObjects(CSKeyPath(TestEntity1, testNumber), @"testNumber");
|
||||||
|
XCTAssertEqualObjects(CSKeyPath(TestEntity1, testString), @"testString");
|
||||||
|
XCTAssertEqualObjects(CSKeyPathOperator(count, TestEntity1, testString), @"@count.testString");
|
||||||
|
XCTAssertEqualObjects(CSKeyPathOperator(max, TestEntity1, testNumber), @"@max.testNumber");
|
||||||
|
}
|
||||||
|
|
||||||
- (void)test_ThatFromClauses_BridgeCorrectly {
|
- (void)test_ThatFromClauses_BridgeCorrectly {
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -43,7 +43,25 @@
|
|||||||
#define CORESTORE_RETURNS_RETAINED __attribute__((ns_returns_retained))
|
#define CORESTORE_RETURNS_RETAINED __attribute__((ns_returns_retained))
|
||||||
|
|
||||||
|
|
||||||
// MARK: - CSFrom
|
#pragma mark - KeyPath Utilities
|
||||||
|
|
||||||
|
#define CSKeyPath(type, property) ({ \
|
||||||
|
type *_je_keypath_dummy __attribute__((unused)); \
|
||||||
|
typeof(_je_keypath_dummy.property) _je_keypath_dummy_property __attribute__((unused)); \
|
||||||
|
@#property; \
|
||||||
|
})
|
||||||
|
|
||||||
|
#define CSKeyPathOperator(operator, type, property) ({ \
|
||||||
|
type *_je_keypath_dummy __attribute__((unused)); \
|
||||||
|
typeof(_je_keypath_dummy.property) _je_keypath_dummy_property __attribute__((unused)); \
|
||||||
|
@"@" #operator "." #property; \
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
#pragma mark - Clauses
|
||||||
|
|
||||||
|
|
||||||
|
#pragma mark CSFrom
|
||||||
|
|
||||||
@class CSFrom;
|
@class CSFrom;
|
||||||
|
|
||||||
@@ -130,7 +148,7 @@ CORESTORE_EXTERN CORESTORE_OVERLOADABLE
|
|||||||
CSFrom *_Nonnull CSFromClass(Class _Nonnull entityClass, NSArray<id> *_Nonnull configurations) CORESTORE_RETURNS_RETAINED;
|
CSFrom *_Nonnull CSFromClass(Class _Nonnull entityClass, NSArray<id> *_Nonnull configurations) CORESTORE_RETURNS_RETAINED;
|
||||||
|
|
||||||
|
|
||||||
// MARK: - CSGroupBy
|
#pragma mark CSGroupBy
|
||||||
|
|
||||||
@class CSGroupBy;
|
@class CSGroupBy;
|
||||||
|
|
||||||
@@ -174,7 +192,7 @@ CORESTORE_EXTERN CORESTORE_OVERLOADABLE
|
|||||||
CSGroupBy *_Nonnull CSGroupByKeyPaths(NSArray<NSString *> *_Nonnull keyPaths) CORESTORE_RETURNS_RETAINED;
|
CSGroupBy *_Nonnull CSGroupByKeyPaths(NSArray<NSString *> *_Nonnull keyPaths) CORESTORE_RETURNS_RETAINED;
|
||||||
|
|
||||||
|
|
||||||
// MARK: - CSInto
|
#pragma mark CSInto
|
||||||
|
|
||||||
@class CSInto;
|
@class CSInto;
|
||||||
|
|
||||||
@@ -239,7 +257,7 @@ CORESTORE_OVERLOADABLE
|
|||||||
CSInto *_Nonnull CSIntoClass(Class _Nonnull entityClass, NSString *_Nonnull configuration) CORESTORE_RETURNS_RETAINED;
|
CSInto *_Nonnull CSIntoClass(Class _Nonnull entityClass, NSString *_Nonnull configuration) CORESTORE_RETURNS_RETAINED;
|
||||||
|
|
||||||
|
|
||||||
// MARK: - CSOrderBy
|
#pragma mark CSOrderBy
|
||||||
|
|
||||||
@class CSOrderBy;
|
@class CSOrderBy;
|
||||||
|
|
||||||
@@ -339,7 +357,7 @@ CORESTORE_EXTERN CORESTORE_OVERLOADABLE
|
|||||||
CSOrderBy *_Nonnull CSOrderByKeys(NSArray<NSSortDescriptor *> *_Nonnull sortDescriptors) CORESTORE_RETURNS_RETAINED;
|
CSOrderBy *_Nonnull CSOrderByKeys(NSArray<NSSortDescriptor *> *_Nonnull sortDescriptors) CORESTORE_RETURNS_RETAINED;
|
||||||
|
|
||||||
|
|
||||||
// MARK: - CSSelect
|
#pragma mark CSSelect
|
||||||
|
|
||||||
@class CSSelect;
|
@class CSSelect;
|
||||||
@class CSSelectTerm;
|
@class CSSelectTerm;
|
||||||
@@ -465,7 +483,7 @@ CORESTORE_EXTERN
|
|||||||
CSSelect *_Nonnull CSSelectObjectID() CORESTORE_RETURNS_RETAINED;
|
CSSelect *_Nonnull CSSelectObjectID() CORESTORE_RETURNS_RETAINED;
|
||||||
|
|
||||||
|
|
||||||
// MARK: - CSTweak
|
#pragma mark CSTweak
|
||||||
|
|
||||||
@class CSTweak;
|
@class CSTweak;
|
||||||
|
|
||||||
@@ -486,7 +504,7 @@ CORESTORE_EXTERN CORESTORE_OVERLOADABLE
|
|||||||
CSTweak *_Nonnull CSTweakRequest(void (^_Nonnull block)(NSFetchRequest *_Nonnull fetchRequest)) CORESTORE_RETURNS_RETAINED;
|
CSTweak *_Nonnull CSTweakRequest(void (^_Nonnull block)(NSFetchRequest *_Nonnull fetchRequest)) CORESTORE_RETURNS_RETAINED;
|
||||||
|
|
||||||
|
|
||||||
// MARK: - CSWhere
|
#pragma mark CSWhere
|
||||||
|
|
||||||
@class CSWhere;
|
@class CSWhere;
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,10 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// MARK: - CSFrom
|
|
||||||
|
#pragma mark - Clauses
|
||||||
|
|
||||||
|
#pragma mark CSFrom
|
||||||
|
|
||||||
CORESTORE_OVERLOADABLE
|
CORESTORE_OVERLOADABLE
|
||||||
CSFrom *_Nonnull CSFromClass(Class _Nonnull entityClass) CORESTORE_RETURNS_RETAINED {
|
CSFrom *_Nonnull CSFromClass(Class _Nonnull entityClass) CORESTORE_RETURNS_RETAINED {
|
||||||
@@ -70,7 +73,7 @@ CSFrom *_Nonnull CSFromClass(Class _Nonnull entityClass, NSArray<id> *_Nonnull c
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// MARK: - CSGroupBy
|
#pragma mark CSGroupBy
|
||||||
|
|
||||||
CSGroupBy *_Nonnull CSGroupByKeyPath(NSString *_Nonnull keyPath) CORESTORE_RETURNS_RETAINED {
|
CSGroupBy *_Nonnull CSGroupByKeyPath(NSString *_Nonnull keyPath) CORESTORE_RETURNS_RETAINED {
|
||||||
|
|
||||||
@@ -102,7 +105,7 @@ CSGroupBy *_Nonnull CSGroupByKeyPaths(NSArray<NSString *> *_Nonnull keyPaths) CO
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// MARK: - CSInto
|
#pragma mark CSInto
|
||||||
|
|
||||||
CORESTORE_OVERLOADABLE
|
CORESTORE_OVERLOADABLE
|
||||||
CSInto *_Nonnull CSIntoClass(Class _Nonnull entityClass) CORESTORE_RETURNS_RETAINED {
|
CSInto *_Nonnull CSIntoClass(Class _Nonnull entityClass) CORESTORE_RETURNS_RETAINED {
|
||||||
@@ -123,7 +126,7 @@ CSInto *_Nonnull CSIntoClass(Class _Nonnull entityClass, NSString *_Nonnull conf
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// MARK: - CSOrderBy
|
#pragma mark CSOrderBy
|
||||||
|
|
||||||
@class CSOrderBy;
|
@class CSOrderBy;
|
||||||
|
|
||||||
@@ -167,7 +170,7 @@ CSOrderBy *_Nonnull CSOrderByKeys(NSArray<NSSortDescriptor *> *_Nonnull sortDesc
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// MARK: - CSSelect
|
#pragma mark CSSelect
|
||||||
|
|
||||||
CSSelect *_Nonnull CSSelectNumber(CSSelectTerm *_Nonnull selectTerm) CORESTORE_RETURNS_RETAINED {
|
CSSelect *_Nonnull CSSelectNumber(CSSelectTerm *_Nonnull selectTerm) CORESTORE_RETURNS_RETAINED {
|
||||||
|
|
||||||
@@ -200,7 +203,7 @@ CSSelect *_Nonnull CSSelectObjectID() CORESTORE_RETURNS_RETAINED {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// MARK: - CSTweak
|
#pragma mark CSTweak
|
||||||
|
|
||||||
CORESTORE_OVERLOADABLE
|
CORESTORE_OVERLOADABLE
|
||||||
CSTweak *_Nonnull CSTweakRequest(void (^_Nonnull block)(NSFetchRequest *_Nonnull fetchRequest)) CORESTORE_RETURNS_RETAINED {
|
CSTweak *_Nonnull CSTweakRequest(void (^_Nonnull block)(NSFetchRequest *_Nonnull fetchRequest)) CORESTORE_RETURNS_RETAINED {
|
||||||
@@ -209,7 +212,7 @@ CSTweak *_Nonnull CSTweakRequest(void (^_Nonnull block)(NSFetchRequest *_Nonnull
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// MARK: - CSWhere
|
#pragma mark CSWhere
|
||||||
|
|
||||||
CSWhere *_Nonnull CSWhereValue(BOOL value) CORESTORE_RETURNS_RETAINED {
|
CSWhere *_Nonnull CSWhereValue(BOOL value) CORESTORE_RETURNS_RETAINED {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user