document.proto 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. // Copyright 2021 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. // http://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. syntax = "proto3";
  15. package google.firestore.v1;
  16. import "google/protobuf/struct.proto";
  17. import "google/protobuf/timestamp.proto";
  18. import "google/type/latlng.proto";
  19. import "google/api/annotations.proto";
  20. option csharp_namespace = "Google.Cloud.Firestore.V1";
  21. option go_package = "google.golang.org/genproto/googleapis/firestore/v1;firestore";
  22. option java_multiple_files = true;
  23. option java_outer_classname = "DocumentProto";
  24. option java_package = "com.google.firestore.v1";
  25. option objc_class_prefix = "GCFS";
  26. option php_namespace = "Google\\Cloud\\Firestore\\V1";
  27. option ruby_package = "Google::Cloud::Firestore::V1";
  28. // A Firestore document.
  29. //
  30. // Must not exceed 1 MiB - 4 bytes.
  31. message Document {
  32. // The resource name of the document, for example
  33. // `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
  34. string name = 1;
  35. // The document's fields.
  36. //
  37. // The map keys represent field names.
  38. //
  39. // A simple field name contains only characters `a` to `z`, `A` to `Z`,
  40. // `0` to `9`, or `_`, and must not start with `0` to `9`. For example,
  41. // `foo_bar_17`.
  42. //
  43. // Field names matching the regular expression `__.*__` are reserved. Reserved
  44. // field names are forbidden except in certain documented contexts. The map
  45. // keys, represented as UTF-8, must not exceed 1,500 bytes and cannot be
  46. // empty.
  47. //
  48. // Field paths may be used in other contexts to refer to structured fields
  49. // defined here. For `map_value`, the field path is represented by the simple
  50. // or quoted field names of the containing fields, delimited by `.`. For
  51. // example, the structured field
  52. // `"foo" : { map_value: { "x&y" : { string_value: "hello" }}}` would be
  53. // represented by the field path `foo.x&y`.
  54. //
  55. // Within a field path, a quoted field name starts and ends with `` ` `` and
  56. // may contain any character. Some characters, including `` ` ``, must be
  57. // escaped using a `\`. For example, `` `x&y` `` represents `x&y` and
  58. // `` `bak\`tik` `` represents `` bak`tik ``.
  59. map<string, Value> fields = 2;
  60. // Output only. The time at which the document was created.
  61. //
  62. // This value increases monotonically when a document is deleted then
  63. // recreated. It can also be compared to values from other documents and
  64. // the `read_time` of a query.
  65. google.protobuf.Timestamp create_time = 3;
  66. // Output only. The time at which the document was last changed.
  67. //
  68. // This value is initially set to the `create_time` then increases
  69. // monotonically with each change to the document. It can also be
  70. // compared to values from other documents and the `read_time` of a query.
  71. google.protobuf.Timestamp update_time = 4;
  72. }
  73. // A message that can hold any of the supported value types.
  74. message Value {
  75. // Must have a value set.
  76. oneof value_type {
  77. // A null value.
  78. google.protobuf.NullValue null_value = 11;
  79. // A boolean value.
  80. bool boolean_value = 1;
  81. // An integer value.
  82. int64 integer_value = 2;
  83. // A double value.
  84. double double_value = 3;
  85. // A timestamp value.
  86. //
  87. // Precise only to microseconds. When stored, any additional precision is
  88. // rounded down.
  89. google.protobuf.Timestamp timestamp_value = 10;
  90. // A string value.
  91. //
  92. // The string, represented as UTF-8, must not exceed 1 MiB - 89 bytes.
  93. // Only the first 1,500 bytes of the UTF-8 representation are considered by
  94. // queries.
  95. string string_value = 17;
  96. // A bytes value.
  97. //
  98. // Must not exceed 1 MiB - 89 bytes.
  99. // Only the first 1,500 bytes are considered by queries.
  100. bytes bytes_value = 18;
  101. // A reference to a document. For example:
  102. // `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
  103. string reference_value = 5;
  104. // A geo point value representing a point on the surface of Earth.
  105. google.type.LatLng geo_point_value = 8;
  106. // An array value.
  107. //
  108. // Cannot directly contain another array value, though can contain an
  109. // map which contains another array.
  110. ArrayValue array_value = 9;
  111. // A map value.
  112. MapValue map_value = 6;
  113. }
  114. }
  115. // An array value.
  116. message ArrayValue {
  117. // Values in the array.
  118. repeated Value values = 1;
  119. }
  120. // A map value.
  121. message MapValue {
  122. // The map's fields.
  123. //
  124. // The map keys represent field names. Field names matching the regular
  125. // expression `__.*__` are reserved. Reserved field names are forbidden except
  126. // in certain documented contexts. The map keys, represented as UTF-8, must
  127. // not exceed 1,500 bytes and cannot be empty.
  128. map<string, Value> fields = 1;
  129. }