(data any, value any, pp pathWithPos, opts SetPathOpts)
| 255 | } |
| 256 | |
| 257 | func CombineFn_ArrayAppend(data any, value any, pp pathWithPos, opts SetPathOpts) (any, error) { |
| 258 | if !checkAndModifyBudget(&opts, pp, 1) { |
| 259 | return nil, MakeBudgetError("trying to append to array", pp.Path, pp.Index) |
| 260 | } |
| 261 | if data == nil { |
| 262 | data = make([]any, 0) |
| 263 | } |
| 264 | arrVal, ok := data.([]any) |
| 265 | if !ok && !opts.Force { |
| 266 | return nil, MakeSetTypeError(fmt.Sprintf("expected array, but got %T", data), pp.Path, pp.Index) |
| 267 | } |
| 268 | if !ok { |
| 269 | arrVal = make([]any, 0) |
| 270 | } |
| 271 | arrVal = append(arrVal, value) |
| 272 | return arrVal, nil |
| 273 | } |
| 274 | |
| 275 | func CombineFn_SetUnless(data any, value any, pp pathWithPos, opts SetPathOpts) (any, error) { |
| 276 | if data != nil { |
nothing calls this directly
no test coverage detected