ISearchComparison.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2017 Robin Appelman <robin@icewind.nl>
  4. *
  5. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  6. * @author Maxence Lange <maxence@artificial-owl.com>
  7. * @author Robin Appelman <robin@icewind.nl>
  8. *
  9. * @license GNU AGPL version 3 or any later version
  10. *
  11. * This program is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU Affero General Public License as
  13. * published by the Free Software Foundation, either version 3 of the
  14. * License, or (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  23. *
  24. */
  25. namespace OCP\Files\Search;
  26. /**
  27. * @since 12.0.0
  28. */
  29. interface ISearchComparison extends ISearchOperator {
  30. public const COMPARE_EQUAL = 'eq';
  31. public const COMPARE_GREATER_THAN = 'gt';
  32. public const COMPARE_GREATER_THAN_EQUAL = 'gte';
  33. public const COMPARE_LESS_THAN = 'lt';
  34. public const COMPARE_LESS_THAN_EQUAL = 'lte';
  35. public const COMPARE_LIKE = 'like';
  36. public const COMPARE_LIKE_CASE_SENSITIVE = 'clike';
  37. public const COMPARE_DEFINED = 'is-defined';
  38. public const HINT_PATH_EQ_HASH = 'path_eq_hash'; // transform `path = "$path"` into `path_hash = md5("$path")`, on by default
  39. /**
  40. * Get the type of comparison, one of the ISearchComparison::COMPARE_* constants
  41. *
  42. * @return string
  43. * @since 12.0.0
  44. */
  45. public function getType(): string;
  46. /**
  47. * Get the name of the field to compare with
  48. *
  49. * i.e. 'size', 'name' or 'mimetype'
  50. *
  51. * @return string
  52. * @since 12.0.0
  53. */
  54. public function getField(): string;
  55. /**
  56. * extra means data are not related to the main files table
  57. *
  58. * @return string
  59. * @since 28.0.0
  60. */
  61. public function getExtra(): string;
  62. /**
  63. * Get the value to compare the field with
  64. *
  65. * @return string|integer|bool|\DateTime
  66. * @since 12.0.0
  67. */
  68. public function getValue(): string|int|bool|\DateTime;
  69. }