iterator

package
v1.1.41 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BatchShopCore added in v1.1.32

func BatchShopCore[T ShopCoreItem](
	ctxErr *ContextError,
	itemsChan <-chan []T,
	limitTask int,
	limitChan int,
	api *api_public.TokopediaApiPublic,
) (<-chan []T, error)

func BatchShopStatistic added in v1.1.32

func BatchShopStatistic[T ShopCoreItem](
	ctxErr *ContextError,
	itemsChan <-chan []T,
	limitTask int,
	limitChan int,
	api *api_public.TokopediaApiPublic,
) (<-chan []T, error)

func GetBatchLayout added in v1.1.31

func GetBatchLayout(
	api *api_public.TokopediaApiPublic,
	ctx context.Context,
	urls []string,
	handler BatchLayoutHandler,
) (err error)

deprecated

func IterateCategoryCsv

func IterateCategoryCsv(base *legacy_source.BaseConfig, handler CategoryCsvHandler) error

func IterateKeywords

func IterateKeywords(fname string, handler KeywordHandler) error

func IterateProductShopPage

func IterateProductShopPage(
	api *api_public.TokopediaApiPublic,
	ctx context.Context,
	searchVar *model_public.ShopProductVar,
	handler ProductShopHandler,
) error

func IterateSearchPage

func IterateSearchPage(
	cfg *IterateConfig,
	api *api_public.TokopediaApiPublic,
	ctx context.Context,
	searchVar *model_public.SearchProductVar,
	handler SearchPageHandler,
) error

deprecated

func IterateShops

func IterateShops(api *api_public.TokopediaApiPublic, fname string, handler ShopHandler) error

func IterateUrls

func IterateUrls(fname string, handler UrlHandler) error

func V2GetBatchLayout added in v1.1.31

func V2GetBatchLayout(
	searchItem <-chan []*model_public.ProductSearch,
	limit int,
	taskcount int,
	ctxErr *ContextError,
	api *api_public.TokopediaApiPublic,
) (<-chan *model_public.PdpGetlayoutQueryResp, error)

func V2IterateSearchPage added in v1.1.31

func V2IterateSearchPage(
	ctxErr *ContextError,
	chunkSize int,
	api *api_public.TokopediaApiPublic,
	searchVar *model_public.SearchProductVar,
) (<-chan []*model_public.ProductSearch, error)

Types

type BatchLayoutHandler

type BatchLayoutHandler func(layout *model_public.PdpGetlayoutQueryResp) error

type CategoryCsvHandler

type CategoryCsvHandler func(item *csv.CategoryCsv) error

type ContextError added in v1.1.31

type ContextError struct {
	Ctx    context.Context
	Err    error
	Cancel context.CancelFunc
}

func NewContextError added in v1.1.31

func NewContextError() *ContextError

func (*ContextError) SendError added in v1.1.31

func (ctx *ContextError) SendError(err error)

type IterateConfig added in v1.1.31

type IterateConfig struct {
	ChuckSize      int
	ConcurentGuard chan int
}

type KeywordHandler

type KeywordHandler func(item string) error

type ProductShopHandler

type ProductShopHandler func(items []*model_public.ShopProductData) error

type SearchPageHandler

type SearchPageHandler func(items []*model_public.ProductSearch) error

type ShopCoreItem added in v1.1.32

type ShopCoreItem interface {
	GetShopUrl() string
	SetShopCore(data *model_public.ShopCoreInfoResp) error
	GetShopID() int
	SetStatistic(data *model_public.ShopStatisticQueryResp) error
}

type ShopHandler

type ShopHandler func(shopCore *model_public.ShopCoreInfoResp) error

type UrlHandler

type UrlHandler func(items []string) error

Jump to

Keyboard shortcuts

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