go-zero/tools/goctl/api/util/annotation.go

14 lines
298 B
Go
Raw Normal View History

2020-07-29 17:11:41 +08:00
package util
2020-08-08 16:40:10 +08:00
import "github.com/tal-tech/go-zero/tools/goctl/api/spec"
2020-07-29 17:11:41 +08:00
func GetAnnotationValue(annos []spec.Annotation, key, field string) (string, bool) {
for _, anno := range annos {
if anno.Name == key {
value, ok := anno.Properties[field]
return value, ok
}
}
return "", false
}