Fixed bug in resolver array conversion that caused results to all be copied of the last element.

This commit is contained in:
2019-05-21 19:35:11 +02:00
parent 015bdfd2e8
commit 2fb391321e
12 changed files with 28 additions and 28 deletions
+2 -2
View File
@@ -39,8 +39,8 @@ func (r *chapterResolver) Comments(ctx context.Context, chapter *models.Chapter,
}
comments2 := make([]*models.Comment, len(comments))
for i, comment := range comments {
comments2[i] = &comment
for i := range comments {
comments2[i] = &comments[i]
}
return comments2, nil
+4 -4
View File
@@ -32,8 +32,8 @@ func (r *logResolver) Characters(ctx context.Context, log *models.Log) ([]*model
}
characters2 := make([]*models.Character, len(characters))
for i, character := range characters {
characters2[i] = &character
for i := range characters {
characters2[i] = &characters[i]
}
return characters2, nil
@@ -46,8 +46,8 @@ func (r *logResolver) Posts(ctx context.Context, log *models.Log, kinds []string
}
posts2 := make([]*models.Post, len(posts))
for i, post := range posts {
posts2[i] = &post
for i := range posts {
posts2[i] = &posts[i]
}
return posts2, nil
+2 -2
View File
@@ -26,8 +26,8 @@ func (r *storyResolver) Chapters(ctx context.Context, story *models.Story) ([]*m
}
chapters2 := make([]*models.Chapter, len(chapters))
for i, chapter := range chapters {
chapters2[i] = &chapter
for i := range chapters {
chapters2[i] = &chapters[i]
}
return chapters2, nil