mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-01-24 01:30:25 +08:00
1d9c4a4c4b
* rebase upstream * rebase * trim no need line * trim no need line * trim no need line * update doc * remove update * remove no need * remove no need * goctl add jwt support * goctl add jwt support * goctl add jwt support * goctl support import * goctl support import * support return () * revert * refactor and rename folder to group * remove no need * add anonymous annotation * optimized * rename * rename * update test * optimized new command Co-authored-by: kingxt <dream4kingxt@163.com>
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
|
|
}
|