Prisma Go client to return slices of pointers to structs




Right now I am using gqlgen to generate my resolvers. The library now generates resolvers that expect to return a slice of pointers, but Prisma returns a slice of stucts. I am here to ask how do you think this should be solved. I think there should be an agreement on the from both libs as retyping it is pain in the butt, especially in Go without generics.

Here is an example of what I talk about:

func (r *cityResolver) Locations(ctx context.Context, obj *prisma.City, where *prisma.LocationWhereInput, orderBy *prisma.LocationOrderByInput, skip *int, after *string, before *string, first *int, last *int) ([]*prisma.Location, error) {

    results, err := r.Prisma.Locations(&prisma.LocationsParams{
        Where: where,
        OrderBy: orderBy,

    locations := make([]*prisma.Location, len(results))
    for i := range results {
       locations[i] = &results[i]

    return locations, err



Bump. Running into this same issue


You can mark the location elements to not be nil in your gqlgen schema. This will generate the resolver to return references instead of pointers.

type City {
  locations: [Location!]!


This is unfortunately not true anymore with gqlgen 0.9.0…