Search in sources :

Example 21 with FieldPath

use of com.google.firebase.firestore.model.FieldPath in project firebase-android-sdk by firebase.

the class RemoteSerializer method decodeFieldFilter.

@VisibleForTesting
FieldFilter decodeFieldFilter(StructuredQuery.FieldFilter proto) {
    FieldPath fieldPath = FieldPath.fromServerFormat(proto.getField().getFieldPath());
    FieldFilter.Operator filterOperator = decodeFieldFilterOperator(proto.getOp());
    return FieldFilter.create(fieldPath, filterOperator, proto.getValue());
}
Also used : FieldFilter(com.google.firebase.firestore.core.FieldFilter) FieldPath(com.google.firebase.firestore.model.FieldPath) VisibleForTesting(androidx.annotation.VisibleForTesting)

Example 22 with FieldPath

use of com.google.firebase.firestore.model.FieldPath in project firebase-android-sdk by firebase.

the class SetMutation method applyToLocalView.

@Override
public FieldMask applyToLocalView(MutableDocument document, @Nullable FieldMask previousMask, Timestamp localWriteTime) {
    verifyKeyMatches(document);
    if (!this.getPrecondition().isValidFor(document)) {
        return previousMask;
    }
    Map<FieldPath, Value> transformResults = localTransformResults(localWriteTime, document);
    ObjectValue localValue = value.clone();
    localValue.setAll(transformResults);
    document.convertToFoundDocument(document.getVersion(), localValue).setHasLocalMutations();
    // SetMutation overwrites all fields.
    return null;
}
Also used : ObjectValue(com.google.firebase.firestore.model.ObjectValue) FieldPath(com.google.firebase.firestore.model.FieldPath) ObjectValue(com.google.firebase.firestore.model.ObjectValue) Value(com.google.firestore.v1.Value)

Aggregations

FieldPath (com.google.firebase.firestore.model.FieldPath)22 ObjectValue (com.google.firebase.firestore.model.ObjectValue)10 Value (com.google.firestore.v1.Value)9 ArrayList (java.util.ArrayList)7 Nullable (androidx.annotation.Nullable)3 ParseAccumulator (com.google.firebase.firestore.core.UserData.ParseAccumulator)3 ByteString (com.google.protobuf.ByteString)3 ArrayRemoveFieldValue (com.google.firebase.firestore.FieldValue.ArrayRemoveFieldValue)2 ArrayUnionFieldValue (com.google.firebase.firestore.FieldValue.ArrayUnionFieldValue)2 DeleteFieldValue (com.google.firebase.firestore.FieldValue.DeleteFieldValue)2 ServerTimestampFieldValue (com.google.firebase.firestore.FieldValue.ServerTimestampFieldValue)2 FieldFilter (com.google.firebase.firestore.core.FieldFilter)2 OrderBy (com.google.firebase.firestore.core.OrderBy)2 Direction (com.google.firebase.firestore.core.OrderBy.Direction)2 ParseContext (com.google.firebase.firestore.core.UserData.ParseContext)2 FieldIndex (com.google.firebase.firestore.model.FieldIndex)2 ArrayValue (com.google.firestore.v1.ArrayValue)2 MapValue (com.google.firestore.v1.MapValue)2 NullValue (com.google.protobuf.NullValue)2 HashMap (java.util.HashMap)2