This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testTransactionIsCanceledAfterServerUpdate() | |
throws InterruptedException, ExecutionException { | |
// This test reproduces https://github.com/firebase/firebase-admin-java/issues/178: | |
// | |
// If we run two transactions (one at "path/nested1" and one at "path"), the SDK did not | |
// correctly re-run the "path" transaction if it got an update from the server for | |
// "path/nested2". This caused the "path" transaction to succeed on the server | |
// (our hash included the update from the server), merging stale data. | |
final DatabaseReference ref = IntegrationTestUtils.getRandomNode(masterApp); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
await firestore.doc('coll/doc').set({'date': FieldValue.serverTimestamp() }); | |
const date : Date = firestore.doc('coll/doc').get().get('date'); | |
await firestore.doc('coll/doc').set({'date': date }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright 2017 Google Inc. | |
* | |
* 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const firestore = admin.firestore; | |
exports.activityLog = functions.firestore | |
.document('privacy/{uid}').onWrite(snap => { | |
const uid = context.params.uid; | |
const settings = snap.data(); | |
settings['udpate_time'] = | |
admin.firestore.FieldValue.serverTimestamp(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
match /activity_log/{uid} { | |
allow create: if request.auth.uid == uid; | |
allow update: if false; | |
allow delete: if false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
match /activity_log/{uid} { | |
allow create: if request.auth.uid == uid; | |
allow update: if false; | |
allow delete: if false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
match /activity_log/{uid} { | |
allow create: if request.auth.uid == uid; | |
allow update: if request.auth.uid == uid && resource == null; | |
allow delete: if false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import os | |
import re | |
import sys | |
def needsTag(idx, lines): | |
idx = idx - 1 # Skip "public void foo()" line |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.database.Cursor; | |
import android.database.sqlite.SQLiteDatabase; | |
import android.database.sqlite.SQLiteOpenHelper; | |
import android.os.Bundle; | |
import android.support.v7.app.AppCompatActivity; | |
public class MainActivity extends AppCompatActivity { | |
private SQLiteDatabase db; | |
@Override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/google-cloud-clients/google-cloud-firestore/src/test/java/com/google/cloud/firestore/FirestoreTest.java b/google-cloud-clients/google-cloud-firestore/src/test/java/com/google/cloud/firestore/FirestoreTest.java | |
index c27e47b2c33..0366f7a0730 100644 | |
--- a/google-cloud-clients/google-cloud-firestore/src/test/java/com/google/cloud/firestore/FirestoreTest.java | |
+++ b/google-cloud-clients/google-cloud-firestore/src/test/java/com/google/cloud/firestore/FirestoreTest.java | |
@@ -18,8 +18,14 @@ package com.google.cloud.firestore; | |
import static com.google.cloud.firestore.LocalFirestoreHelper.SINGLE_FIELD_OBJECT; | |
import static com.google.cloud.firestore.LocalFirestoreHelper.SINGLE_FIELD_PROTO; | |
+import static com.google.cloud.firestore.LocalFirestoreHelper.SINGLE_FIELD_VALUE; | |
+import static com.google.cloud.firestore.LocalFirestoreHelper.UPDATE_PRECONDITION; |