github.com/voedger/voedger@v0.0.0-20240520144910-273e84102129/pkg/appparts/impl_processorkind.go (about) 1 /* 2 * Copyright (c) 2021-present Sigma-Soft, Ltd. 3 * @author: Nikolay Nikitin 4 */ 5 6 package appparts 7 8 import ( 9 "strconv" 10 "strings" 11 ) 12 13 func (k ProcessorKind) MarshalText() ([]byte, error) { 14 var s string 15 if k < ProcessorKind_Count { 16 s = k.String() 17 } else { 18 const base = 10 19 s = strconv.FormatUint(uint64(k), base) 20 } 21 return []byte(s), nil 22 } 23 24 // Renders an ProcessorKind in human-readable form, without `ProcessorKind_` prefix, 25 // suitable for debugging or error messages 26 func (k ProcessorKind) TrimString() string { 27 const pref = "ProcessorKind_" 28 return strings.TrimPrefix(k.String(), pref) 29 }