Documentation / @ember-data/store / index / recordIdentifierFor
Function: recordIdentifierFor()
Call Signature
ts
function recordIdentifierFor<T>(record): ResourceKey<TypeFromInstance<T>>;Defined in: warp-drive-packages/core/declarations/store/-private/caches/instance-cache.d.ts:27
Retrieves the unique referentially-stable ResourceKey assigned to the given record instance.
js
import { recordIdentifierFor } from "@warp-drive/core";
// ... gain access to a record, for instance with peekRecord or findRecord
const record = store.peekRecord("user", "1");
// get the identifier for the record (see docs for ResourceKey)
const identifier = recordIdentifierFor(record);
// access the identifier's properties.
const { id, type, lid } = identifier;Type Parameters
T
T extends TypedRecordInstance
Parameters
record
T
a record instance previously obstained from the store.
Returns
ResourceKey<TypeFromInstance<T>>
Call Signature
ts
function recordIdentifierFor(record): ResourceKey;Defined in: warp-drive-packages/core/declarations/store/-private/caches/instance-cache.d.ts:28
Retrieves the unique referentially-stable ResourceKey assigned to the given record instance.
js
import { recordIdentifierFor } from "@warp-drive/core";
// ... gain access to a record, for instance with peekRecord or findRecord
const record = store.peekRecord("user", "1");
// get the identifier for the record (see docs for ResourceKey)
const identifier = recordIdentifierFor(record);
// access the identifier's properties.
const { id, type, lid } = identifier;Parameters
record
unknown
a record instance previously obstained from the store.