alfateam / orange-orm

The ultimate ORM for Node and Typescript
https://orange-orm.io
ISC License
624 stars 20 forks source link

[ENHANCEMENT]: support `enums` #100

Open Zer0xxxx opened 4 weeks ago

Zer0xxxx commented 4 weeks ago

Feature Description

Currently, enums are not supported in Orange ORM. As we discussed, it could relatively "easily" be implemented.

Related to: https://github.com/alfateam/orange-orm/discussions/96 (https://github.com/alfateam/orange-orm/discussions/96#discussioncomment-9638139)

Zer0xxxx commented 4 weeks ago

Btw, I think it should be typed also. Just calling a validation function on it will help to keep the enum safe at runtime, but not at compile time. :/

Likewise:

const wolfgang = await db.team.insert({
  'lang': '...', // * ... No IntelliSense?
  // * ...
});
lroal commented 4 weeks ago

Yes, of course 😊