paging

package
v2.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListAll

func ListAll[T any](ctx context.Context, listFunc func(ctx context.Context, pageNum int) (Response[T], *http.Response, error)) ([]T, error)

ListAll invokes the given pagination list function multiple times until the total count of responses is gathered. Once done, all paginated responses are returned. If an error occurs, the first error occurrence will be returned.

This is taken over from https://github.com/mongodb/terraform-provider-mongodbatlas/blob/a5581ebb274dbcaffd43d330c5bfbbb329cae51d/internal/common/dsschema/page_request.go#L14-L31.

Types

type Response

type Response[T any] interface {
	GetResults() []T
	GetTotalCount() int
}

Response is the paginated response containing the current page results and the total count. It is implemented by all supported SDK versions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL