-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Add Firestore reactive sample #1739
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
Conversation
Change-Id: I8ae1d62356927dca9cf62ff7fdf0f887550ec6ae
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:]) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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:]) |
There was a problem hiding this comment.
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.
Change-Id: Iaf6f448115f28060514016ee96a9144fabc9d824
Related sub-builds are passing - merging. |
Lint and tests are passing locally.