Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 石墨烯继电器中基于光标的分页_Python_Pagination_Graphql_Relay_Graphene Python - Fatal编程技术网

Python 石墨烯继电器中基于光标的分页

Python 石墨烯继电器中基于光标的分页,python,pagination,graphql,relay,graphene-python,Python,Pagination,Graphql,Relay,Graphene Python,我正在尝试为基于光标的基本分页编写一个模式。但是我无法从集合中获取数据,因为模式和解析器之间的链接没有正确发生。我是否可以获得使用石墨烯继电器的基于光标的分页的完整应用程序示例或指南 我尝试的模式是: class VehicleNode(graphene.Node): car = graphene.String() bike = graphene.String() class Meta: model = Vehicle int

我正在尝试为基于光标的基本分页编写一个模式。但是我无法从集合中获取数据,因为模式和解析器之间的链接没有正确发生。我是否可以获得使用石墨烯继电器的基于光标的分页的完整应用程序示例或指南

我尝试的模式是:

class VehicleNode(graphene.Node):
     car = graphene.String()
     bike = graphene.String()
    
    class Meta:
        model = Vehicle
        interfaces = (graphene.relay.Node,)  
        fields = "__all__"

class VehicleConnection(graphene.relay.Connection):
    class Meta:
        node = VehicleNode

class VehicleSchema(graphene.ObjectType):
    vehicles =  graphene.relay.ConnectionField(VehicleConnection)
它的解析程序:

class VehicleQueryResolver:

    def resolve_Vehicle(self, parent, info, **kwargs):
       return Vehicle.objects.all()
这就是我在main函数中定义模式和解析器的方式:

VehicleResolver = VehicleQueryResolver()
Vehicle = graphene.List(VehicleSchema, resolver = VehicleQueryResolver.resolve_Vehicle)
对它的查询:

query{
  Vehicle {
    vehicles(first:2){
      pageInfo{
        hasNextPage
        hasPreviousPage
        startCursor
        endCursor
      }
      edges{
        cursor
        node{
          id
          car
          bike
        }
      }
    }
  }
}