Skip to content

Instantly share code, notes, and snippets.

@B4nan
Created January 13, 2020 11:43
Show Gist options
  • Select an option

  • Save B4nan/fb04f5827d6e1f4aef0c7682a9c12cb6 to your computer and use it in GitHub Desktop.

Select an option

Save B4nan/fb04f5827d6e1f4aef0c7682a9c12cb6 to your computer and use it in GitHub Desktop.
MikroORM 3: entity definition
@Entity()
export class User implements IdEntity<User> {
@PrimaryKey()
id!: number;
@Property()
name!: string;
@OneToOne()
address?: Address;
@ManyToMany()
cars = new Collection<Car>(this);
constructor(name: string) {
this.name = name;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment