本文整理匯總了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);
}