페이지네이션 쿼리
다음 예제에서는 firstName, email, age와 같은 필드 및 관계를 포함하는 students라는 테이블이 있습니다.
쿼리에서 페이지네이션 사용
섹션 제목: “쿼리에서 페이지네이션 사용”skip 및 first 인수는 페이지네이션에 사용됩니다.
first는 결과 집합에서 전달할 행 수를 지정하고 skip은 결과에서 유지할 슬라이스를 결정합니다.
요청
query MyQuery1 { /** * First consider 0 as the starting slice of paginated records. As this * number is increased, the prior results leave out previously fetched * records. (i.e., skip 0 -> skip 3 -> skip 6 -> skip 9...) */ students(skip: 0, first: 3,) { items { id firstName email age } }}응답
{ "data": { "students": { "items": [ { "id": "287cff0a-345b-4cca-9e9a-75a2161238fd", "firstName": "James", "email": "james.smith@example.com", "age": 22 }, { "id": "97fb89ac-e0ad-44f5-b671-24a1b751287c", "firstName": "John", "email": "john.williams@example.com", "age": 23 }, { "id": "429cf99f-4481-49c4-adb4-605731b20eb2", "firstName": "Mary", "email": "mary.brown@example.com", "age": 24 } ] } }}