withReturning: async (model, builder, data, where) => {
if (config.provider !== "mysql") {
const c = await builder.returning();
return c[0];
}
await builder.execute();
const schemaModel = getSchema(model);
const builderVal = builder.config?.values;
if (where?.length) {
const clause = convertWhereClause(where, model);
const res = await db.select().from(schemaModel).where(...clause);
return res[0];
} else if (builderVal) {
const tId = builderVal[0]?.id.value;
const res = await db.select().from(schemaModel).where(drizzleOrm.eq(schemaModel.id, tId));
return res[0];
} else if (data.id) {
const res = await db.select().from(schemaModel).where(drizzleOrm.eq(schemaModel.id, data.id));
return res[0];
}
},
withReturning: async (model, builder, data, where) => {
if (config.provider !== "mysql") {
const c = await builder.returning();
return c[0];
}
await builder.execute();
const schemaModel = getSchema(model);
const builderVal = builder.config?.values;
if (where?.length) {
const clause = convertWhereClause(where, model);
const res = await db.select().from(schemaModel).where(...clause);
return res[0];
} else if (builderVal) {
const tId = builderVal[0]?.id.value;
const res = await db.select().from(schemaModel).where(drizzleOrm.eq(schemaModel.id, tId));
return res[0];
} else if (data.id) {
const res = await db.select().from(schemaModel).where(drizzleOrm.eq(schemaModel.id, data.id));
return res[0];
}
},