prisma-client-go icon indicating copy to clipboard operation
prisma-client-go copied to clipboard

Feature: Generate column placeholders for the Raw() API

Open matthewmueller opened this issue 5 years ago • 0 comments

Currently the columns in the Raw API are not type-safe

client.
Raw("SELECT * FROM User WHERE id = ? AND email = ?", "id2", "email2").
Exec(ctx, &actual) 

It'd be nice if you could do something this:

client.
Raw("SELECT * FROM " + users.Table + " WHERE " + users.ID + " = ? AND " + users.Email + " = ?", "id2", "email2").
Exec(ctx, &actual) 

This way if your tables or columns ever change, your Raw queries will break.

matthewmueller avatar May 11 '20 16:05 matthewmueller