Skip to content

Documentation / @warp-drive/schema-record / fromIdentity

Call Signature

ts
function fromIdentity(
   record, 
   options, 
   key): string;

Defined in: schema.ts:114

A derivation that computes its value from the record's identity.

It can be used via a derived field definition like:

ts
{
  kind: 'derived',
  name: 'id',
  type: '@identity',
  options: { key: 'id' }
}

Valid keys are 'id', 'lid', 'type', and '^'.

^ returns the entire identifier object.

Parameters

record

SchemaRecord

options

{ key: "lid"; } | { key: "type"; }

key

string

Returns

string

Call Signature

ts
function fromIdentity(
   record, 
   options, 
   key): null | string;

Defined in: schema.ts:115

A derivation that computes its value from the record's identity.

It can be used via a derived field definition like:

ts
{
  kind: 'derived',
  name: 'id',
  type: '@identity',
  options: { key: 'id' }
}

Valid keys are 'id', 'lid', 'type', and '^'.

^ returns the entire identifier object.

Parameters

record

SchemaRecord

options

key

"id"

key

string

Returns

null | string

Call Signature

ts
function fromIdentity(
   record, 
   options, 
   key): StableRecordIdentifier;

Defined in: schema.ts:116

A derivation that computes its value from the record's identity.

It can be used via a derived field definition like:

ts
{
  kind: 'derived',
  name: 'id',
  type: '@identity',
  options: { key: 'id' }
}

Valid keys are 'id', 'lid', 'type', and '^'.

^ returns the entire identifier object.

Parameters

record

SchemaRecord

options

key

"^"

key

string

Returns

StableRecordIdentifier

Call Signature

ts
function fromIdentity(
   record, 
   options, 
   key): asserts options;

Defined in: schema.ts:117

A derivation that computes its value from the record's identity.

It can be used via a derived field definition like:

ts
{
  kind: 'derived',
  name: 'id',
  type: '@identity',
  options: { key: 'id' }
}

Valid keys are 'id', 'lid', 'type', and '^'.

^ returns the entire identifier object.

Parameters

record

SchemaRecord

options

null

key

string

Returns

asserts options

Released under the MIT License.