model

package
v0.0.0-...-b88886d Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EtaNone = time.Time{}
)

Functions

func Allocate

func Allocate(batches []*Batch, line OrderLine) (string, error)

Types

type Batch

type Batch struct {
	Reference         string
	Sku               string
	PurchasedQuantity int
	Eta               time.Time
	Allocations       map[OrderLine]bool
}

func NewBatch

func NewBatch(ref, sku string, qty int, eta time.Time) *Batch

func (*Batch) Allocate

func (b *Batch) Allocate(line OrderLine)

func (Batch) AvailableQuantity

func (b Batch) AvailableQuantity() int

func (Batch) CanAllocate

func (b Batch) CanAllocate(line OrderLine) bool

func (*Batch) Deallocate

func (b *Batch) Deallocate(line OrderLine)

func (Batch) Equals

func (b Batch) Equals(other interface{}) bool

func (Batch) Hash

func (b Batch) Hash() string

type OrderLine

type OrderLine struct {
	OrderID  string
	Sku      string
	Quantity int
}

type OutOfStockErr

type OutOfStockErr struct {
	Sku string
}

func (*OutOfStockErr) Error

func (e *OutOfStockErr) Error() string

Jump to

Keyboard shortcuts

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