queryMakerStream method

SupabaseStreamBuilder queryMakerStream(
  1. String column,
  2. QueryValue value,
  3. SupabaseStreamFilterBuilder streamBuilder
)

Implementation

SupabaseStreamBuilder queryMakerStream(
    String column, QueryValue value, SupabaseStreamFilterBuilder streamBuilder) {
  switch (value.operType) {
    case OperType.isEqualTo:
      return streamBuilder.eq(column, value.value);
    case OperType.isGreaterThan:
      streamBuilder.gt(column, value.value);
      break;
    case OperType.isGreaterThanOrEqualTo:
      streamBuilder.gte(column, value.value);
      break;
    case OperType.isLessThan:
      streamBuilder.lt(column, value.value);
      break;
    case OperType.isLessThanOrEqualTo:
      streamBuilder.lte(column, value.value);
      break;
    case OperType.isNotEqualTo:
      streamBuilder.neq(column, value.value);
      break;
    case OperType.arrayContains: //cs  : contains
      logger.severe('supabase streamBuilder does not support arrayContains');
      break;
    // case OperType.arrayContains: //cs  : contains
    //   List data = [];
    //   if (value is List<String>) {
    //     data = value;
    //     //print('string type case-------------list:$data');
    //   } else if (value is String) {
    //     //print('list type case-------------list:$data');
    //     //data = jsonStringToList(value);
    //     data = value.split(',');
    //   }
    //   List<String> tempList = data.map((item) => '"$item"').toList();
    //   String filterString = '{${tempList.join(',')}}'; // Supabase에서는 {}가 리스트를 의미하므로 묶어 주어야 합니다.
    //   //print('---------filterString : $filterString');
    //   streamBuilder.filter(column, "cs", filterString);
    //   break;
    case OperType.arrayContainsAny: // ov : overlap
      logger.severe('supabase streamBuilder does not support arrayContainsAny');
      break;
    //   List data = [];
    //   if (value is List<String>) {
    //     data = value;
    //     //print('string type case-------------list:$data');
    //   } else if (value is String) {
    //     //print('list type case-------------list:$data');
    //     //data = jsonStringToList(value);
    //     data = value.split(',');
    //   }
    //   List<String> tempList = data.map((item) => '"$item"').toList();
    //   String filterString = '{${tempList.join(',')}}'; // Supabase에서는 {}가 리스트를 의미하므로 묶어 주어야 합니다.
    //   //print('---------filterString : $filterString');
    //   streamBuilder.filter(column, "ov", filterString);
    //   break;
    case OperType.whereIn:
      List<Object> data = [];
      if (value.value is List<String>) {
        data = List<Object>.from(value.value);
        //print('string type case-------------list:$data');
      } else if (value.value is String) {
        //data = jsonStringToList(value);
        data = List<Object>.from(value.value.split(','));
        //print('list type case-------------list:$data');
      }
      //print('*******************STREAM QUERY---------------$column whereIn $data');

      streamBuilder.inFilter(column, data);
      break;
    // case OperType.whereNotIn:
    //   streamBuilder.not(column, "in", value.value);
    //   break;
    // case OperType.textSearch:
    //   streamBuilder.textSearch(column, value.value);
    //   break;
    case OperType.isNull:
      streamBuilder.eq(column, ''); // isNull 함수가 없다. 일단 빈 문자열로 처리한다.
      break;
    default:
      return streamBuilder.eq(column, value.value);
  }
  return streamBuilder;
}