package graph // This file is hand-written and is never regenerated by gqlgen — it is not // named after a schema file, so `gqlgen generate` leaves it alone. // ptrs copies a slice of values into a slice of pointers to those values. // // Every list query loads rows with Find(&xs) into a []T and then has to hand // gqlgen a []*T, because the schema returns lists of nullable objects. Taking // &xs[i] is safe: the slice is never appended to after this point, so the // backing array cannot move and the pointers stay valid. // // Loading straight into a []*T would avoid the copy but changes the query // GORM emits, so the copy is kept deliberately. func ptrs[T any](xs []T) []*T { result := make([]*T, len(xs)) for i := range xs { result[i] = &xs[i] } return result }