You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
414 B
Go
21 lines
414 B
Go
package util
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/tal-tech/go-zero/tools/goctl/api/spec"
|
|
)
|
|
|
|
func GetAnnotationValue(annos []spec.Annotation, key, field string) (string, bool) {
|
|
for _, anno := range annos {
|
|
if anno.Name == field && len(anno.Value) > 0 {
|
|
return anno.Value, true
|
|
}
|
|
if anno.Name == key {
|
|
value, ok := anno.Properties[field]
|
|
return strings.TrimSpace(value), ok
|
|
}
|
|
}
|
|
return "", false
|
|
}
|