init project
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
package product
|
||||
|
||||
type ProductStatus string
|
||||
|
||||
const (
|
||||
Active ProductStatus = "Active"
|
||||
Inactive ProductStatus = "Inactive"
|
||||
)
|
||||
|
||||
func (b ProductStatus) toString() string {
|
||||
return string(b)
|
||||
}
|
||||
|
||||
type ProductType string
|
||||
|
||||
const (
|
||||
Food ProductType = "FOOD"
|
||||
Beverage ProductType = "BEVERAGE"
|
||||
)
|
||||
|
||||
func (b ProductType) toString() string {
|
||||
return string(b)
|
||||
}
|
||||
|
||||
type ProductStock string
|
||||
|
||||
const (
|
||||
Available ProductStock = "AVAILABLE"
|
||||
Unavailable ProductStock = "UNAVAILABLE"
|
||||
)
|
||||
|
||||
func (b ProductStock) toString() string {
|
||||
return string(b)
|
||||
}
|
||||
|
||||
func (i *ProductStock) IsAvailable() bool {
|
||||
if i == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
if *i == Available {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func (i *ProductStock) IsUnavailable() bool {
|
||||
if i == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
if *i == Unavailable {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
Reference in New Issue
Block a user