Merge merges other into v.
(other *ValidationExpr)
| 866 | |
| 867 | // Merge merges other into v. |
| 868 | func (v *ValidationExpr) Merge(other *ValidationExpr) { |
| 869 | if v.Values == nil { |
| 870 | v.Values = other.Values |
| 871 | } |
| 872 | if v.Format == "" { |
| 873 | v.Format = other.Format |
| 874 | } |
| 875 | if v.Pattern == "" { |
| 876 | v.Pattern = other.Pattern |
| 877 | } |
| 878 | if v.ExclusiveMinimum == nil || (other.ExclusiveMinimum != nil && *v.ExclusiveMinimum > *other.ExclusiveMinimum) { |
| 879 | v.ExclusiveMinimum = other.ExclusiveMinimum |
| 880 | } |
| 881 | if v.Minimum == nil || (other.Minimum != nil && *v.Minimum > *other.Minimum) { |
| 882 | v.Minimum = other.Minimum |
| 883 | } |
| 884 | if v.ExclusiveMaximum == nil || (other.ExclusiveMaximum != nil && *v.ExclusiveMaximum > *other.ExclusiveMaximum) { |
| 885 | v.ExclusiveMaximum = other.ExclusiveMaximum |
| 886 | } |
| 887 | if v.Maximum == nil || (other.Maximum != nil && *v.Maximum < *other.Maximum) { |
| 888 | v.Maximum = other.Maximum |
| 889 | } |
| 890 | if v.MinLength == nil || (other.MinLength != nil && *v.MinLength > *other.MinLength) { |
| 891 | v.MinLength = other.MinLength |
| 892 | } |
| 893 | if v.MaxLength == nil || (other.MaxLength != nil && *v.MaxLength < *other.MaxLength) { |
| 894 | v.MaxLength = other.MaxLength |
| 895 | } |
| 896 | v.AddRequired(other.Required...) |
| 897 | } |
| 898 | |
| 899 | // AddRequired merges the required fields into v. |
| 900 | func (v *ValidationExpr) AddRequired(required ...string) { |
nothing calls this directly
no test coverage detected