jsonDel method

Future<int?> jsonDel({
  1. required String key,
  2. String path = r'$',
})

JSON.DEL key path

Deletes a value.

key The key to modify. path The JSON path to delete. Defaults to root ($).

Implementation

Future<int?> jsonDel({
  required String key,
  String path = r'$',
}) async {
  final result = await execute(<String>['JSON.DEL', key, path]);

  // Valkey returns the integer number of paths deleted (0 or 1 usually)
  if (result is int) return result;
  return int.tryParse(result.toString());
}