BatchUpdate updates the map with multiple keys and values simultaneously. "keys" and "values" must be of type slice, a pointer to a slice or buffer will not work.
(keys, values any, opts *BatchOptions)
| 1392 | // "keys" and "values" must be of type slice, a pointer |
| 1393 | // to a slice or buffer will not work. |
| 1394 | func (m *Map) BatchUpdate(keys, values any, opts *BatchOptions) (int, error) { |
| 1395 | if m.typ.hasPerCPUValue() { |
| 1396 | return m.batchUpdatePerCPU(keys, values, opts) |
| 1397 | } |
| 1398 | |
| 1399 | count, err := batchCount(keys, values) |
| 1400 | if err != nil { |
| 1401 | return 0, err |
| 1402 | } |
| 1403 | |
| 1404 | valuePtr, err := marshalMapSyscallInput(values, count*int(m.valueSize)) |
| 1405 | if err != nil { |
| 1406 | return 0, err |
| 1407 | } |
| 1408 | |
| 1409 | return m.batchUpdate(count, keys, valuePtr, opts) |
| 1410 | } |
| 1411 | |
| 1412 | func (m *Map) batchUpdate(count int, keys any, valuePtr sys.Pointer, opts *BatchOptions) (int, error) { |
| 1413 | keyPtr, err := marshalMapSyscallInput(keys, count*int(m.keySize)) |