我是GraphQL的新手。针对一个简单的使用案例,假设我有一个简单的模型:
class Post < ActiveRecord::Base
has_many :comments
end
以下是我在graphql query_type.rb中的代码:
PostType = GraphQL::ObjectType.define do
#field :comments, types[CommentType]
#connection :comments, CommentType.connection_type
end
在我看来,field
和connection
都可以使用。但哪个是正确的选择呢?