ISearchComparison.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OCP\Files\Search;
  7. /**
  8. * @since 12.0.0
  9. *
  10. * @psalm-type ParamSingleValue = \DateTime|int|string|bool
  11. * @psalm-type ParamValue = ParamSingleValue|list<ParamSingleValue>
  12. */
  13. interface ISearchComparison extends ISearchOperator {
  14. /**
  15. * @since 12.0.0
  16. */
  17. public const COMPARE_EQUAL = 'eq';
  18. /**
  19. * @since 12.0.0
  20. */
  21. public const COMPARE_GREATER_THAN = 'gt';
  22. /**
  23. * @since 12.0.0
  24. */
  25. public const COMPARE_GREATER_THAN_EQUAL = 'gte';
  26. /**
  27. * @since 12.0.0
  28. */
  29. public const COMPARE_LESS_THAN = 'lt';
  30. /**
  31. * @since 12.0.0
  32. */
  33. public const COMPARE_LESS_THAN_EQUAL = 'lte';
  34. /**
  35. * @since 12.0.0
  36. */
  37. public const COMPARE_LIKE = 'like';
  38. /**
  39. * @since 23.0.0
  40. */
  41. public const COMPARE_LIKE_CASE_SENSITIVE = 'clike';
  42. /**
  43. * @since 28.0.0
  44. */
  45. public const COMPARE_DEFINED = 'is-defined';
  46. /**
  47. * @since 29.0.0
  48. */
  49. public const COMPARE_IN = 'in';
  50. /**
  51. * @since 23.0.0
  52. */
  53. public const HINT_PATH_EQ_HASH = 'path_eq_hash'; // transform `path = "$path"` into `path_hash = md5("$path")`, on by default
  54. /**
  55. * Get the type of comparison, one of the ISearchComparison::COMPARE_* constants
  56. *
  57. * @return string
  58. * @since 12.0.0
  59. */
  60. public function getType(): string;
  61. /**
  62. * Get the name of the field to compare with
  63. *
  64. * i.e. 'size', 'name' or 'mimetype'
  65. *
  66. * @return string
  67. * @since 12.0.0
  68. */
  69. public function getField(): string;
  70. /**
  71. * extra means data are not related to the main files table
  72. *
  73. * @return string
  74. * @since 28.0.0
  75. */
  76. public function getExtra(): string;
  77. /**
  78. * Get the value to compare the field with
  79. *
  80. * @return ParamValue
  81. * @since 12.0.0
  82. */
  83. public function getValue(): string|int|bool|\DateTime|array;
  84. }