2017-05-15 12:27:07 -07:00
|
|
|
/*
|
|
|
|
|
* Copyright 2017 Google
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
|
*
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
*
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#import "FIRDataEventType.h"
|
|
|
|
|
#import "FIRDataSnapshot.h"
|
2019-08-05 13:27:47 -07:00
|
|
|
#import <Foundation/Foundation.h>
|
2017-05-15 12:27:07 -07:00
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
|
|
|
|
|
/**
|
2019-08-05 13:27:47 -07:00
|
|
|
* A FIRDatabaseHandle is used to identify listeners of Firebase Database
|
|
|
|
|
* events. These handles are returned by observeEventType: and can later be
|
|
|
|
|
* passed to removeObserverWithHandle: to stop receiving updates.
|
2017-05-15 12:27:07 -07:00
|
|
|
*/
|
2017-11-28 06:59:07 -08:00
|
|
|
typedef NSUInteger FIRDatabaseHandle NS_SWIFT_NAME(DatabaseHandle);
|
2017-05-15 12:27:07 -07:00
|
|
|
|
|
|
|
|
/**
|
2019-08-05 13:27:47 -07:00
|
|
|
* A FIRDatabaseQuery instance represents a query over the data at a particular
|
|
|
|
|
* location.
|
2017-05-15 12:27:07 -07:00
|
|
|
*
|
2019-08-05 13:27:47 -07:00
|
|
|
* You create one by calling one of the query methods (queryOrderedByChild:,
|
|
|
|
|
* queryStartingAtValue:, etc.) on a FIRDatabaseReference. The query methods can
|
|
|
|
|
* be chained to further specify the data you are interested in observing
|
2017-05-15 12:27:07 -07:00
|
|
|
*/
|
2017-11-28 06:59:07 -08:00
|
|
|
NS_SWIFT_NAME(DatabaseQuery)
|
2017-05-15 12:27:07 -07:00
|
|
|
@interface FIRDatabaseQuery : NSObject
|
|
|
|
|
|
|
|
|
|
#pragma mark - Attach observers to read data
|
|
|
|
|
|
|
|
|
|
/**
|
2019-08-05 13:27:47 -07:00
|
|
|
* observeEventType:withBlock: is used to listen for data changes at a
|
|
|
|
|
* particular location. This is the primary way to read data from the Firebase
|
|
|
|
|
* Database. Your block will be triggered for the initial data and again
|
|
|
|
|
* whenever the data changes.
|
2017-05-15 12:27:07 -07:00
|
|
|
*
|
|
|
|
|
* Use removeObserverWithHandle: to stop receiving updates.
|
|
|
|
|
*
|
|
|
|
|
* @param eventType The type of event to listen for.
|
2019-08-05 13:27:47 -07:00
|
|
|
* @param block The block that should be called with initial data and updates.
|
|
|
|
|
* It is passed the data as a FIRDataSnapshot.
|
|
|
|
|
* @return A handle used to unregister this block later using
|
|
|
|
|
* removeObserverWithHandle:
|
2017-05-15 12:27:07 -07:00
|
|
|
*/
|
2019-08-05 13:27:47 -07:00
|
|
|
- (FIRDatabaseHandle)observeEventType:(FIRDataEventType)eventType
|
|
|
|
|
withBlock:
|
|
|
|
|
(void (^)(FIRDataSnapshot *snapshot))block;
|
2017-05-15 12:27:07 -07:00
|
|
|
|
|
|
|
|
/**
|
2019-08-05 13:27:47 -07:00
|
|
|
* observeEventType:andPreviousSiblingKeyWithBlock: is used to listen for data
|
|
|
|
|
* changes at a particular location. This is the primary way to read data from
|
|
|
|
|
* the Firebase Database. Your block will be triggered for the initial data and
|
|
|
|
|
* again whenever the data changes. In addition, for FIRDataEventTypeChildAdded,
|
|
|
|
|
* FIRDataEventTypeChildMoved, and FIRDataEventTypeChildChanged events, your
|
|
|
|
|
* block will be passed the key of the previous node by priority order.
|
2017-05-15 12:27:07 -07:00
|
|
|
*
|
|
|
|
|
* Use removeObserverWithHandle: to stop receiving updates.
|
|
|
|
|
*
|
|
|
|
|
* @param eventType The type of event to listen for.
|
2019-08-05 13:27:47 -07:00
|
|
|
* @param block The block that should be called with initial data and updates.
|
|
|
|
|
* It is passed the data as a FIRDataSnapshot and the previous child's key.
|
|
|
|
|
* @return A handle used to unregister this block later using
|
|
|
|
|
* removeObserverWithHandle:
|
2017-05-15 12:27:07 -07:00
|
|
|
*/
|
2019-08-05 13:27:47 -07:00
|
|
|
- (FIRDatabaseHandle)observeEventType:(FIRDataEventType)eventType
|
|
|
|
|
andPreviousSiblingKeyWithBlock:
|
|
|
|
|
(void (^)(FIRDataSnapshot *snapshot,
|
|
|
|
|
NSString *__nullable prevKey))block;
|
2017-05-15 12:27:07 -07:00
|
|
|
|
|
|
|
|
/**
|
2019-08-05 13:27:47 -07:00
|
|
|
* observeEventType:withBlock: is used to listen for data changes at a
|
|
|
|
|
* particular location. This is the primary way to read data from the Firebase
|
|
|
|
|
* Database. Your block will be triggered for the initial data and again
|
|
|
|
|
* whenever the data changes.
|
2017-05-15 12:27:07 -07:00
|
|
|
*
|
2019-08-05 13:27:47 -07:00
|
|
|
* The cancelBlock will be called if you will no longer receive new events due
|
|
|
|
|
* to no longer having permission.
|
2017-05-15 12:27:07 -07:00
|
|
|
*
|
|
|
|
|
* Use removeObserverWithHandle: to stop receiving updates.
|
|
|
|
|
*
|
|
|
|
|
* @param eventType The type of event to listen for.
|
2019-08-05 13:27:47 -07:00
|
|
|
* @param block The block that should be called with initial data and updates.
|
|
|
|
|
* It is passed the data as a FIRDataSnapshot.
|
|
|
|
|
* @param cancelBlock The block that should be called if this client no longer
|
|
|
|
|
* has permission to receive these events
|
|
|
|
|
* @return A handle used to unregister this block later using
|
|
|
|
|
* removeObserverWithHandle:
|
2017-05-15 12:27:07 -07:00
|
|
|
*/
|
2019-08-05 13:27:47 -07:00
|
|
|
- (FIRDatabaseHandle)observeEventType:(FIRDataEventType)eventType
|
|
|
|
|
withBlock:(void (^)(FIRDataSnapshot *snapshot))block
|
|
|
|
|
withCancelBlock:
|
|
|
|
|
(nullable void (^)(NSError *error))cancelBlock;
|
2017-05-15 12:27:07 -07:00
|
|
|
|
|
|
|
|
/**
|
2019-08-05 13:27:47 -07:00
|
|
|
* observeEventType:andPreviousSiblingKeyWithBlock: is used to listen for data
|
|
|
|
|
* changes at a particular location. This is the primary way to read data from
|
|
|
|
|
* the Firebase Database. Your block will be triggered for the initial data and
|
|
|
|
|
* again whenever the data changes. In addition, for FIRDataEventTypeChildAdded,
|
|
|
|
|
* FIRDataEventTypeChildMoved, and FIRDataEventTypeChildChanged events, your
|
|
|
|
|
* block will be passed the key of the previous node by priority order.
|
2017-05-15 12:27:07 -07:00
|
|
|
*
|
2019-08-05 13:27:47 -07:00
|
|
|
* The cancelBlock will be called if you will no longer receive new events due
|
|
|
|
|
* to no longer having permission.
|
2017-05-15 12:27:07 -07:00
|
|
|
*
|
|
|
|
|
* Use removeObserverWithHandle: to stop receiving updates.
|
|
|
|
|
*
|
|
|
|
|
* @param eventType The type of event to listen for.
|
2019-08-05 13:27:47 -07:00
|
|
|
* @param block The block that should be called with initial data and updates.
|
|
|
|
|
* It is passed the data as a FIRDataSnapshot and the previous child's key.
|
|
|
|
|
* @param cancelBlock The block that should be called if this client no longer
|
|
|
|
|
* has permission to receive these events
|
|
|
|
|
* @return A handle used to unregister this block later using
|
|
|
|
|
* removeObserverWithHandle:
|
2017-05-15 12:27:07 -07:00
|
|
|
*/
|
2019-08-05 13:27:47 -07:00
|
|
|
- (FIRDatabaseHandle)observeEventType:(FIRDataEventType)eventType
|
|
|
|
|
andPreviousSiblingKeyWithBlock:
|
|
|
|
|
(void (^)(FIRDataSnapshot *snapshot,
|
|
|
|
|
NSString *__nullable prevKey))block
|
|
|
|
|
withCancelBlock:
|
|
|
|
|
(nullable void (^)(NSError *error))cancelBlock;
|
2017-05-15 12:27:07 -07:00
|
|
|
|
|
|
|
|
/**
|
2019-08-05 13:27:47 -07:00
|
|
|
* This is equivalent to observeEventType:withBlock:, except the block is
|
|
|
|
|
* immediately canceled after the initial data is returned.
|
2017-05-15 12:27:07 -07:00
|
|
|
*
|
|
|
|
|
* @param eventType The type of event to listen for.
|
2019-08-05 13:27:47 -07:00
|
|
|
* @param block The block that should be called. It is passed the data as a
|
|
|
|
|
* FIRDataSnapshot.
|
2017-05-15 12:27:07 -07:00
|
|
|
*/
|
2019-08-05 13:27:47 -07:00
|
|
|
- (void)observeSingleEventOfType:(FIRDataEventType)eventType
|
|
|
|
|
withBlock:(void (^)(FIRDataSnapshot *snapshot))block;
|
2017-05-15 12:27:07 -07:00
|
|
|
|
|
|
|
|
/**
|
2019-08-05 13:27:47 -07:00
|
|
|
* This is equivalent to observeEventType:withBlock:, except the block is
|
|
|
|
|
* immediately canceled after the initial data is returned. In addition, for
|
|
|
|
|
* FIRDataEventTypeChildAdded, FIRDataEventTypeChildMoved, and
|
|
|
|
|
* FIRDataEventTypeChildChanged events, your block will be passed the key of the
|
|
|
|
|
* previous node by priority order.
|
2017-05-15 12:27:07 -07:00
|
|
|
*
|
|
|
|
|
* @param eventType The type of event to listen for.
|
2019-08-05 13:27:47 -07:00
|
|
|
* @param block The block that should be called. It is passed the data as a
|
|
|
|
|
* FIRDataSnapshot and the previous child's key.
|
2017-05-15 12:27:07 -07:00
|
|
|
*/
|
2019-08-05 13:27:47 -07:00
|
|
|
- (void)observeSingleEventOfType:(FIRDataEventType)eventType
|
|
|
|
|
andPreviousSiblingKeyWithBlock:
|
|
|
|
|
(void (^)(FIRDataSnapshot *snapshot,
|
|
|
|
|
NSString *__nullable prevKey))block;
|
2017-05-15 12:27:07 -07:00
|
|
|
|
|
|
|
|
/**
|
2019-08-05 13:27:47 -07:00
|
|
|
* This is equivalent to observeEventType:withBlock:, except the block is
|
|
|
|
|
* immediately canceled after the initial data is returned.
|
2017-05-15 12:27:07 -07:00
|
|
|
*
|
2019-08-05 13:27:47 -07:00
|
|
|
* The cancelBlock will be called if you do not have permission to read data at
|
|
|
|
|
* this location.
|
2017-05-15 12:27:07 -07:00
|
|
|
*
|
|
|
|
|
* @param eventType The type of event to listen for.
|
2019-08-05 13:27:47 -07:00
|
|
|
* @param block The block that should be called. It is passed the data as a
|
|
|
|
|
* FIRDataSnapshot.
|
|
|
|
|
* @param cancelBlock The block that will be called if you don't have permission
|
|
|
|
|
* to access this data
|
2017-05-15 12:27:07 -07:00
|
|
|
*/
|
2019-08-05 13:27:47 -07:00
|
|
|
- (void)observeSingleEventOfType:(FIRDataEventType)eventType
|
|
|
|
|
withBlock:(void (^)(FIRDataSnapshot *snapshot))block
|
|
|
|
|
withCancelBlock:(nullable void (^)(NSError *error))cancelBlock;
|
2017-05-15 12:27:07 -07:00
|
|
|
|
|
|
|
|
/**
|
2019-08-05 13:27:47 -07:00
|
|
|
* This is equivalent to observeEventType:withBlock:, except the block is
|
|
|
|
|
* immediately canceled after the initial data is returned. In addition, for
|
|
|
|
|
* FIRDataEventTypeChildAdded, FIRDataEventTypeChildMoved, and
|
|
|
|
|
* FIRDataEventTypeChildChanged events, your block will be passed the key of the
|
|
|
|
|
* previous node by priority order.
|
2017-05-15 12:27:07 -07:00
|
|
|
*
|
2019-08-05 13:27:47 -07:00
|
|
|
* The cancelBlock will be called if you do not have permission to read data at
|
|
|
|
|
* this location.
|
2017-05-15 12:27:07 -07:00
|
|
|
*
|
|
|
|
|
* @param eventType The type of event to listen for.
|
2019-08-05 13:27:47 -07:00
|
|
|
* @param block The block that should be called. It is passed the data as a
|
|
|
|
|
* FIRDataSnapshot and the previous child's key.
|
|
|
|
|
* @param cancelBlock The block that will be called if you don't have permission
|
|
|
|
|
* to access this data
|
2017-05-15 12:27:07 -07:00
|
|
|
*/
|
2019-08-05 13:27:47 -07:00
|
|
|
- (void)observeSingleEventOfType:(FIRDataEventType)eventType
|
|
|
|
|
andPreviousSiblingKeyWithBlock:(void (^)(FIRDataSnapshot *snapshot,
|
|
|
|
|
NSString *__nullable prevKey))block
|
|
|
|
|
withCancelBlock:
|
|
|
|
|
(nullable void (^)(NSError *error))cancelBlock;
|
2017-05-15 12:27:07 -07:00
|
|
|
|
|
|
|
|
#pragma mark - Detaching observers
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Detach a block previously attached with observeEventType:withBlock:.
|
|
|
|
|
*
|
2019-08-05 13:27:47 -07:00
|
|
|
* @param handle The handle returned by the call to observeEventType:withBlock:
|
|
|
|
|
* which we are trying to remove.
|
2017-05-15 12:27:07 -07:00
|
|
|
*/
|
2019-08-05 13:27:47 -07:00
|
|
|
- (void)removeObserverWithHandle:(FIRDatabaseHandle)handle;
|
2017-05-15 12:27:07 -07:00
|
|
|
|
|
|
|
|
/**
|
2019-08-05 13:27:47 -07:00
|
|
|
* Detach all blocks previously attached to this Firebase Database location with
|
|
|
|
|
* observeEventType:withBlock:
|
2017-05-15 12:27:07 -07:00
|
|
|
*/
|
2019-08-05 13:27:47 -07:00
|
|
|
- (void)removeAllObservers;
|
2017-05-15 12:27:07 -07:00
|
|
|
|
|
|
|
|
/**
|
2019-08-05 13:27:47 -07:00
|
|
|
* By calling `keepSynced:YES` on a location, the data for that location will
|
|
|
|
|
* automatically be downloaded and kept in sync, even when no listeners are
|
|
|
|
|
* attached for that location. Additionally, while a location is kept synced, it
|
|
|
|
|
* will not be evicted from the persistent disk cache.
|
2017-05-15 12:27:07 -07:00
|
|
|
*
|
2019-08-05 13:27:47 -07:00
|
|
|
* @param keepSynced Pass YES to keep this location synchronized, pass NO to
|
|
|
|
|
* stop synchronization.
|
|
|
|
|
*/
|
|
|
|
|
- (void)keepSynced:(BOOL)keepSynced;
|
2017-05-15 12:27:07 -07:00
|
|
|
|
|
|
|
|
#pragma mark - Querying and limiting
|
|
|
|
|
|
|
|
|
|
/**
|
2019-08-05 13:27:47 -07:00
|
|
|
* queryLimitedToFirst: is used to generate a reference to a limited view of the
|
|
|
|
|
* data at this location. The FIRDatabaseQuery instance returned by
|
|
|
|
|
* queryLimitedToFirst: will respond to at most the first limit child nodes.
|
|
|
|
|
*
|
|
|
|
|
* @param limit The upper bound, inclusive, for the number of child nodes to
|
|
|
|
|
* receive events for
|
|
|
|
|
* @return A FIRDatabaseQuery instance, limited to at most limit child nodes.
|
|
|
|
|
*/
|
2017-05-15 12:27:07 -07:00
|
|
|
- (FIRDatabaseQuery *)queryLimitedToFirst:(NSUInteger)limit;
|
|
|
|
|
|
|
|
|
|
/**
|
2019-08-05 13:27:47 -07:00
|
|
|
* queryLimitedToLast: is used to generate a reference to a limited view of the
|
|
|
|
|
* data at this location. The FIRDatabaseQuery instance returned by
|
|
|
|
|
* queryLimitedToLast: will respond to at most the last limit child nodes.
|
|
|
|
|
*
|
|
|
|
|
* @param limit The upper bound, inclusive, for the number of child nodes to
|
|
|
|
|
* receive events for
|
|
|
|
|
* @return A FIRDatabaseQuery instance, limited to at most limit child nodes.
|
|
|
|
|
*/
|
2017-05-15 12:27:07 -07:00
|
|
|
- (FIRDatabaseQuery *)queryLimitedToLast:(NSUInteger)limit;
|
|
|
|
|
|
|
|
|
|
/**
|
2019-08-05 13:27:47 -07:00
|
|
|
* queryOrderBy: is used to generate a reference to a view of the data that's
|
|
|
|
|
* been sorted by the values of a particular child key. This method is intended
|
|
|
|
|
* to be used in combination with queryStartingAtValue:, queryEndingAtValue:, or
|
|
|
|
|
* queryEqualToValue:.
|
2017-05-15 12:27:07 -07:00
|
|
|
*
|
2019-08-05 13:27:47 -07:00
|
|
|
* @param key The child key to use in ordering data visible to the returned
|
|
|
|
|
* FIRDatabaseQuery
|
|
|
|
|
* @return A FIRDatabaseQuery instance, ordered by the values of the specified
|
|
|
|
|
* child key.
|
|
|
|
|
*/
|
2017-05-15 12:27:07 -07:00
|
|
|
- (FIRDatabaseQuery *)queryOrderedByChild:(NSString *)key;
|
|
|
|
|
|
|
|
|
|
/**
|
2019-08-05 13:27:47 -07:00
|
|
|
* queryOrderedByKey: is used to generate a reference to a view of the data
|
|
|
|
|
* that's been sorted by child key. This method is intended to be used in
|
|
|
|
|
* combination with queryStartingAtValue:, queryEndingAtValue:, or
|
|
|
|
|
* queryEqualToValue:.
|
2017-05-15 12:27:07 -07:00
|
|
|
*
|
|
|
|
|
* @return A FIRDatabaseQuery instance, ordered by child keys.
|
|
|
|
|
*/
|
2019-08-05 13:27:47 -07:00
|
|
|
- (FIRDatabaseQuery *)queryOrderedByKey;
|
2017-05-15 12:27:07 -07:00
|
|
|
|
|
|
|
|
/**
|
2019-08-05 13:27:47 -07:00
|
|
|
* queryOrderedByValue: is used to generate a reference to a view of the data
|
|
|
|
|
* that's been sorted by child value. This method is intended to be used in
|
|
|
|
|
* combination with queryStartingAtValue:, queryEndingAtValue:, or
|
|
|
|
|
* queryEqualToValue:.
|
2017-05-15 12:27:07 -07:00
|
|
|
*
|
|
|
|
|
* @return A FIRDatabaseQuery instance, ordered by child value.
|
|
|
|
|
*/
|
2019-08-05 13:27:47 -07:00
|
|
|
- (FIRDatabaseQuery *)queryOrderedByValue;
|
2017-05-15 12:27:07 -07:00
|
|
|
|
|
|
|
|
/**
|
2019-08-05 13:27:47 -07:00
|
|
|
* queryOrderedByPriority: is used to generate a reference to a view of the data
|
|
|
|
|
* that's been sorted by child priority. This method is intended to be used in
|
|
|
|
|
* combination with queryStartingAtValue:, queryEndingAtValue:, or
|
|
|
|
|
* queryEqualToValue:.
|
2017-05-15 12:27:07 -07:00
|
|
|
*
|
|
|
|
|
* @return A FIRDatabaseQuery instance, ordered by child priorities.
|
|
|
|
|
*/
|
2019-08-05 13:27:47 -07:00
|
|
|
- (FIRDatabaseQuery *)queryOrderedByPriority;
|
2017-05-15 12:27:07 -07:00
|
|
|
|
|
|
|
|
/**
|
2019-08-05 13:27:47 -07:00
|
|
|
* queryStartingAtValue: is used to generate a reference to a limited view of
|
|
|
|
|
* the data at this location. The FIRDatabaseQuery instance returned by
|
|
|
|
|
* queryStartingAtValue: will respond to events at nodes with a value greater
|
|
|
|
|
* than or equal to startValue.
|
2017-05-15 12:27:07 -07:00
|
|
|
*
|
2019-08-05 13:27:47 -07:00
|
|
|
* @param startValue The lower bound, inclusive, for the value of data visible
|
|
|
|
|
* to the returned FIRDatabaseQuery
|
|
|
|
|
* @return A FIRDatabaseQuery instance, limited to data with value greater than
|
|
|
|
|
* or equal to startValue
|
2017-05-15 12:27:07 -07:00
|
|
|
*/
|
|
|
|
|
- (FIRDatabaseQuery *)queryStartingAtValue:(nullable id)startValue;
|
|
|
|
|
|
|
|
|
|
/**
|
2019-08-05 13:27:47 -07:00
|
|
|
* queryStartingAtValue:childKey: is used to generate a reference to a limited
|
|
|
|
|
* view of the data at this location. The FIRDatabaseQuery instance returned by
|
|
|
|
|
* queryStartingAtValue:childKey will respond to events at nodes with a value
|
|
|
|
|
* greater than startValue, or equal to startValue and with a key greater than
|
|
|
|
|
* or equal to childKey. This is most useful when implementing pagination in a
|
|
|
|
|
* case where multiple nodes can match the startValue.
|
2017-05-15 12:27:07 -07:00
|
|
|
*
|
2019-08-05 13:27:47 -07:00
|
|
|
* @param startValue The lower bound, inclusive, for the value of data visible
|
|
|
|
|
* to the returned FIRDatabaseQuery
|
|
|
|
|
* @param childKey The lower bound, inclusive, for the key of nodes with value
|
|
|
|
|
* equal to startValue
|
|
|
|
|
* @return A FIRDatabaseQuery instance, limited to data with value greater than
|
|
|
|
|
* or equal to startValue
|
2017-05-15 12:27:07 -07:00
|
|
|
*/
|
2019-08-05 13:27:47 -07:00
|
|
|
- (FIRDatabaseQuery *)queryStartingAtValue:(nullable id)startValue
|
|
|
|
|
childKey:(nullable NSString *)childKey;
|
2017-05-15 12:27:07 -07:00
|
|
|
|
|
|
|
|
/**
|
2019-08-05 13:27:47 -07:00
|
|
|
* queryEndingAtValue: is used to generate a reference to a limited view of the
|
|
|
|
|
* data at this location. The FIRDatabaseQuery instance returned by
|
|
|
|
|
* queryEndingAtValue: will respond to events at nodes with a value less than or
|
|
|
|
|
* equal to endValue.
|
2017-05-15 12:27:07 -07:00
|
|
|
*
|
2019-08-05 13:27:47 -07:00
|
|
|
* @param endValue The upper bound, inclusive, for the value of data visible to
|
|
|
|
|
* the returned FIRDatabaseQuery
|
|
|
|
|
* @return A FIRDatabaseQuery instance, limited to data with value less than or
|
|
|
|
|
* equal to endValue
|
2017-05-15 12:27:07 -07:00
|
|
|
*/
|
|
|
|
|
- (FIRDatabaseQuery *)queryEndingAtValue:(nullable id)endValue;
|
|
|
|
|
|
|
|
|
|
/**
|
2019-08-05 13:27:47 -07:00
|
|
|
* queryEndingAtValue:childKey: is used to generate a reference to a limited
|
|
|
|
|
* view of the data at this location. The FIRDatabaseQuery instance returned by
|
|
|
|
|
* queryEndingAtValue:childKey will respond to events at nodes with a value less
|
|
|
|
|
* than endValue, or equal to endValue and with a key less than or equal to
|
|
|
|
|
* childKey. This is most useful when implementing pagination in a case where
|
|
|
|
|
* multiple nodes can match the endValue.
|
2017-05-15 12:27:07 -07:00
|
|
|
*
|
2019-08-05 13:27:47 -07:00
|
|
|
* @param endValue The upper bound, inclusive, for the value of data visible to
|
|
|
|
|
* the returned FIRDatabaseQuery
|
|
|
|
|
* @param childKey The upper bound, inclusive, for the key of nodes with value
|
|
|
|
|
* equal to endValue
|
|
|
|
|
* @return A FIRDatabaseQuery instance, limited to data with value less than or
|
|
|
|
|
* equal to endValue
|
2017-05-15 12:27:07 -07:00
|
|
|
*/
|
2019-08-05 13:27:47 -07:00
|
|
|
- (FIRDatabaseQuery *)queryEndingAtValue:(nullable id)endValue
|
|
|
|
|
childKey:(nullable NSString *)childKey;
|
2017-05-15 12:27:07 -07:00
|
|
|
|
|
|
|
|
/**
|
2019-08-05 13:27:47 -07:00
|
|
|
* queryEqualToValue: is used to generate a reference to a limited view of the
|
|
|
|
|
* data at this location. The FIRDatabaseQuery instance returned by
|
|
|
|
|
* queryEqualToValue: will respond to events at nodes with a value equal to the
|
|
|
|
|
* supplied argument.
|
2017-05-15 12:27:07 -07:00
|
|
|
*
|
2019-08-05 13:27:47 -07:00
|
|
|
* @param value The value that the data returned by this FIRDatabaseQuery will
|
|
|
|
|
* have
|
2017-05-15 12:27:07 -07:00
|
|
|
* @return A FIRDatabaseQuery instance, limited to data with the supplied value.
|
|
|
|
|
*/
|
|
|
|
|
- (FIRDatabaseQuery *)queryEqualToValue:(nullable id)value;
|
|
|
|
|
|
|
|
|
|
/**
|
2019-08-05 13:27:47 -07:00
|
|
|
* queryEqualToValue:childKey: is used to generate a reference to a limited view
|
|
|
|
|
* of the data at this location. The FIRDatabaseQuery instance returned by
|
|
|
|
|
* queryEqualToValue:childKey will respond to events at nodes with a value equal
|
|
|
|
|
* to the supplied argument and with their key equal to childKey. There will be
|
|
|
|
|
* at most one node that matches because child keys are unique.
|
2017-05-15 12:27:07 -07:00
|
|
|
*
|
2019-08-05 13:27:47 -07:00
|
|
|
* @param value The value that the data returned by this FIRDatabaseQuery will
|
|
|
|
|
* have
|
2017-05-15 12:27:07 -07:00
|
|
|
* @param childKey The name of nodes with the right value
|
2019-08-05 13:27:47 -07:00
|
|
|
* @return A FIRDatabaseQuery instance, limited to data with the supplied value
|
|
|
|
|
* and the key.
|
2017-05-15 12:27:07 -07:00
|
|
|
*/
|
2019-08-05 13:27:47 -07:00
|
|
|
- (FIRDatabaseQuery *)queryEqualToValue:(nullable id)value
|
|
|
|
|
childKey:(nullable NSString *)childKey;
|
2017-05-15 12:27:07 -07:00
|
|
|
|
|
|
|
|
#pragma mark - Properties
|
|
|
|
|
|
|
|
|
|
/**
|
2019-08-05 13:27:47 -07:00
|
|
|
* Gets a FIRDatabaseReference for the location of this query.
|
|
|
|
|
*
|
|
|
|
|
* @return A FIRDatabaseReference for the location of this query.
|
|
|
|
|
*/
|
|
|
|
|
@property(nonatomic, readonly, strong) FIRDatabaseReference *ref;
|
2017-05-15 12:27:07 -07:00
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_END
|