You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

79 lines
2.0 KiB

  1. // Copyright 2018 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // https://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package firestore
  15. // DatabaseRootPath returns the path for the database root resource.
  16. //
  17. // Deprecated: Use
  18. // fmt.Sprintf("projects/%s/databases/%s", project, database)
  19. // instead.
  20. func DatabaseRootPath(project, database string) string {
  21. return "" +
  22. "projects/" +
  23. project +
  24. "/databases/" +
  25. database +
  26. ""
  27. }
  28. // DocumentRootPath returns the path for the document root resource.
  29. //
  30. // Deprecated: Use
  31. // fmt.Sprintf("projects/%s/databases/%s/documents", project, database)
  32. // instead.
  33. func DocumentRootPath(project, database string) string {
  34. return "" +
  35. "projects/" +
  36. project +
  37. "/databases/" +
  38. database +
  39. "/documents" +
  40. ""
  41. }
  42. // DocumentPathPath returns the path for the document path resource.
  43. //
  44. // Deprecated: Use
  45. // fmt.Sprintf("projects/%s/databases/%s/documents/%s", project, database, documentPath)
  46. // instead.
  47. func DocumentPathPath(project, database, documentPath string) string {
  48. return "" +
  49. "projects/" +
  50. project +
  51. "/databases/" +
  52. database +
  53. "/documents/" +
  54. documentPath +
  55. ""
  56. }
  57. // AnyPathPath returns the path for the any path resource.
  58. //
  59. // Deprecated: Use
  60. // fmt.Sprintf("projects/%s/databases/%s/documents/%s/%s", project, database, document, anyPath)
  61. // instead.
  62. func AnyPathPath(project, database, document, anyPath string) string {
  63. return "" +
  64. "projects/" +
  65. project +
  66. "/databases/" +
  67. database +
  68. "/documents/" +
  69. document +
  70. "/" +
  71. anyPath +
  72. ""
  73. }