jsonStrlen method

Future<int> jsonStrlen(
  1. String key, {
  2. String path = '\$',
})

jsonStrappend jsonStrlen

Implementation

// Future<List<int>> jsonStrappend(
//   String key, {
//   String path = '\$',
//   required value,
// }) async {
//   return await _runWithRetryNew(() async {
//     final result = (await RespCommandsTier1(_client!).jsonStrappend(
//       key: key,
//       path: path,
//       value: value,
//     ))
//         .toArray()
//         .payload;
//
//     if (result != null) {
//       return result.map((e) => e.toInteger().payload).toList(growable: false);
//     }
//     return [];
//   });
// }

/// jsonStrlen
Future<int> jsonStrlen(String key, {String path = '\$'}) async {
  List<RespType<dynamic>>? result = await _runWithRetryNew(() async {
    return (await RespCommandsTier1(_client!)
            .jsonStrlen(key: key, path: path))
        .toArray()
        .payload;
  });

  if (result != null && result.isNotEmpty) {
    return result[0].payload as int;
  } else {
    throw Exception('jsonStrlen: No elements in the result list');
  }
}