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
457 stars 31 forks source link

Prisma ORM for Dart 3.0 #68

Closed medz closed 1 year ago

medz commented 1 year ago

Due to the limitation of the Dart language, many functions of Prisma ORM for Dart cannot be realized, the most common ones are select, include.

There are many other problems:

  1. Codegen is too complex
  2. Difficult to add new features

The guesses for the v3 version are as follows:

  1. Give up type safety and use Map
  2. Give up building a private client and use Prisma DMMF to build a general client
  3. Abandon the binary engine (although it supports conventional platforms and architectures, but it is troublesome for serverless or Docker), and build a brand new engine suitable for Dart.
  4. For parameter input, use chain reaction to build
medz commented 1 year ago

For 3.0, there are the following technical requirements:

  1. Dart SDK requires 3.0 (better for copying Prisma TS/JS client)
  2. Looking for a better JSON serialization build Abandon the build_* ecological package from the project
  3. Provide a complete Prisma C API implementation, discarding the binary query engine
wstrange commented 1 year ago

It would be great to see the engine implemented in pure Dart, even if it only means supporting a subset of databases and features (postgres, sqllite?).

The binary engine makes packaging and distribution harder (can't just compile a pure dart server). I suspect it would make debugging easier as well (no binary interface to cross).

medz commented 1 year ago

It would be great to see the engine implemented in pure Dart, even if it only means supporting a subset of databases and features (postgres, sqllite?).

The binary engine makes packaging and distribution harder (can't just compile a pure dart server). I suspect it would make debugging easier as well (no binary interface to cross).

@wstrange Now the problem is, I'm an introductory Rust learner. I tried writing a dynamic engine library to make it behave better with the engine, but I couldn't solve the upstream breaking issue.

https://github.com/prisma/prisma-engines/issues/3757

This issue has already flagged how to fix the upstream breakage, and I think it will be a long time before that happens.

In addition, Dart3's macro support release date is undecided, and Union-Types does not know whether it will appear in Dart 3 within this year, because it is still making proposals.

Under the current limited conditions, I can only do the engine client based on maximizing parameter selection and cannot fully realize all the requirements of Prisma (unless I use Map)