Dylan Karten
09/30/2021, 6:51 PMDylan Karten
10/06/2021, 4:47 PMLEFT OUTER JOIN
?John Peña
10/07/2021, 7:34 PMJohn Peña
10/12/2021, 11:45 AMAhmet
10/19/2021, 10:09 AMAhmet
10/19/2021, 11:42 AMconst instance = await prisma.mutation.createInstance(
{
data: {
name: data.name.trim(),
expireDate,
owner: {
connect: {
id: userId,
},
},
accessToken: {
create: {
isActive: true,
token: getToken(),
},
},
charges: {
create: {
expireDate,
plan: 'STANDARD',
},
},
webhook: {
create: {
url: '',
httpOptions: {},
websocketOptions: {},
...
Go code: createdInstance, err := client.Instance.CreateOne(
db.Instance.Name.Set("Test Instance - 1"),
db.Instance.ExpireDate.Set(time.Now().Add(24*time.Hour*365)),
db.Instance.User.Link(
db.User.ID.Equals(user_id),
),
// Nested Create? (accessToken, charges, webhook)
).Exec(ctx)
if err != nil {
return err
}
Ahmet
10/19/2021, 11:43 AMLuca
10/20/2021, 9:17 AMmodel User {
id Int @id @default(autoincrement())
name String
pets String[]
}
You can filter pets with the following code:
user, err := client.User.FindFirst(
db.User.Pets.HasSome([]string{"Fido", "Scooby"}),
).Exec(ctx)
And when you add a new furry addition to your family, you can update your list with `Push`:
user, err := client.User.FindUnique(
db.User.Name.Equals(1),
).Update(
db.User.Items.Push([]string{"Charlemagne"}),
).Exec(ctx)
Learn more about how to use this new feature in our documentation and share your feedback here!Gavin Watson
11/09/2021, 7:28 PMTravis James
11/16/2021, 12:54 PMBarnaby
12/06/2021, 10:17 AMTimed out fetching a connection from the pool
is there something I'm missing from queries to get Prisma to release connections back to the pool?Hervé - Product at Prisma
01/17/2022, 11:17 AMJohn Peña
01/20/2022, 1:56 PMBarnaby
02/08/2022, 12:41 PMBarnaby
02/08/2022, 12:41 PMBryanM
02/08/2022, 5:53 PMRobert Craigie
02/10/2022, 3:30 AMTravis James
02/21/2022, 2:42 PMprisma-engines
to be loaded as a library (similar to what is done with the Node.js side) with a CGo interface, so there is no need for a second process.
2. Extend the Prisma Go SDK interface to include structure similar to Ent--creating hooks for business logic before and after CRUD actions, etc.
3. Provide a way to hook in authentication and authorization.
4. Integrate with GQLGen in a manner that allows for creating GraphQL interfaces that can be slightly different but mapped neatly to Prisma GraphQL interfaces.
If I were to get a group together to build such a thing (with people here and others), would Prisma support letting this project live, @Luca?Barnaby
02/22/2022, 8:04 PMBarnaby
02/22/2022, 8:04 PMBarnaby
02/22/2022, 8:05 PMBarnaby
03/12/2022, 11:34 AMBarnaby
03/12/2022, 11:37 AMimport { DMMF } from "@prisma/generator-helper";
import { getDMMF } from "@prisma/sdk";
const modelToGo = (model: DMMF.Model) => {
const { name, fields } = model;
// TODO: generate a list of fields
// TODO: generate a list of relationships
const fieldsString = "";
const edgesString = "";
const source = `
package schema
import "<http://entgo.io/ent|entgo.io/ent>"
// ${name} holds the schema definition for the ${name} entity.
type ${name} struct {
ent.Schema
}
// Fields of the ${name}.
func (${name}) Fields() []ent.Field {
return ${fieldsString}
}
// Edges of the ${name}.
func (${name}) Edges() []ent.Edge {
return ${edgesString}
}
`;
return {
source,
name,
};
};
(async () => {
const dmmf = await getDMMF({ datamodelPath: "prisma/schema.prisma" });
const models = dmmf.datamodel.models.map(modelToGo);
console.log(models);
// TODO: Dump models to ./ent/schema/{name}
// TODO: Invoke `go generate`
})();
Barnaby
03/12/2022, 11:38 AMBarnaby
03/12/2022, 11:38 AMBarnaby
03/12/2022, 12:28 PMVladi Stevanovic
Barnaby
04/04/2022, 7:18 PMDeepak Guptha S
08/10/2022, 9:51 AMGoLang
Or how to perform transaction for multiple records (insertion, updation or deletion) using executeRaw
Is there any examples or documentation link ?Vladi Stevanovic