0
我不理解如何在石墨烯中的ConnectionField中使用自定義字段。我有類似:石墨烯中的自定義連接字段
class ShipConnection(Connection):
extra = String()
class Meta:
node = Ship
SHIPS = ['Tug boat', 'Row boat', 'Canoe']
class Query(AbstractType):
ships = relay.ConnectionField(ShipConnection)
def resolve_ships(self, args, context, info):
return ShipConnection(
extra='Some extra text',
edges=???
)
通常情況下,你會說:
def resolve_ships(self, args, context, info):
return SHIPS
但你如何返回額外東西,返回一個列表?