ISearchComparison.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. * @psalm-type ParamSingleValue = \DateTime|int|string|bool
  30. * @psalm-type ParamValue = ParamSingleValue|list<ParamSingleValue>
  31. */
  32. interface ISearchComparison extends ISearchOperator {
  33. /**
  34. * @since 12.0.0
  35. */
  36. public const COMPARE_EQUAL = 'eq';
  37. /**
  38. * @since 12.0.0
  39. */
  40. public const COMPARE_GREATER_THAN = 'gt';
  41. /**
  42. * @since 12.0.0
  43. */
  44. public const COMPARE_GREATER_THAN_EQUAL = 'gte';
  45. /**
  46. * @since 12.0.0
  47. */
  48. public const COMPARE_LESS_THAN = 'lt';
  49. /**
  50. * @since 12.0.0
  51. */
  52. public const COMPARE_LESS_THAN_EQUAL = 'lte';
  53. /**
  54. * @since 12.0.0
  55. */
  56. public const COMPARE_LIKE = 'like';
  57. /**
  58. * @since 23.0.0
  59. */
  60. public const COMPARE_LIKE_CASE_SENSITIVE = 'clike';
  61. /**
  62. * @since 28.0.0
  63. */
  64. public const COMPARE_DEFINED = 'is-defined';
  65. /**
  66. * @since 29.0.0
  67. */
  68. public const COMPARE_IN = 'in';
  69. /**
  70. * @since 23.0.0
  71. */
  72. public const HINT_PATH_EQ_HASH = 'path_eq_hash'; // transform `path = "$path"` into `path_hash = md5("$path")`, on by default
  73. /**
  74. * Get the type of comparison, one of the ISearchComparison::COMPARE_* constants
  75. *
  76. * @return string
  77. * @since 12.0.0
  78. */
  79. public function getType(): string;
  80. /**
  81. * Get the name of the field to compare with
  82. *
  83. * i.e. 'size', 'name' or 'mimetype'
  84. *
  85. * @return string
  86. * @since 12.0.0
  87. */
  88. public function getField(): string;
  89. /**
  90. * extra means data are not related to the main files table
  91. *
  92. * @return string
  93. * @since 28.0.0
  94. */
  95. public function getExtra(): string;
  96. /**
  97. * Get the value to compare the field with
  98. *
  99. * @return ParamValue
  100. * @since 12.0.0
  101. */
  102. public function getValue(): string|int|bool|\DateTime|array;
  103. }