ContainsPatchStrategy reads the field tags to check whether the given patch strategy is defined
(field *markers.FieldInfo, strategy string)
| 33 | |
| 34 | // ContainsPatchStrategy reads the field tags to check whether the given patch strategy is defined |
| 35 | func ContainsPatchStrategy(field *markers.FieldInfo, strategy string) bool { |
| 36 | patchStrategy := field.Tag.Get(patchStrategyTagKey) |
| 37 | if patchStrategy == "" { |
| 38 | return false |
| 39 | } |
| 40 | |
| 41 | for _, s := range strings.Split(patchStrategy, ",") { |
| 42 | if s == strategy { |
| 43 | return true |
| 44 | } |
| 45 | } |
| 46 | return false |
| 47 | } |
| 48 | |
| 49 | // GetPatchMergeKey reads the field tags to retrieve the patch merge key. It returns nil if no such key is defined |
| 50 | func GetPatchMergeKey(field *markers.FieldInfo) string { |