2015-10-27 20:59:15 +00:00
|
|
|
/* Copyright 2015 Realm Inc - All Rights Reserved
|
|
|
|
* Proprietary and Confidential
|
|
|
|
*/
|
2015-08-14 15:18:49 +00:00
|
|
|
|
2015-08-13 16:12:48 +00:00
|
|
|
'use strict';
|
|
|
|
|
2015-10-08 23:19:19 +00:00
|
|
|
var Realm = require('realm');
|
|
|
|
|
2015-10-14 21:58:42 +00:00
|
|
|
exports.TestObject = {
|
2015-10-30 19:08:31 +00:00
|
|
|
name: 'TestObject',
|
|
|
|
properties: {
|
|
|
|
doubleCol: Realm.Types.DOUBLE,
|
|
|
|
}
|
2015-08-13 16:12:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
function PersonObject() {}
|
|
|
|
PersonObject.prototype.schema = {
|
2015-10-30 19:08:31 +00:00
|
|
|
name: 'PersonObject',
|
|
|
|
properties: {
|
|
|
|
name: Realm.Types.STRING,
|
|
|
|
age: Realm.Types.DOUBLE,
|
|
|
|
married: {type: Realm.Types.BOOL, default: false},
|
|
|
|
}
|
2015-08-13 16:12:48 +00:00
|
|
|
};
|
|
|
|
PersonObject.prototype.description = function() {
|
|
|
|
return this.name + ' ' + this.age;
|
|
|
|
};
|
2015-10-02 21:57:54 +00:00
|
|
|
exports.PersonObject = PersonObject;
|
2015-08-13 16:12:48 +00:00
|
|
|
|
2015-10-14 21:58:42 +00:00
|
|
|
exports.BasicTypes = {
|
2015-08-13 16:12:48 +00:00
|
|
|
name: 'BasicTypesObject',
|
2015-10-30 19:08:31 +00:00
|
|
|
properties: {
|
|
|
|
boolCol: Realm.Types.BOOL,
|
|
|
|
intCol: Realm.Types.INT,
|
|
|
|
floatCol: Realm.Types.FLOAT,
|
|
|
|
doubleCol: Realm.Types.DOUBLE,
|
|
|
|
stringCol: Realm.Types.STRING,
|
|
|
|
dateCol: Realm.Types.DATE,
|
|
|
|
dataCol: Realm.Types.DATA,
|
|
|
|
}
|
2015-08-13 16:12:48 +00:00
|
|
|
};
|
|
|
|
|
2015-10-22 03:36:21 +00:00
|
|
|
exports.NullableBasicTypes = {
|
2015-10-27 17:04:56 +00:00
|
|
|
name: 'NullableBasicTypesObject',
|
2015-10-30 19:08:31 +00:00
|
|
|
properties: {
|
|
|
|
boolCol: {type: Realm.Types.BOOL, optional: true},
|
|
|
|
intCol: {type: Realm.Types.INT, optional: true},
|
|
|
|
floatCol: {type: Realm.Types.FLOAT, optional: true},
|
|
|
|
doubleCol: {type: Realm.Types.DOUBLE, optional: true},
|
|
|
|
stringCol: {type: Realm.Types.STRING, optional: true},
|
|
|
|
dateCol: {type: Realm.Types.DATE, optional: true},
|
|
|
|
dataCol: {type: Realm.Types.DATA, optional: true},
|
|
|
|
}
|
2015-10-22 03:36:21 +00:00
|
|
|
};
|
|
|
|
|
2015-10-14 21:58:42 +00:00
|
|
|
exports.LinkTypes = {
|
2015-08-13 16:12:48 +00:00
|
|
|
name: 'LinkTypesObject',
|
2015-10-30 19:08:31 +00:00
|
|
|
properties: {
|
|
|
|
objectCol: 'TestObject',
|
|
|
|
objectCol1: {type: Realm.Types.OBJECT, objectType: 'TestObject'},
|
|
|
|
arrayCol: {type: Realm.Types.LIST, objectType: 'TestObject'},
|
|
|
|
}
|
2015-08-13 16:12:48 +00:00
|
|
|
};
|
2015-09-03 21:05:56 +00:00
|
|
|
|
2015-10-14 21:58:42 +00:00
|
|
|
exports.IntPrimary = {
|
2015-10-30 19:08:31 +00:00
|
|
|
name: 'IntPrimaryObject',
|
|
|
|
primaryKey: 'primaryCol',
|
|
|
|
properties: {
|
|
|
|
primaryCol: Realm.Types.INT,
|
|
|
|
valueCol: Realm.Types.STRING,
|
|
|
|
}
|
2015-09-03 21:05:56 +00:00
|
|
|
};
|
|
|
|
|
2015-10-14 21:58:42 +00:00
|
|
|
exports.AllTypes = {
|
2015-10-30 19:08:31 +00:00
|
|
|
name: 'AllTypesObject',
|
|
|
|
primaryKey: 'primaryCol',
|
|
|
|
properties: {
|
|
|
|
primaryCol: Realm.Types.STRING,
|
|
|
|
boolCol: Realm.Types.BOOL,
|
|
|
|
intCol: Realm.Types.INT,
|
|
|
|
floatCol: Realm.Types.FLOAT,
|
|
|
|
doubleCol: Realm.Types.DOUBLE,
|
|
|
|
stringCol: Realm.Types.STRING,
|
|
|
|
dateCol: Realm.Types.DATE,
|
|
|
|
dataCol: Realm.Types.DATA,
|
|
|
|
objectCol: 'TestObject',
|
|
|
|
arrayCol: {type: Realm.Types.LIST, objectType: 'TestObject'},
|
|
|
|
}
|
2015-09-04 19:41:17 +00:00
|
|
|
};
|
|
|
|
|
2015-10-14 21:58:42 +00:00
|
|
|
exports.DefaultValues = {
|
2015-10-30 19:08:31 +00:00
|
|
|
name: 'DefaultValuesObject',
|
|
|
|
properties: {
|
|
|
|
boolCol: {type: Realm.Types.BOOL, default: true},
|
|
|
|
intCol: {type: Realm.Types.INT, default: -1},
|
|
|
|
floatCol: {type: Realm.Types.FLOAT, default: -1.1},
|
|
|
|
doubleCol: {type: Realm.Types.DOUBLE, default: -1.11},
|
|
|
|
stringCol: {type: Realm.Types.STRING, default: 'defaultString'},
|
|
|
|
dateCol: {type: Realm.Types.DATE, default: new Date(1.111)},
|
|
|
|
dataCol: {type: Realm.Types.DATA, default: new ArrayBuffer(1)},
|
2015-11-02 20:02:53 +00:00
|
|
|
objectCol: {type: 'TestObject', default: {doubleCol: 1}},
|
2015-10-30 19:08:31 +00:00
|
|
|
nullObjectCol: {type: 'TestObject', default: null},
|
2015-11-02 20:02:53 +00:00
|
|
|
arrayCol: {type: Realm.Types.LIST, objectType: 'TestObject', default: [{doubleCol: 2}]},
|
2015-10-30 19:08:31 +00:00
|
|
|
}
|
2015-09-04 22:43:26 +00:00
|
|
|
};
|
2015-11-16 23:05:50 +00:00
|
|
|
|
|
|
|
exports.QueryObject = {
|
|
|
|
name: 'QueryObject',
|
|
|
|
properties: [
|
|
|
|
{name: 'bool1', type: Realm.Types.BOOL},
|
|
|
|
{name: 'bool2', type: Realm.Types.BOOL},
|
|
|
|
{name: 'int1', type: Realm.Types.INT},
|
|
|
|
{name: 'int2', type: Realm.Types.INT},
|
|
|
|
{name: 'float1', type: Realm.Types.FLOAT},
|
|
|
|
{name: 'float2', type: Realm.Types.FLOAT},
|
|
|
|
{name: 'double1', type: Realm.Types.DOUBLE},
|
|
|
|
{name: 'double2', type: Realm.Types.DOUBLE},
|
|
|
|
{name: 'string1', type: Realm.Types.STRING},
|
|
|
|
{name: 'string2', type: Realm.Types.STRING},
|
|
|
|
]
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.NullQueryObject = {
|
|
|
|
name: 'NullQueryObject',
|
|
|
|
properties: [
|
|
|
|
{name: 'bool1', type: Realm.Types.BOOL},
|
|
|
|
{name: 'bool2', type: Realm.Types.BOOL},
|
|
|
|
{name: 'int1', type: Realm.Types.INT},
|
|
|
|
{name: 'int2', type: Realm.Types.INT},
|
|
|
|
{name: 'float1', type: Realm.Types.FLOAT},
|
|
|
|
{name: 'float2', type: Realm.Types.FLOAT},
|
|
|
|
{name: 'double1', type: Realm.Types.DOUBLE},
|
|
|
|
{name: 'double2', type: Realm.Types.DOUBLE},
|
|
|
|
{name: 'string1', type: Realm.Types.STRING},
|
|
|
|
{name: 'string2', type: Realm.Types.STRING},
|
|
|
|
]
|
|
|
|
};
|