item

package
v0.0.0-...-522c4ea Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: Unlicense Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Import

func Import(a ImportArgs)

Types

type Batcher

type Batcher interface {
	Add(rec, headers []string) error
	Flush() error
}

type ChangeLogEntry

type ChangeLogEntry struct {
	ItemID string
	Update struct {
		Name    string `json:"name,omitempty"`
		Created int64  `json:"created,omitempty"`
		Status  Status `json:"status,omitempty"`
	} `json:"update,omitempty"`
	Insert *Item `json:"insert,omitempty"`
}

func CreateChangeLog

func CreateChangeLog(a CreateChangeLogArgs) (changeLog []*ChangeLogEntry)

type CreateChangeLogArgs

type CreateChangeLogArgs struct {
	ChangeLogFile  string
	DataDir        string
	FilenameFilter string
	BatchSize      int
	StartFrom      int
	MaxItems       int
	ForEachBatch   func(items []*Item) error
}

type ImportArgs

type ImportArgs struct {
	DataDir          string
	FilenameFilter   string
	MaxItemsToImport int
	Batcher          Batcher
}

type Item

type Item struct {
	ID         string `json:"id"`
	Name       string `json:"name"`
	Desc       string `json:"desc"`
	Status     Status `json:"status"`
	Created    int64  `json:"created"`
	CategoryID int    `json:"category_id"`
}

type ItemCondition

type ItemCondition int
const (
	ItemConditionLikeNew ItemCondition = iota + 1
	ItemConditionGood
	ItemConditionPoor
	ItemConditionOther
)

type ItemNoDesc

type ItemNoDesc struct {
	ID            string        `json:"id"`
	Name          string        `json:"name"`
	Status        Status        `json:"status"`
	Created       int64         `json:"created"`
	Updated       int64         `json:"updated"`
	CategoryID    int           `json:"category_id"`
	Price         int           `json:"price"`
	ItemCondition ItemCondition `json:"item_condition"`
}

type ItemsBatch

type ItemsBatch struct {
	Size         int
	Total        int
	Items        []*Item
	ForEachBatch func(totalItems int, items []*Item) error
}

func (*ItemsBatch) Add

func (b *ItemsBatch) Add(rec, headers []string) error

func (*ItemsBatch) Flush

func (b *ItemsBatch) Flush() error

type ItemsNoDescBatch

type ItemsNoDescBatch struct {
	Size         int
	Total        int
	Items        []*ItemNoDesc
	ForEachBatch func(totalItems int, items []*ItemNoDesc) error
}

func (*ItemsNoDescBatch) Add

func (b *ItemsNoDescBatch) Add(rec, headers []string) error

func (*ItemsNoDescBatch) Flush

func (b *ItemsNoDescBatch) Flush() error

type Status

type Status int
const (
	StatusOnSale Status = iota + 1
	StatusTrading
	StatusSold
	StatusStopped
	StatusCancel
	StatusOther
)

Jump to

Keyboard shortcuts

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