80 lines
981 B
Go
80 lines
981 B
Go
|
|
package order
|
||
|
|
|
||
|
|
type OrderStatus string
|
||
|
|
|
||
|
|
const (
|
||
|
|
New OrderStatus = "NEW"
|
||
|
|
Paid OrderStatus = "PAID"
|
||
|
|
Cancel OrderStatus = "CANCEL"
|
||
|
|
)
|
||
|
|
|
||
|
|
func (b OrderStatus) toString() string {
|
||
|
|
return string(b)
|
||
|
|
}
|
||
|
|
|
||
|
|
func (i *OrderStatus) IsNew() bool {
|
||
|
|
if i == nil {
|
||
|
|
return false
|
||
|
|
}
|
||
|
|
|
||
|
|
if *i == New {
|
||
|
|
return true
|
||
|
|
}
|
||
|
|
|
||
|
|
return false
|
||
|
|
}
|
||
|
|
|
||
|
|
type ItemType string
|
||
|
|
|
||
|
|
const (
|
||
|
|
Product ItemType = "PRODUCT"
|
||
|
|
Studio ItemType = "STUDIO"
|
||
|
|
)
|
||
|
|
|
||
|
|
func (b ItemType) toString() string {
|
||
|
|
return string(b)
|
||
|
|
}
|
||
|
|
|
||
|
|
func (i *ItemType) IsProduct() bool {
|
||
|
|
if i == nil {
|
||
|
|
return false
|
||
|
|
}
|
||
|
|
|
||
|
|
if *i == Product {
|
||
|
|
return true
|
||
|
|
}
|
||
|
|
|
||
|
|
return false
|
||
|
|
}
|
||
|
|
|
||
|
|
func (i *ItemType) IsStudio() bool {
|
||
|
|
if i == nil {
|
||
|
|
return false
|
||
|
|
}
|
||
|
|
|
||
|
|
if *i == Studio {
|
||
|
|
return true
|
||
|
|
}
|
||
|
|
|
||
|
|
return false
|
||
|
|
}
|
||
|
|
|
||
|
|
type OrderSearchStatus string
|
||
|
|
|
||
|
|
const (
|
||
|
|
Active OrderSearchStatus = "ACTIVE"
|
||
|
|
Inactive OrderSearchStatus = "INACTIVE"
|
||
|
|
)
|
||
|
|
|
||
|
|
func (i *OrderSearchStatus) IsActive() bool {
|
||
|
|
if i == nil {
|
||
|
|
return false
|
||
|
|
}
|
||
|
|
|
||
|
|
if *i == Active {
|
||
|
|
return true
|
||
|
|
}
|
||
|
|
|
||
|
|
return false
|
||
|
|
}
|