Basic entities
Basic entities
Section titled “Basic entities”The following are the steps to define a basic entity:
- Take any class and annotate it with the
@Entitydecorator. - Annotate one of its properties with the
@Iddecorator. - Annotate the rest of fields with the
@Fielddecorator.
import { v7 as uuidv7 } from 'uuid';import { Entity, Id, Field } from '@uql/core';
@Entity()export class User { @Id({ onInsert: uuidv7 }) id?: string;
@Field() name?: string;
@Field() email?: string;
@Field() password?: string;}