| 1111 | } |
| 1112 | |
| 1113 | func (s Static) append(o Static) (Static, bool) { |
| 1114 | switch s.Type { |
| 1115 | case TypeString: |
| 1116 | values := make([]string, 0, 2) |
| 1117 | values = append(values, s.EncodeToString(false)) |
| 1118 | |
| 1119 | switch o.Type { |
| 1120 | case TypeString: |
| 1121 | values = append(values, o.EncodeToString(false)) |
| 1122 | case TypeStringArray: |
| 1123 | arr, _ := o.StringArray() |
| 1124 | values = append(values, arr...) |
| 1125 | default: |
| 1126 | return StaticNil, false |
| 1127 | } |
| 1128 | return NewStaticStringArray(values), true |
| 1129 | case TypeStringArray: |
| 1130 | values := make([]string, 0, 2) |
| 1131 | arr, _ := s.StringArray() |
| 1132 | values = append(values, arr...) |
| 1133 | |
| 1134 | switch o.Type { |
| 1135 | case TypeString: |
| 1136 | values = append(values, o.EncodeToString(false)) |
| 1137 | case TypeStringArray: |
| 1138 | arr, _ = o.StringArray() |
| 1139 | values = append(values, arr...) |
| 1140 | default: |
| 1141 | return StaticNil, false |
| 1142 | } |
| 1143 | return NewStaticStringArray(values), true |
| 1144 | case TypeInt: |
| 1145 | values := make([]int, 0, 2) |
| 1146 | n, _ := s.Int() |
| 1147 | values = append(values, n) |
| 1148 | |
| 1149 | switch o.Type { |
| 1150 | case TypeInt: |
| 1151 | n, _ = o.Int() |
| 1152 | values = append(values, n) |
| 1153 | case TypeIntArray: |
| 1154 | arr, _ := o.IntArray() |
| 1155 | values = append(values, arr...) |
| 1156 | default: |
| 1157 | return StaticNil, false |
| 1158 | } |
| 1159 | return NewStaticIntArray(values), true |
| 1160 | case TypeIntArray: |
| 1161 | values := make([]int, 0, 2) |
| 1162 | arr, _ := s.IntArray() |
| 1163 | values = append(values, arr...) |
| 1164 | |
| 1165 | switch o.Type { |
| 1166 | case TypeInt: |
| 1167 | n, _ := o.Int() |
| 1168 | values = append(values, n) |
| 1169 | case TypeIntArray: |
| 1170 | arr, _ := o.IntArray() |