deleter_product

package
v1.1.69 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func DeleteProducts added in v1.1.61

func DeleteProducts(sapi *api.TokopediaApi, datas []*model.SellerProductItem) error

func IterateProduct

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

func NewReport added in v1.1.61

func NewReport() chan *DeleteReportItem

func SaveDeleteConfig

func SaveDeleteConfig(fname string, cfg *DeleteConfig) error

func SaveReport added in v1.1.61

func SaveReport(fname string, reports []*DeleteReportItem) 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 DeleteReportItem added in v1.1.61

type DeleteReportItem struct {
	Username string              `csv:"username"`
	Judul    string              `csv:"judul"`
	Url      string              `csv:"url"`
	Status   model.ProductStatus `csv:"status"`
	Reason   string              `csv:"reason"`
}

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(fname string)

func (*DeleteRunner) RunDeleteAkun

func (runner *DeleteRunner) RunDeleteAkun(akun *AkunDeleteItem, reports chan *DeleteReportItem) error

type FilterHandler

type FilterHandler func(product *model.SellerProductItem) bool

type IterateFilter added in v1.1.61

type IterateFilter struct {
	CategoryID string
	Page       int
	PageSize   int
	Status     model.ProductStatus
}

func (*IterateFilter) GetFilters added in v1.1.61

func (f *IterateFilter) GetFilters() []model.Filter

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