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

Dart Wrapper for the Prisma Library #335

Open egyleader opened 4 months ago

egyleader commented 4 months ago

I wonder why there is no native dart package for using prisma orm in dart only environment instead of relying on node js to parse and generate the code , there is no lack of code generation capabilities in dart and using node js can be troublesome , for example :

Example Scenario :

using the current prisma node js / orm package combo in a dart_frog api works fine in local host but breaks once deployed to google cloud run as the generated docker file should contain extra steps for installing and configuring node js and prisma on the cloud environment , giving errors such as : Exception: No query engine binary found (prisma-query-engine) in [/, /prisma, /.dart_tool]

medz commented 4 months ago

This requires an FFI engine. At present, Prisma interacts with the code generator through json-rpc (the code generator is written by Dart). Because the current Dart package cannot contain binary files for the time being, if it is packaged, it will inevitably lose part of prism. The function of a cli increases the complexity of the code, and it also needs to make a code that does not find the dynamic download of the engine at the runtime stage. The maintainability will deteriorate, which is not conducive to following the upgrade of the prisma engine. So I've been waiting for priama's new c engine (in the experimental stage)