本文整理汇总了TypeScript中@orbit/data.serializeRecordIdentity函数的典型用法代码示例。如果您正苦于以下问题:TypeScript serializeRecordIdentity函数的具体用法?TypeScript serializeRecordIdentity怎么用?TypeScript serializeRecordIdentity使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了serializeRecordIdentity函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: _serializeInverseRelationshipIdentity
protected _serializeInverseRelationshipIdentity(
ri: RecordRelationshipIdentity
): string {
return [
serializeRecordIdentity(ri.record),
ri.relationship,
serializeRecordIdentity(ri.relatedRecord)
].join('::');
}
示例2: _toInverseRelationshipForIDB
protected _toInverseRelationshipForIDB(
ri: RecordRelationshipIdentity
): InverseRelationshipForIDB {
return {
id: this._serializeInverseRelationshipIdentity(ri),
recordIdentity: serializeRecordIdentity(ri.record),
relationship: ri.relationship,
relatedIdentity: serializeRecordIdentity(ri.relatedRecord),
type: ri.record.type,
relatedType: ri.relatedRecord.type
};
}
示例3: Promise
return new Promise((resolve, reject) => {
const transaction = this._db.transaction([INVERSE_RELS]);
const objectStore = transaction.objectStore(INVERSE_RELS);
const results: RecordRelationshipIdentity[] = [];
const keyRange = Orbit.globals.IDBKeyRange.only(
serializeRecordIdentity(recordIdentity)
);
const request = objectStore.index('recordIdentity').openCursor(keyRange);
request.onerror = function(/* event */) {
// console.error('error - getRecords', request.error);
reject(request.error);
};
request.onsuccess = (event: any) => {
// console.log('success - getInverseRelationshipsAsync', request.result);
const cursor = event.target.result;
if (cursor) {
let result = this._fromInverseRelationshipForIDB(cursor.value);
results.push(result);
cursor.continue();
} else {
resolve(results);
}
};
});
示例4: _materialize
protected _materialize(identity: RecordIdentity): RecordModel {
const identifier = serializeRecordIdentity(identity);
const record = this._factory.create(identity);
this._map[identifier] = record;
return record;
}
示例5: _materialized
protected _materialized(identity: RecordIdentity) {
if (!identity) {
return;
}
const identifier = serializeRecordIdentity(identity);
return this._map[identifier];
}
示例6: evict
evict(identity: RecordIdentity) {
const record = this._materialized(identity);
if (record) {
const identifier = serializeRecordIdentity(identity);
delete this._map[identifier];
this._factory.disconnect(record);
}
}
示例7: serialize
serialize(identity: RecordIdentity): string {
return serializeRecordIdentity(identity);
}