package utils // ------------------------------------------------------------------- // FlagType // ------------------------------------------------------------------- type FlagType string const ( FlagIsActive FlagType = "IS_ACTIVE" ) // ------------------------------------------------------------------- // WarehouseType // ------------------------------------------------------------------- type WarehouseType string const ( WarehouseTypeArea WarehouseType = "AREA" WarehouseTypeLokasi WarehouseType = "LOKASI" WarehouseTypeKandang WarehouseType = "KANDANG" ) // ------------------------------------------------------------------- // WarehouseType // ------------------------------------------------------------------- type CustomerSupplierType string const ( CustomerSupplierTypeBisnis CustomerSupplierType = "BISNIS" CustomerSupplierTypeIndividual CustomerSupplierType = "INDIVIDUAL" ) // ------------------------------------------------------------------- // Validators // ------------------------------------------------------------------- func IsValidFlagType(v string) bool { switch FlagType(v) { case FlagIsActive: return true } return false } func IsValidWarehouseType(v string) bool { switch WarehouseType(v) { case WarehouseTypeArea, WarehouseTypeLokasi, WarehouseTypeKandang: return true } return false } func IsValidCustomerSupplierType(v string) bool { switch CustomerSupplierType(v) { case CustomerSupplierTypeBisnis, CustomerSupplierTypeIndividual: return true } return false } // example use /** if !utils.IsValidFlagType(req.FlagName) { return fiber.NewError(fiber.StatusBadRequest, "invalid flag type") } */