Files
firebase-ios-sdk/Firestore/Source/API/FSTUserDataReader.h
T

95 lines
3.4 KiB
Objective-C
Raw Normal View History

2017-10-03 08:55:22 -07:00
/*
2021-07-22 12:44:17 -06:00
* Copyright 2021 Google LLC
2017-10-03 08:55:22 -07:00
*
* 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 <Foundation/Foundation.h>
2018-04-10 16:28:22 -04:00
#include <vector>
2021-07-22 12:44:17 -06:00
#include "Firestore/Protos/nanopb/google/firestore/v1/document.nanopb.h"
#include "Firestore/core/src/core/core_fwd.h"
#include "Firestore/core/src/model/database_id.h"
#include "Firestore/core/src/model/model_fwd.h"
2021-07-22 12:44:17 -06:00
#include "Firestore/core/src/nanopb/message.h"
@class FIRTimestamp;
2017-10-03 08:55:22 -07:00
namespace core = firebase::firestore::core;
namespace model = firebase::firestore::model;
2021-07-22 12:44:17 -06:00
namespace nanopb = firebase::firestore::nanopb;
2017-10-03 08:55:22 -07:00
NS_ASSUME_NONNULL_BEGIN
/**
* An internal representation of FIRDocumentReference, representing a key in a specific database.
* This is necessary because keys assume a database from context (usually the current one).
* FSTDocumentKeyReference binds a key to a specific databaseID.
*
* TODO(b/64160088): Make DocumentKey aware of the specific databaseID it is tied to.
2017-10-03 08:55:22 -07:00
*/
@interface FSTDocumentKeyReference : NSObject
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithKey:(model::DocumentKey)key
databaseID:(model::DatabaseId)databaseID NS_DESIGNATED_INITIALIZER;
2017-10-03 08:55:22 -07:00
- (const model::DocumentKey &)key;
@property(nonatomic, assign, readonly) const model::DatabaseId &databaseID;
2017-10-03 08:55:22 -07:00
@end
/**
* An interface that allows arbitrary pre-converting of user data.
*
* Returns the converted value (can return back the input to act as a no-op).
*/
typedef id _Nullable (^FSTPreConverterBlock)(id _Nullable);
/**
* Helper for parsing raw user input (provided via the API) into internal model classes.
*/
2021-07-22 12:44:17 -06:00
@interface FSTUserDataReader : NSObject
2017-10-03 08:55:22 -07:00
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithDatabaseID:(model::DatabaseId)databaseID
2017-10-03 08:55:22 -07:00
preConverter:(FSTPreConverterBlock)preConverter NS_DESIGNATED_INITIALIZER;
/** Parse document data from a non-merge setData call.*/
- (core::ParsedSetData)parsedSetData:(id)input;
2017-10-03 08:55:22 -07:00
/** Parse document data from a setData call with `merge:YES`. */
- (core::ParsedSetData)parsedMergeData:(id)input fieldMask:(nullable NSArray<id> *)fieldMask;
/** Parse update data from an updateData call. */
- (core::ParsedUpdateData)parsedUpdateData:(id)input;
2017-10-03 08:55:22 -07:00
/** Parse a "query value" (e.g. value in a where filter or a value in a cursor bound). */
2021-07-22 12:44:17 -06:00
- (nanopb::Message<firebase::firestore::google_firestore_v1_Value>)parsedQueryValue:(id)input;
2017-10-03 08:55:22 -07:00
/**
* Parse a "query value" (e.g. value in a where filter or a value in a cursor bound).
*
* @param allowArrays Whether the query value is an array that may directly contain additional
* arrays (e.g.) the operand of an `in` query).
*/
2021-07-22 12:44:17 -06:00
- (nanopb::Message<firebase::firestore::google_firestore_v1_Value>)parsedQueryValue:(id)input
allowArrays:
(bool)allowArrays;
2017-10-03 08:55:22 -07:00
@end
NS_ASSUME_NONNULL_END