MCPcopy Index your code
hub / github.com/loopbackio/loopback-next / getId

Method getId

packages/repository/src/model.ts:467–480  ·  view source on GitHub ↗

* Get the identity value. If the identity is a composite key, returns * an object.

()

Source from the content-addressed store, hash-verified

465 * an object.
466 */
467 getId(): any {
468 const definition = (this.constructor as typeof Entity).definition;
469 const idProps = definition.idProperties();
470 if (idProps.length === 1) {
471 return (this as AnyObject)[idProps[0]];
472 }
473 if (!idProps.length) {
474 throw new Error(
475 `Invalid Entity ${this.constructor.name}:` +
476 'missing primary key (id) property',
477 );
478 }
479 return this.getIdObject();
480 }
481
482 /**
483 * Get the identity as an object, such as `{id: 1}` or

Callers 6

getIdOfMethod · 0.45
createMethod · 0.45
updateMethod · 0.45
deleteMethod · 0.45
model.unit.tsFile · 0.45

Implementers 1

SequelizeModelextensions/sequelize/src/sequelize/seq

Calls 2

getIdObjectMethod · 0.95
idPropertiesMethod · 0.80

Tested by

no test coverage detected