// Code generated by "string-enumer -t TrimSize -t ColorType -t Quality -t Binding -t Paper -t Finish -t Linen -t Foil --text -o ./pkgid_gen.go ."; DO NOT EDIT. package lulu import ( "fmt" ) // validBindingValues contains a map of all valid Binding values for easy lookup var validBindingValues = map[Binding]struct{}{ Perfect: {}, Coil: {}, SaddleStitch: {}, CaseWrap: {}, LinenWrap: {}, WireO: {}, } // Valid validates if a value is a valid Binding func (v Binding) Valid() bool { _, ok := validBindingValues[v] return ok } // BindingValues returns a list of all (valid) Binding values func BindingValues() []Binding { return []Binding{ Perfect, Coil, SaddleStitch, CaseWrap, LinenWrap, WireO, } } // UnmarshalText takes a text, verifies that it is a correct Binding and unmarshals it func (v *Binding) UnmarshalText(text []byte) error { if valid := Binding(text).Valid(); !valid { return fmt.Errorf("not valid value for Binding: %s", text) } *v = Binding(text) return nil } // validColorTypeValues contains a map of all valid ColorType values for easy lookup var validColorTypeValues = map[ColorType]struct{}{ Mono: {}, Color: {}, } // Valid validates if a value is a valid ColorType func (v ColorType) Valid() bool { _, ok := validColorTypeValues[v] return ok } // ColorTypeValues returns a list of all (valid) ColorType values func ColorTypeValues() []ColorType { return []ColorType{ Mono, Color, } } // UnmarshalText takes a text, verifies that it is a correct ColorType and unmarshals it func (v *ColorType) UnmarshalText(text []byte) error { if valid := ColorType(text).Valid(); !valid { return fmt.Errorf("not valid value for ColorType: %s", text) } *v = ColorType(text) return nil } // validFinishValues contains a map of all valid Finish values for easy lookup var validFinishValues = map[Finish]struct{}{ Gloss: {}, Matte: {}, Unlaminated: {}, } // Valid validates if a value is a valid Finish func (v Finish) Valid() bool { _, ok := validFinishValues[v] return ok } // FinishValues returns a list of all (valid) Finish values func FinishValues() []Finish { return []Finish{ Gloss, Matte, Unlaminated, } } // UnmarshalText takes a text, verifies that it is a correct Finish and unmarshals it func (v *Finish) UnmarshalText(text []byte) error { if valid := Finish(text).Valid(); !valid { return fmt.Errorf("not valid value for Finish: %s", text) } *v = Finish(text) return nil } // validFoilValues contains a map of all valid Foil values for easy lookup var validFoilValues = map[Foil]struct{}{ GoldFoil: {}, BlackFoil: {}, WhiteFoil: {}, NoFoil: {}, } // Valid validates if a value is a valid Foil func (v Foil) Valid() bool { _, ok := validFoilValues[v] return ok } // FoilValues returns a list of all (valid) Foil values func FoilValues() []Foil { return []Foil{ GoldFoil, BlackFoil, WhiteFoil, NoFoil, } } // UnmarshalText takes a text, verifies that it is a correct Foil and unmarshals it func (v *Foil) UnmarshalText(text []byte) error { if valid := Foil(text).Valid(); !valid { return fmt.Errorf("not valid value for Foil: %s", text) } *v = Foil(text) return nil } // validLinenValues contains a map of all valid Linen values for easy lookup var validLinenValues = map[Linen]struct{}{ RedLinen: {}, NavyLinen: {}, BlackLinen: {}, GrayLinen: {}, TanLinen: {}, ForestLinen: {}, InteriorCoverPrint: {}, NoLinen: {}, } // Valid validates if a value is a valid Linen func (v Linen) Valid() bool { _, ok := validLinenValues[v] return ok } // LinenValues returns a list of all (valid) Linen values func LinenValues() []Linen { return []Linen{ RedLinen, NavyLinen, BlackLinen, GrayLinen, TanLinen, ForestLinen, InteriorCoverPrint, NoLinen, } } // UnmarshalText takes a text, verifies that it is a correct Linen and unmarshals it func (v *Linen) UnmarshalText(text []byte) error { if valid := Linen(text).Valid(); !valid { return fmt.Errorf("not valid value for Linen: %s", text) } *v = Linen(text) return nil } // validPaperValues contains a map of all valid Paper values for easy lookup var validPaperValues = map[Paper]struct{}{ P60UncoatedWhite: {}, P60UncoatedCream: {}, P70CoatedWhite: {}, P80CoatedWhite: {}, P100CoatedWhite: {}, } // Valid validates if a value is a valid Paper func (v Paper) Valid() bool { _, ok := validPaperValues[v] return ok } // PaperValues returns a list of all (valid) Paper values func PaperValues() []Paper { return []Paper{ P60UncoatedWhite, P60UncoatedCream, P70CoatedWhite, P80CoatedWhite, P100CoatedWhite, } } // UnmarshalText takes a text, verifies that it is a correct Paper and unmarshals it func (v *Paper) UnmarshalText(text []byte) error { if valid := Paper(text).Valid(); !valid { return fmt.Errorf("not valid value for Paper: %s", text) } *v = Paper(text) return nil } // validQualityValues contains a map of all valid Quality values for easy lookup var validQualityValues = map[Quality]struct{}{ Premium: {}, Standard: {}, } // Valid validates if a value is a valid Quality func (v Quality) Valid() bool { _, ok := validQualityValues[v] return ok } // QualityValues returns a list of all (valid) Quality values func QualityValues() []Quality { return []Quality{ Premium, Standard, } } // UnmarshalText takes a text, verifies that it is a correct Quality and unmarshals it func (v *Quality) UnmarshalText(text []byte) error { if valid := Quality(text).Valid(); !valid { return fmt.Errorf("not valid value for Quality: %s", text) } *v = Quality(text) return nil } // validTrimSizeValues contains a map of all valid TrimSize values for easy lookup var validTrimSizeValues = map[TrimSize]struct{}{ Pocketbook: {}, Novella: {}, Digest: {}, A5: {}, UsTrade: {}, Royal: {}, Comic: {}, SmallSquare: {}, Executive: {}, CrownQuatro: {}, Square: {}, A4: {}, UsLetter: {}, Landscape: {}, UsLetterLandscape: {}, A4Landscape: {}, } // Valid validates if a value is a valid TrimSize func (v TrimSize) Valid() bool { _, ok := validTrimSizeValues[v] return ok } // TrimSizeValues returns a list of all (valid) TrimSize values func TrimSizeValues() []TrimSize { return []TrimSize{ Pocketbook, Novella, Digest, A5, UsTrade, Royal, Comic, SmallSquare, Executive, CrownQuatro, Square, A4, UsLetter, Landscape, UsLetterLandscape, A4Landscape, } } // UnmarshalText takes a text, verifies that it is a correct TrimSize and unmarshals it func (v *TrimSize) UnmarshalText(text []byte) error { if valid := TrimSize(text).Valid(); !valid { return fmt.Errorf("not valid value for TrimSize: %s", text) } *v = TrimSize(text) return nil }