package queries import ( "context" "git.aiterp.net/rpdata/api/graphql/resolver/types" "git.aiterp.net/rpdata/api/model/log" ) // PostsArgs is args for the posts query type PostsArgs struct { IDs []string } // Posts resolves the posts query func (r *QueryResolver) Posts(ctx context.Context, args *PostsArgs) ([]*types.PostResolver, error) { posts, err := log.ListPostIDs(args.IDs...) if err != nil { return nil, err } resolvers := make([]*types.PostResolver, len(posts)) for i := range resolvers { resolvers[i] = &types.PostResolver{P: posts[i]} } return resolvers, nil }