FIRQuery+Internal.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * Copyright 2017 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import "FIRQuery.h"
  17. #include <memory>
  18. #include "Firestore/core/src/firebase/firestore/api/query_core.h"
  19. #include "Firestore/core/src/firebase/firestore/core/query.h"
  20. namespace api = firebase::firestore::api;
  21. namespace core = firebase::firestore::core;
  22. NS_ASSUME_NONNULL_BEGIN
  23. @interface FIRQuery (/* Init */)
  24. - (instancetype)initWithQuery:(api::Query &&)query NS_DESIGNATED_INITIALIZER;
  25. - (instancetype)initWithQuery:(core::Query)query
  26. firestore:(std::shared_ptr<api::Firestore>)firestore;
  27. @end
  28. /** Internal FIRQuery API we don't want exposed in our public header files. */
  29. @interface FIRQuery (Internal)
  30. - (const core::Query &)query;
  31. - (const api::Query &)apiQuery;
  32. /**
  33. * Creates and returns a new `FIRQuery` with the additional filter that documents must contain
  34. * the specified field, the value must be an array, and that array must contain at least one value
  35. * from the provided array.
  36. *
  37. * A query can have only one arrayContains filter and it cannot be combined with arrayContains or
  38. * in.
  39. *
  40. * @param field The name of the field containing an array to search.
  41. * @param value The value that contains the values to match.
  42. *
  43. * @return The created `FIRQuery`.
  44. */
  45. // TODO(b/138855186): Expose to public once backend is ready.
  46. - (FIRQuery *)queryWhereField:(NSString *)field arrayContainsAny:(id)value;
  47. /**
  48. * Creates and returns a new `FIRQuery` with the additional filter that documents must contain
  49. * the specified field, the value must be an array, and that array must contain at least one value
  50. * from the provided array.
  51. *
  52. * A query can have only one arrayContains filter and it cannot be combined with arrayContains or
  53. * in.
  54. *
  55. * @param path The path of the field containing an array to search.
  56. * @param value The value that contains the values to match.
  57. *
  58. * @return The created `FIRQuery`.
  59. */
  60. // TODO(b/138855186): Expose to public once backend is ready.
  61. - (FIRQuery *)queryWhereFieldPath:(FIRFieldPath *)path arrayContainsAny:(id)value;
  62. /**
  63. * Creates and returns a new `FIRQuery` with the additional filter that documents must contain
  64. * the specified field and the value must equal one of the values from the provided array.
  65. *
  66. * A query can have only one in filter, and it cannot be combined with arrayContainsAny.
  67. *
  68. * @param field The name of the field to search.
  69. * @param value The value that contains the values to match.
  70. *
  71. * @return The created `FIRQuery`.
  72. */
  73. // TODO(b/138855186): Expose to public once backend is ready.
  74. - (FIRQuery *)queryWhereField:(NSString *)field in:(id)value;
  75. /**
  76. * Creates and returns a new `FIRQuery` with the additional filter that documents must contain
  77. * the specified field and the value must equal one of the values from the provided array.
  78. *
  79. * A query can have only one in filter, and it cannot be combined with arrayContainsAny.
  80. *
  81. * @param path The path of the field to search.
  82. * @param value The value that contains the values to match.
  83. *
  84. * @return The created `FIRQuery`.
  85. */
  86. // TODO(b/138855186): Expose to public once backend is ready.
  87. - (FIRQuery *)queryWhereFieldPath:(FIRFieldPath *)path in:(id)value;
  88. @end
  89. NS_ASSUME_NONNULL_END