@@ -118,12 +118,12 @@ var enums = protoenum.NewEnums(
118118)
119119
120120func main () {
121- // Lookup by enum code (returns default when not found)
121+ // Lookup using enum code (returns default when not found)
122122 skip := enums.GetByCode (int32 (protoenumresult.ResultEnum_SKIP ))
123123 zaplog.LOG .Debug (" pure" , zap.String (" msg" , string (skip.Pure ())))
124124 zaplog.LOG .Debug (" desc" , zap.String (" msg" , skip.Meta ().Desc ()))
125125
126- // Lookup by Go native enum value (type-safe lookup )
126+ // Lookup using Go native enum value (type-safe)
127127 pass := enums.GetByPure (ResultTypePass)
128128 base := protoenumresult.ResultEnum (pass.Code ())
129129 zaplog.LOG .Debug (" base" , zap.String (" msg" , base.String ()))
@@ -133,10 +133,10 @@ func main() {
133133 zaplog.LOG .Debug (" pass" )
134134 }
135135
136- // Lookup by enum name (safe with default fallback)
136+ // Lookup using enum name (safe with default fallback)
137137 miss := enums.GetByName (" MISS" )
138138 zaplog.LOG .Debug (" pure" , zap.String (" msg" , string (miss.Pure ())))
139- zaplog.LOG .Debug (" hans " , zap.String (" msg" , miss.Meta ().Hans ()))
139+ zaplog.LOG .Debug (" desc " , zap.String (" msg" , miss.Meta ().Desc ()))
140140}
141141```
142142
@@ -223,15 +223,15 @@ statusEnums := protoenum.NewEnums(
223223
224224** Multiple lookup methods:**
225225``` go
226- // By numeric code - always returns valid enum (default if not found)
226+ // Using numeric code - returns valid enum (default if not found)
227227enum := statusEnums.GetByCode (1 )
228228fmt.Printf (" Found: %s \n " , enum.Meta ().Desc ())
229229
230- // By enum name - guaranteed non-nil
230+ // Using enum name - guaranteed non-nil
231231enum = statusEnums.GetByName (" SUCCESS" )
232232fmt.Printf (" Status: %s \n " , enum.Meta ().Desc ())
233233
234- // By Go native enum value - type-safe lookup
234+ // Using Go native enum value - type-safe lookup
235235enum = statusEnums.GetByPure (StatusTypeSuccess)
236236fmt.Printf (" Pure: %s \n " , enum.Pure ())
237237
@@ -273,7 +273,7 @@ case StatusTypeUnknown:
273273 fmt.Println (" Unknown status" )
274274}
275275
276- // Lookup by Go native enum value
276+ // Lookup using Go native enum value
277277found := enums.GetByPure (StatusTypeSuccess)
278278fmt.Printf (" Code: %d , Name: %s \n " , found.Code (), found.Name ())
279279```
@@ -339,7 +339,7 @@ fmt.Printf("Fallback: %s\n", notFound.Meta().Desc()) // Safe without nil check
339339enums.UnsetDefault () // Must unset first
340340enums.SetDefault (enums.MustGetByCode (1 )) // Then set new default
341341
342- // After UnsetDefault, lookups panic if not found
342+ // Once UnsetDefault called , lookups panic if not found
343343// This enforces single usage pattern: collections must have defaults
344344```
345345
0 commit comments