medz / prisma-dart

Prisma Client Dart is an auto-generated type-safe ORM. It uses Prisma Engine as the data access layer and is as consistent as possible with the Prisma Client JS/TS APIs.
https://prisma.pub
BSD 3-Clause "New" or "Revised" License
436 stars 29 forks source link

feat(client): Support `$extends` feature #394

Open nestharus opened 3 weeks ago

nestharus commented 3 weeks ago

This feature doesn't appear to be present.

https://www.prisma.io/docs/orm/prisma-client/client-extensions#about-prisma-client-extensions

Feature from 4.16 onwards.

medz commented 3 weeks ago

@nestharus I don't have much plan to implement it in Dart 3.x. Once $extends is implemented in Prisma Dart, it will become a counterexample that API consistency cannot be guaranteed.

The premise that $extends appears in Prisma Client is that TS/JS do not have a good language-level mix. Prisma does not want users to write complex code to achieve type-safe extension functions.

Prisma uses TS type generates to achieve this, but it will never be possible in Dart. Using it in Dart is a counterexample.

Maybe in the future, when there is a better solution after the macro is officially launched, there is no breakthrough at the language level, or the design is incompatible, Prisma Dart will shelve some Prisma features indefinitely.