chore: refactor datastore samples #2033
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
You (probably): Why are you doing this?
Me: because samples should be able to be executed on the command line (e.g.
php datastore/src/delete.php 'key-id-to-delete')You: Then why do some of the sample functions still contain objects (e.g.
datastore/src/run_query.php)?Me: Well, I didn't really know how to make those accept scalar arguments, and I didn't think it was THAT important of a rule to follow
You: Why did you change the order of arguments around in some cases?
Me: Well, because I'd like to put the most important arguments first, and the
$namespaceId(which we needed to add in order to get rid of passing in the wholeDatastoreClientobject) is not really that interesting, and basically only used in testing, so I wanted it to be last.You (hopefully): Hey that makes a lot of sense, great job!
Me: Thanks a lot, you too!
/scene