RealmType -> Realm.Type
This commit is contained in:
parent
272b5c0508
commit
a7662af484
|
@ -797,6 +797,7 @@
|
|||
0277984E1BBB2F1000C96559 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "ReactExample" */ = {
|
||||
isa = XCConfigurationList;
|
||||
|
|
|
@ -21,14 +21,14 @@ var {
|
|||
var TodoItemSchema = {
|
||||
name: 'Todo',
|
||||
properties: [
|
||||
{name: 'text', type: RealmType.String},
|
||||
{name: 'text', type: Realm.Type.String},
|
||||
]
|
||||
};
|
||||
var TodoListSchmea = {
|
||||
name: 'TodoList',
|
||||
properties: [
|
||||
{name: 'name', type: RealmType.String},
|
||||
{name: 'items', type: RealmType.Array, objectType: 'Todo'}
|
||||
{name: 'name', type: Realm.Type.String},
|
||||
{name: 'items', type: Realm.Type.Array, objectType: 'Todo'}
|
||||
]
|
||||
};
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ JSClassRef RJSCreateWrapperClass(const char * name, JSObjectGetPropertyCallback
|
|||
return JSClassCreate(&classDefinition);
|
||||
}
|
||||
|
||||
void RJSRegisterGlobalClass(JSContextRef ctx, JSObjectRef globalObject, JSClassRef classRef, const char * name, JSValueRef *exception);
|
||||
JSObjectRef RJSRegisterGlobalClass(JSContextRef ctx, JSObjectRef globalObject, JSClassRef classRef, const char * name, JSValueRef *exception);
|
||||
|
||||
std::string RJSStringForJSString(JSStringRef jsString);
|
||||
std::string RJSValidatedStringForValue(JSContextRef ctx, JSValueRef value, const char * name = nullptr);
|
||||
|
|
|
@ -18,11 +18,12 @@
|
|||
|
||||
#import "RJSUtil.hpp"
|
||||
|
||||
void RJSRegisterGlobalClass(JSContextRef ctx, JSObjectRef globalObject, JSClassRef classRef, const char * name, JSValueRef *exception) {
|
||||
JSObjectRef RJSRegisterGlobalClass(JSContextRef ctx, JSObjectRef globalObject, JSClassRef classRef, const char * name, JSValueRef *exception) {
|
||||
JSObjectRef classObject = JSObjectMake(ctx, classRef, NULL);
|
||||
JSStringRef nameString = JSStringCreateWithUTF8CString(name);
|
||||
JSObjectSetProperty(ctx, globalObject, nameString, classObject, kJSPropertyAttributeNone, exception);
|
||||
JSStringRelease(nameString);
|
||||
return classObject;
|
||||
}
|
||||
|
||||
JSValueRef RJSMakeError(JSContextRef ctx, RJSException &exp) {
|
||||
|
|
|
@ -49,9 +49,13 @@ JSClassRef RJSRealmTypeClass() {
|
|||
JSValueRef exception = NULL;
|
||||
JSObjectRef globalObject = JSContextGetGlobalObject(ctx);
|
||||
|
||||
RJSRegisterGlobalClass(ctx, globalObject, RJSRealmConstructorClass(), "Realm", &exception);
|
||||
JSObjectRef globalRealmObject = RJSRegisterGlobalClass(ctx, globalObject, RJSRealmConstructorClass(), "Realm", &exception);
|
||||
JSObjectRef typesObject = JSObjectMake(ctx, RJSRealmTypeClass(), NULL);
|
||||
JSStringRef typeString = JSStringCreateWithUTF8CString("Type");
|
||||
JSObjectSetProperty(ctx, globalRealmObject, typeString, typesObject, kJSPropertyAttributeNone, &exception);
|
||||
JSStringRelease(typeString);
|
||||
|
||||
RJSRegisterGlobalClass(ctx, globalObject, RJSObjectClass(), "RealmObject", &exception);
|
||||
RJSRegisterGlobalClass(ctx, globalObject, RJSRealmTypeClass(), "RealmType", &exception);
|
||||
|
||||
assert(!exception);
|
||||
}
|
||||
|
|
|
@ -29,10 +29,10 @@ var ObjectTests = {
|
|||
|
||||
for (var i = 0; i < BasicTypesObjectSchema.properties.length; i++) {
|
||||
var prop = BasicTypesObjectSchema.properties[i];
|
||||
if (prop.type == RealmType.Float) {
|
||||
if (prop.type == Realm.Type.Float) {
|
||||
TestCase.assertEqualWithTolerance(object[prop.name], basicTypesValues[i], 0.000001);
|
||||
}
|
||||
else if (prop.type == RealmType.Date) {
|
||||
else if (prop.type == Realm.Type.Date) {
|
||||
TestCase.assertEqual(object[prop.name].getTime(), basicTypesValues[i].getTime());
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
var TestObjectSchema = {
|
||||
name: 'TestObject',
|
||||
properties: [
|
||||
{name: 'doubleCol', type: RealmType.Double},
|
||||
{name: 'doubleCol', type: Realm.Type.Double},
|
||||
]
|
||||
};
|
||||
|
||||
|
@ -29,8 +29,8 @@ function PersonObject() {}
|
|||
PersonObject.prototype.schema = {
|
||||
name: 'PersonObject',
|
||||
properties: [
|
||||
{name: 'name', type: RealmType.String},
|
||||
{name: 'age', type: RealmType.Double},
|
||||
{name: 'name', type: Realm.Type.String},
|
||||
{name: 'age', type: Realm.Type.Double},
|
||||
]
|
||||
};
|
||||
PersonObject.prototype.description = function() {
|
||||
|
@ -40,13 +40,13 @@ PersonObject.prototype.description = function() {
|
|||
var BasicTypesObjectSchema = {
|
||||
name: 'BasicTypesObject',
|
||||
properties: [
|
||||
{name: 'boolCol', type: RealmType.Bool},
|
||||
{name: 'intCol', type: RealmType.Int},
|
||||
{name: 'floatCol', type: RealmType.Float},
|
||||
{name: 'doubleCol', type: RealmType.Double},
|
||||
{name: 'stringCol', type: RealmType.String},
|
||||
{name: 'dateCol', type: RealmType.Date},
|
||||
{name: 'dataCol', type: RealmType.Data},
|
||||
{name: 'boolCol', type: Realm.Type.Bool},
|
||||
{name: 'intCol', type: Realm.Type.Int},
|
||||
{name: 'floatCol', type: Realm.Type.Float},
|
||||
{name: 'doubleCol', type: Realm.Type.Double},
|
||||
{name: 'stringCol', type: Realm.Type.String},
|
||||
{name: 'dateCol', type: Realm.Type.Date},
|
||||
{name: 'dataCol', type: Realm.Type.Data},
|
||||
]
|
||||
};
|
||||
|
||||
|
@ -54,8 +54,8 @@ var LinkTypesObjectSchema = {
|
|||
name: 'LinkTypesObject',
|
||||
properties: [
|
||||
{name: 'objectCol', type: 'TestObject'},
|
||||
{name: 'objectCol1', type: RealmType.Object, objectType: 'TestObject'},
|
||||
{name: 'arrayCol', type: RealmType.Array, objectType: 'TestObject'},
|
||||
{name: 'objectCol1', type: Realm.Type.Object, objectType: 'TestObject'},
|
||||
{name: 'arrayCol', type: Realm.Type.Array, objectType: 'TestObject'},
|
||||
]
|
||||
};
|
||||
|
||||
|
@ -63,8 +63,8 @@ var IntPrimaryObjectSchema = {
|
|||
name: 'IntPrimaryObject',
|
||||
primaryKey: 'primaryCol',
|
||||
properties: [
|
||||
{name: 'primaryCol', type: RealmType.Int},
|
||||
{name: 'valueCol', type: RealmType.String},
|
||||
{name: 'primaryCol', type: Realm.Type.Int},
|
||||
{name: 'valueCol', type: Realm.Type.String},
|
||||
]
|
||||
};
|
||||
|
||||
|
@ -72,32 +72,32 @@ var AllTypesObjectSchema = {
|
|||
name: 'AllTypesObject',
|
||||
primaryKey: 'primaryCol',
|
||||
properties: [
|
||||
{name: 'primaryCol',type: RealmType.String},
|
||||
{name: 'boolCol', type: RealmType.Bool},
|
||||
{name: 'intCol', type: RealmType.Int},
|
||||
{name: 'floatCol', type: RealmType.Float},
|
||||
{name: 'doubleCol', type: RealmType.Double},
|
||||
{name: 'stringCol', type: RealmType.String},
|
||||
{name: 'dateCol', type: RealmType.Date},
|
||||
{name: 'dataCol', type: RealmType.Data},
|
||||
{name: 'primaryCol',type: Realm.Type.String},
|
||||
{name: 'boolCol', type: Realm.Type.Bool},
|
||||
{name: 'intCol', type: Realm.Type.Int},
|
||||
{name: 'floatCol', type: Realm.Type.Float},
|
||||
{name: 'doubleCol', type: Realm.Type.Double},
|
||||
{name: 'stringCol', type: Realm.Type.String},
|
||||
{name: 'dateCol', type: Realm.Type.Date},
|
||||
{name: 'dataCol', type: Realm.Type.Data},
|
||||
{name: 'objectCol', type: 'TestObject'},
|
||||
{name: 'arrayCol', type: RealmType.Array, objectType: 'TestObject'},
|
||||
{name: 'arrayCol', type: Realm.Type.Array, objectType: 'TestObject'},
|
||||
]
|
||||
};
|
||||
|
||||
var DefaultValuesObjectSchema = {
|
||||
name: 'DefaultValuesObject',
|
||||
properties: [
|
||||
{name: 'boolCol', type: RealmType.Bool, default: true},
|
||||
{name: 'intCol', type: RealmType.Int, default: -1},
|
||||
{name: 'floatCol', type: RealmType.Float, default: -1.1},
|
||||
{name: 'doubleCol', type: RealmType.Double, default: -1.11},
|
||||
{name: 'stringCol', type: RealmType.String, default: 'defaultString'},
|
||||
{name: 'dateCol', type: RealmType.Date, default: new Date(1.111)},
|
||||
{name: 'dataCol', type: RealmType.Data, default: 'defaultData'},
|
||||
{name: 'boolCol', type: Realm.Type.Bool, default: true},
|
||||
{name: 'intCol', type: Realm.Type.Int, default: -1},
|
||||
{name: 'floatCol', type: Realm.Type.Float, default: -1.1},
|
||||
{name: 'doubleCol', type: Realm.Type.Double, default: -1.11},
|
||||
{name: 'stringCol', type: Realm.Type.String, default: 'defaultString'},
|
||||
{name: 'dateCol', type: Realm.Type.Date, default: new Date(1.111)},
|
||||
{name: 'dataCol', type: Realm.Type.Data, default: 'defaultData'},
|
||||
{name: 'objectCol', type: 'TestObject', default: [1]},
|
||||
{name: 'nullObjectCol', type: 'TestObject', default: null},
|
||||
{name: 'arrayCol', type: RealmType.Array, objectType: 'TestObject', default: [[2]]},
|
||||
{name: 'arrayCol', type: Realm.Type.Array, objectType: 'TestObject', default: [[2]]},
|
||||
]
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue