private static void AddQueryGreaterThan(QueryHandle queryHandle, string columnName, object value) { var columnIndex = queryHandle.GetColumnIndex(columnName); if (value is char) { queryHandle.IntGreater(columnIndex, (int)value); } else if (value is int) { queryHandle.IntGreater(columnIndex, (int)value); } else if (value is long) { queryHandle.LongGreater(columnIndex, (long)value); } else if (value is float) { queryHandle.FloatGreater(columnIndex, (float)value); } else if (value is double) { queryHandle.DoubleGreater(columnIndex, (double)value); } else if (value is DateTimeOffset) { queryHandle.TimestampTicksGreater(columnIndex, (DateTimeOffset)value); } else if (value is string || value is bool) { throw new Exception($"Unsupported type {value.GetType().Name}"); } else { throw new NotImplementedException(); } }
private static void AddQueryGreaterThan(QueryHandle queryHandle, string columnName, object value) { var columnIndex = queryHandle.GetColumnIndex(columnName); switch (value) { case char charValue: queryHandle.IntGreater(columnIndex, charValue); break; case byte byteValue: queryHandle.IntGreater(columnIndex, byteValue); break; case short shortValue: queryHandle.IntGreater(columnIndex, shortValue); break; case int intValue: queryHandle.IntGreater(columnIndex, intValue); break; case long longValue: queryHandle.LongGreater(columnIndex, longValue); break; case float floatValue: queryHandle.FloatGreater(columnIndex, floatValue); break; case double doubleValue: queryHandle.DoubleGreater(columnIndex, doubleValue); break; case DateTimeOffset date: queryHandle.TimestampTicksGreater(columnIndex, date); break; case string _: case bool _: throw new Exception($"Unsupported type {value.GetType().Name}"); case RealmInteger <byte> byteValue: queryHandle.IntGreater(columnIndex, byteValue); break; case RealmInteger <short> shortValue: queryHandle.IntGreater(columnIndex, shortValue); break; case RealmInteger <int> intValue: queryHandle.IntGreater(columnIndex, intValue); break; case RealmInteger <long> longValue: queryHandle.LongGreater(columnIndex, longValue); break; default: throw new NotImplementedException(); } }