Skip to content

Instantly share code, notes, and snippets.

@verenion
verenion / page_example.rb
Created June 19, 2024 13:46 — forked from rmosolgo/page_example.rb
Generic page number / per-page pagination with GraphQL-Ruby
# This is a full-blown offset-based pagination system modelled after GraphQL-Ruby's
# built-in connections. It has a few different elements:
#
# - `::Page`, a plain ol' Ruby class for modeling _pages_ of things.
# This class handles applying pagination arguments to lists (Arrays and AR::Relations)
# and provides metadata about pagination. (Similar to `will_paginate`.)
# - `Schema::BasePage` is a generic GraphQL-Ruby object type. It's never used directly,
# but it can generate subclasses which wrap _specific_ object types in the schema.
# - `Schema::BaseObject.page_type` is a convenience method for generating page types
# from your object types. You could leave this out and make subclasses with plain ol'
2023-08-02T19:15:02.360+0100 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2023-08-02T19:15:02.390+0100 [ERROR] vertex "cloudflare_access_group.example" error: Unsupported argument
...
│ Error: Unsupported argument
│ on cloudflare-tunnel.tf line 35, in resource "cloudflare_access_group" "example":
grwtg4eg
esg
re
g
re
sg
resgr