40
loading...
This website collects cookies to deliver better user experience
Farm
entity may house many Bull
entities and one Bull
entity can only stay in one Farm
entity at a time. This relationship can be written in the following made-up Bull Schema Language:// Bull Schema Language ( BS Language )
entity Bull {
id: String
name: String
}
entity Farm {
id: String
name: String
bulls: Bull[] // An array of Bulls
}
query {
bull(id: ID!): Bull
farm(id: ID!): Farm
}
type Bull {
id: ID!
name: String!
}
type Farm {
id: ID!
name: String!
bulls: [Bull!]!
}
Common use case | Browser/Mobile to Server/s communication |
Clients | Relay, Apollo Client, urql, and more |
Servers | Apollo Server, gqlgen, Nexus, and more |
service FarmingApi {
rpc GetBull(GetBullRequest) returns (Bull);
rpc GetFarm(GetFarmRequest) returns (Farm);
}
message Bull {
string id = 1;
string name = 2;
}
message GetBullRequest {
string id = 1;
}
message Farm {
string id = 1;
string name = 2;
repeated Bull bulls = 3;
}
message GetFarmRequest {
string id = 1;
}
Common use case | Server to server communication |
Clients | Automatically generated for different languages |
Servers | Automatically generated for different languages |
datasource db {
provider = "mysql"
url = env("PRISMA_DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
model Bull {
id String @id @default(uuid())
name String
farm Farm
farmId String
}
model Farm {
id String @id @default(uuid())
name String
bulls Bull[]
}
Common use case | Server to database communication |
Clients | TypeScript Prisma Client, Go Prisma Client |
Supported databases | PostgreSQL, MySQL and SQLite ( as of July 2021 ) |