https://github.com/eWert-Online/prisma-client-reason
https://github.com/eWert-Online/prisma-client-reason
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/eWert-Online/prisma-client-reason
- Owner: eWert-Online
- Archived: true
- Created: 2020-05-12T18:10:02.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-03-26T16:59:38.000Z (almost 4 years ago)
- Last Synced: 2025-05-02T01:41:49.160Z (10 months ago)
- Language: TypeScript
- Size: 229 KB
- Stars: 6
- Watchers: 1
- Forks: 2
- Open Issues: 8
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
- awesome-list - prisma-client-reason - Online | 4 | (TypeScript)
README
# Prisma Client ReasonML
## Current Status
This is (for now) just a prototype.
**DO NOT** use this in production.
If you want to help out, don't hesitate to file an issue or even a pull request.
- [x] Basic generator setup
- [x] Instance
- [x] create new
- [x] connect
- [x] disconnect
- [ ] Enums
- [ ] Selecting subfields from action
- [ ] Model actions
- [ ] `Model.`findOne
- [x] `Model.`findMany
- [x] `Model.`create
- [ ] `Model.`update
- [ ] `Model.`updateMany
- [ ] `Model.`upsert
- [ ] `Model.`delete
- [ ] `Model.`deleteMany
- [ ] `Model.`count
- [x] Model type generation
- [x] `Model.`Select
- [x] `Model.`Include
- [x] `Model.`WhereInput
- [x] `Model.`WhereUniqueInput
- [x] `Model.`CreateInput
- [x] `Model.`UpdateInput
- [ ] Model relationships
- [ ] One to One
- [ ] One to Many
- [ ] Many to Many
- [ ] Probably a lot of other stuff
### Generator in schema.prisma
Everything shown below is required:
```prisma
generator reasonml {
provider = "./node_modules/prisma-client-reason/dist/generator.js"
output = "../generated/.prisma/client-reason"
name = "PrismaClient" // The name of the generated Module
}
```
### Creating a new Instance
```reason
let prisma = PrismaClient.make();
```
### Connection Handling
```reason
prisma->PrismaClient.connect;
prisma->PrismaClient.disconnect;
```
### Writing to the Database
#### PrismaClient.`Model`.create
```reason
open PrismaClient;
prisma->User.create(
~select=
User.Select.make(
~id=true,
~createdAt=true,
~username=true,
(),
),
~data=
User.CreateInput.make(
~lastname="Ewert",
~username="ewert",
(),
),
(),
);
```
#### PrismaClient.`Model`.findMany
```reason
open PrismaClient;
prisma->User.findMany(
~where=User.WhereInput.make(
~username="ewert",
(),
),
(),
);
```