Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Firestore reactive sample #1739

Merged
merged 4 commits into from
Oct 15, 2018
Merged

Add Firestore reactive sample #1739

merged 4 commits into from
Oct 15, 2018

Conversation

ace-n
Copy link

@ace-n ace-n commented Oct 6, 2018

Lint and tests are passing locally.

Change-Id: I8ae1d62356927dca9cf62ff7fdf0f887550ec6ae
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Oct 6, 2018
def make_upper_case(data, context):
path_parts = context.resource.split('/documents/')[1].split('/')
collection_path = path_parts[0]
document_path = '/'.join(path_parts[1:])
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't suppose there are helpers for this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

os.path handles paths intelligently, is that something we can leverage? If that's not a good fit, can you explain what you're intending to do? I can't seem to process this code in my head right now.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a Firebase document path, not an OS one. Will os.path still work here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly I am not sure. There may also be useful url/uri manipulation features elsewhere in the standard library if that is better.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything I've found works with the right side of a path, not the left. Only functions that do the latter would be convenient here.

Also, Firestore document names cannot contain the / character (according to the Cloud Console) - so we shouldn't have to worry about character escaping.

def make_upper_case(data, context):
path_parts = context.resource.split('/documents/')[1].split('/')
collection_path = path_parts[0]
document_path = '/'.join(path_parts[1:])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

os.path handles paths intelligently, is that something we can leverage? If that's not a good fit, can you explain what you're intending to do? I can't seem to process this code in my head right now.

@ace-n ace-n added kokoro:run Add this label to force Kokoro to re-run the tests. and removed needs review labels Oct 15, 2018
@kokoro-team kokoro-team removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Oct 15, 2018
@ace-n
Copy link
Author

ace-n commented Oct 15, 2018

Related sub-builds are passing - merging.

@ace-n ace-n merged commit a68245f into master Oct 15, 2018
@ace-n ace-n deleted the firestore-reax branch October 15, 2018 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants