annotation.go 334 B

1234567891011121314151617
  1. package util
  2. import (
  3. "strings"
  4. "github.com/tal-tech/go-zero/tools/goctl/api/spec"
  5. )
  6. func GetAnnotationValue(annos []spec.Annotation, key, field string) (string, bool) {
  7. for _, anno := range annos {
  8. if anno.Name == key {
  9. value, ok := anno.Properties[field]
  10. return strings.TrimSpace(value), ok
  11. }
  12. }
  13. return "", false
  14. }