Documentation
¶
Index ¶
- type CursorConfig
- type CursorStrategy
- type GQLReader
- func NewStandardGQLReader(anySdkClient client.AnySdkClient, request *http.Request, httpPageLimit int, ...) (GQLReader, error)
- func NewStandardGQLReaderFull(anySdkClient client.AnySdkClient, request *http.Request, httpPageLimit int, ...) (GQLReader, error)
- func NewStandardGQLReaderWithCursor(anySdkClient client.AnySdkClient, request *http.Request, httpPageLimit int, ...) (GQLReader, error)
- func NewStandardGQLReaderWithTransform(anySdkClient client.AnySdkClient, request *http.Request, httpPageLimit int, ...) (GQLReader, error)
- type StandardGQLReader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CursorConfig ¶
type CursorConfig struct {
// Strategy selects the pagination shape. Empty == CursorStrategyAfter.
Strategy CursorStrategy
// JSONPath is the value-source path for the cursor. Required for
// cursor_after, keyset, and page_info; ignored for offset.
JSONPath string
// FormatTemplate is an optional Go text/template rendered into
// iterativeInput["cursor"] each iteration. Bindings depend on strategy:
// - cursor_after / offset / page_info: {{ .value }}
// - keyset: {{ .value }} when the JSON path
// resolves to a scalar; the
// object's fields by name when it
// resolves to a map
// When empty, strategy-specific defaults apply (see strategy docs).
FormatTemplate string
// TerminateOnJSONPath is the jsonpath inspected for a termination flag
// after each page. Only used by CursorStrategyPageInfo.
TerminateOnJSONPath string
// PageSize, when > 0, terminates CursorStrategyOffset early when a page
// returns fewer rows than this value. Ignored by other strategies.
PageSize int
}
CursorConfig configures a pagination strategy for StandardGQLReader. An empty Strategy defaults to CursorStrategyAfter, which is byte-identical to the pre-strategy behaviour.
type CursorStrategy ¶
type CursorStrategy string
CursorStrategy enumerates the pluggable pagination shapes supported by StandardGQLReader. The empty string is treated as CursorStrategyAfter to preserve back-compat with specs that predate this field.
const ( // CursorStrategyAfter is the default Relay-style ", after: \"<value>\"" // cursor splice. Termination is signalled by an empty/non-scalar cursor. CursorStrategyAfter CursorStrategy = "cursor_after" // CursorStrategyKeyset injects a filter comparator (typically "_gt") on // the last row's sort key. Used by Cloudflare GraphQL Analytics and // similar APIs that do not support cursors. Termination is signalled by // an empty response row array. CursorStrategyKeyset CursorStrategy = "keyset" // CursorStrategyOffset synthesises a running row count client-side and // substitutes it as ", offset: <count>". Termination is signalled by an // empty response row array (or a short page if PageSize is configured). CursorStrategyOffset CursorStrategy = "offset" // CursorStrategyPageInfo reads ", after: \"<endCursor>\"" from a // jsonpath but terminates on a separate boolean termination flag // (typically `pageInfo.hasNextPage`) — required for Relay-strict // endpoints where the cursor remains non-empty on the final page. CursorStrategyPageInfo CursorStrategy = "page_info" )
type GQLReader ¶
func NewStandardGQLReader ¶
func NewStandardGQLReader( anySdkClient client.AnySdkClient, request *http.Request, httpPageLimit int, baseQuery string, constInput map[string]interface{}, initialCursor string, responseJsonPath string, latestCursorJsonPath string, ) (GQLReader, error)
NewStandardGQLReader constructs a StandardGQLReader with the default CursorStrategyAfter strategy. Behaviour is identical to the pre-strategy reader.
func NewStandardGQLReaderFull ¶
func NewStandardGQLReaderFull( anySdkClient client.AnySdkClient, request *http.Request, httpPageLimit int, baseQuery string, constInput map[string]interface{}, initialCursor string, responseJsonPath string, cursor CursorConfig, transformType string, transformBody string, ) (GQLReader, error)
NewStandardGQLReaderFull is the most general constructor; the narrower constructors are thin wrappers around it.
func NewStandardGQLReaderWithCursor ¶
func NewStandardGQLReaderWithCursor( anySdkClient client.AnySdkClient, request *http.Request, httpPageLimit int, baseQuery string, constInput map[string]interface{}, initialCursor string, responseJsonPath string, cursor CursorConfig, ) (GQLReader, error)
NewStandardGQLReaderWithCursor constructs a StandardGQLReader using the supplied CursorConfig. Supplying CursorConfig{} (Strategy == "") yields the default cursor_after behaviour.
func NewStandardGQLReaderWithTransform ¶
func NewStandardGQLReaderWithTransform( anySdkClient client.AnySdkClient, request *http.Request, httpPageLimit int, baseQuery string, constInput map[string]interface{}, initialCursor string, responseJsonPath string, latestCursorJsonPath string, transformType string, transformBody string, ) (GQLReader, error)
NewStandardGQLReaderWithTransform constructs a StandardGQLReader that optionally applies a stream_transform template to the raw response body before the existing responseJsonPath / latestCursorJsonPath selection runs. Passing "" for both transformType and transformBody yields behavior identical to NewStandardGQLReader.
type StandardGQLReader ¶
type StandardGQLReader struct {
// contains filtered or unexported fields
}
func (*StandardGQLReader) Read ¶
func (gq *StandardGQLReader) Read() ([]map[string]interface{}, error)