18 lines
583 B
Go
18 lines
583 B
Go
package constants
|
|||
|
|
|
||
|
|
// SellBy describes how a product's quantity is expressed on an order line.
|
||
|
|
type SellBy = string
|
||
|
|
|
||
|
|
const (
|
||
|
|
// SellByUnit is the default: the line counts discrete items (2 portions, 3 bottles).
|
||
|
|
SellByUnit SellBy = "unit"
|
||
|
|
// SellByWeight means the line carries a weighed amount. One weighing is one line,
|
||
|
|
// so quantity stays 1 and the measured value lives in order_items.weight.
|
||
|
|
SellByWeight SellBy = "weight"
|
||
|
|
)
|
||
|
|
|
||
|
|
// IsValidSellBy reports whether s is a supported sell_by value.
|
||
|
|
func IsValidSellBy(s string) bool {
|
||
|
|
return s == SellByUnit || s == SellByWeight
|
||
|
|
}
|