drivers

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrStopPagination = errors.New("stop pagination")

Functions

func ShouldStop

func ShouldStop(err error) bool

Types

type AsyncPaginationRawDriver

type AsyncPaginationRawDriver struct {
	// contains filtered or unexported fields
}

func NewAsyncPaginationRawDriver

func NewAsyncPaginationRawDriver(handler asyncPaginationRawHandler) *AsyncPaginationRawDriver

func (*AsyncPaginationRawDriver) OnBadResponse

func (d *AsyncPaginationRawDriver) OnBadResponse(resp *http.Response, err error)

func (*AsyncPaginationRawDriver) OnFinish

func (d *AsyncPaginationRawDriver) OnFinish(resp *http.Response, pageCount int) error

func (*AsyncPaginationRawDriver) OnNextRequest

func (d *AsyncPaginationRawDriver) OnNextRequest(request *http.Request, pageCount int) error

func (*AsyncPaginationRawDriver) OnNextResponse

func (d *AsyncPaginationRawDriver) OnNextResponse(resp *http.Response, nextRequest *http.Request, pageCount int) (err error)

type Driver

type Driver interface {
	OnNextRequest(request *http.Request, pageCount int) error
	OnNextResponse(resp *http.Response, nextRequest *http.Request, pageCount int) error
	OnFinish(resp *http.Response, pageCount int) error
	OnBadResponse(resp *http.Response, err error)
}

type GithubAsyncPaginationDriver

type GithubAsyncPaginationDriver[DataType any] struct {
	AsyncPaginationRawDriver
}

GithubAsyncPaginationDriver is a wrapper around the raw driver. it is used to translate the raw responses to go-github styled responses. both sliced and search responses are translated to searchresult.Typed, so that the interface is simpler and unified.

func NewGithubAsyncPaginationDriver

func NewGithubAsyncPaginationDriver[DataType any](handler githubAsyncPaginationHandler[DataType], isSearchResponse bool) *GithubAsyncPaginationDriver[DataType]

type SyncPaginationDriver

type SyncPaginationDriver struct {
	// contains filtered or unexported fields
}

func NewSyncPaginationDriver

func NewSyncPaginationDriver() *SyncPaginationDriver

func (*SyncPaginationDriver) OnBadResponse

func (d *SyncPaginationDriver) OnBadResponse(resp *http.Response, err error)

func (*SyncPaginationDriver) OnFinish

func (d *SyncPaginationDriver) OnFinish(resp *http.Response, pageCount int) error

func (*SyncPaginationDriver) OnNextRequest

func (d *SyncPaginationDriver) OnNextRequest(request *http.Request, pageCount int) error

func (*SyncPaginationDriver) OnNextResponse

func (d *SyncPaginationDriver) OnNextResponse(resp *http.Response, nextRequest *http.Request, pageCount int) error

Jump to

Keyboard shortcuts

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