deleter_product

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDeleteLimitExcedeed = errors.New("delete limit excedeed")

Functions

func IterateProduct

func IterateProduct(sellerapi *api.TokopediaApi, handleItem func(page int, product *model.SellerProductItem, delete func() int) error, filters ...model.Filter) error

func SaveDeleteConfig

func SaveDeleteConfig(fname string, cfg *DeleteConfig) error

Types

type AkunDeleteItem

type AkunDeleteItem struct {
	Username string `json:"username"`
	Password string `json:"password"`
	Secret   string `json:"secret"`
}

type DeleteConfig

type DeleteConfig struct {
	LimitConcurent int                 `json:"limit_concurent"`
	LimitProduct   int                 `json:"limit_product"`
	Title          []string            `json:"title"`
	StatusProduct  model.ProductStatus `json:"product_status"`
	CategoryID     string              `json:"category_id"`
	StartTime      int64               `json:"start_time"`
	EndTime        int64               `json:"end_time"`
	TStartTime     time.Time           `json:"-"`
	TEndTime       time.Time           `json:"-"`
	Akuns          []*AkunDeleteItem   `json:"akuns"`
	SoldFilter     *SoldConfig         `json:"sold_filter,omitempty"`
	ViewFilter     *ViewConfig         `json:"view_filter,omitempty"`
}

func NewDeleteConfig

func NewDeleteConfig(fname string) (*DeleteConfig, error)

func (*DeleteConfig) GenerateFilter

func (cfg *DeleteConfig) GenerateFilter() func(product *model.SellerProductItem) (bool, string)

func (*DeleteConfig) GenerateFilterTime

func (cfg *DeleteConfig) GenerateFilterTime() FilterHandler

func (*DeleteConfig) GenerateFilterTitle

func (cfg *DeleteConfig) GenerateFilterTitle() FilterHandler

func (*DeleteConfig) UnmarshalJSON

func (cfg *DeleteConfig) UnmarshalJSON(data []byte) error

type DeleteRunner

type DeleteRunner struct {
	Config *DeleteConfig
	// contains filtered or unexported fields
}

func NewDeleteRunner

func NewDeleteRunner(cfg *DeleteConfig) *DeleteRunner

func (*DeleteRunner) Run

func (runner *DeleteRunner) Run()

func (*DeleteRunner) RunDeleteAkun

func (runner *DeleteRunner) RunDeleteAkun(akun *AkunDeleteItem) error

func (*DeleteRunner) RunDeleteViolation added in v1.0.2

func (runner *DeleteRunner) RunDeleteViolation(sapi *api.TokopediaApi) error

type ErrorHandler

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

func NewErrorHandler

func NewErrorHandler(ctx context.Context) *ErrorHandler

func (*ErrorHandler) Error

func (erh *ErrorHandler) Error() error

func (*ErrorHandler) SetError

func (erh *ErrorHandler) SetError(err error)

type FilterHandler

type FilterHandler func(product *model.SellerProductItem) bool

type SoldConfig

type SoldConfig struct {
	Min int `json:"min"`
	Max int `json:"max"`
}

func (*SoldConfig) GenerateFilter

func (soldf *SoldConfig) GenerateFilter() FilterHandler

type ViewConfig

type ViewConfig struct {
	Min int `json:"min"`
	Max int `json:"max"`
}

func (*ViewConfig) GenerateFilter

func (view *ViewConfig) GenerateFilter() FilterHandler

Jump to

Keyboard shortcuts

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