find method

  1. @override
List<int> find (
  1. {int replaceNullWith}
)
override

Returns values of this property matching the query.

Results are in no particular order. Excludes null values. Set replaceNullWith to return null values as that value.

Implementation

@override
List<int> find({int replaceNullWith}) {
  final ptr = replaceNullWith != null
      ? (allocate<Int64>()..value = replaceNullWith)
      : Pointer<Int64>.fromAddress(0);
  switch (_type) {
    case OBXPropertyType.Bool:
    case OBXPropertyType.Byte:
    case OBXPropertyType.Char: // Int8
      return _unpack8(_curryWithDefault<OBX_int8_array, Int8>(
          bindings.obx_query_prop_find_int8s, ptr.cast<Int8>(), 'find int8'));
    case OBXPropertyType.Short: // Int16
      return _unpack16(_curryWithDefault<OBX_int16_array, Int16>(
          bindings.obx_query_prop_find_int16s,
          ptr.cast<Int16>(),
          'find int16'));
    case OBXPropertyType.Int: // Int32
      return _unpack32(_curryWithDefault<OBX_int32_array, Int32>(
          bindings.obx_query_prop_find_int32s,
          ptr.cast<Int32>(),
          'find int32'));
    case OBXPropertyType.Long: // Int64
      return _unpack64(_curryWithDefault<OBX_int64_array, Int64>(
          bindings.obx_query_prop_find_int64s,
          ptr.cast<Int64>(),
          'find int64'));
    default:
      throw Exception(
          'Property query: unsupported type (OBXPropertyType: ${_type})');
  }
}